• 阿里云Ubuntu安装并配置redis


    使用命令行更新所有的软件包

    sudo apt-get update
    ###### 在Linux Ubuntu中安装Redis数据库
    
    ```LINUX
    #安装Redis服务器端
    ~ sudo apt-get install redis-server
    

    安装完成后,Redis服务器会自动启动,我们检查Redis服务器程序

    # 检查Redis服务器系统进程
    ~ ps -aux|grep redis
    redis     4162  0.1  0.0  10676  1420 ?        Ss   23:24   0:00 /usr/bin/redis-server /etc/redis/redis.conf
    conan     4172  0.0  0.0  11064   924 pts/0    S+   23:26   0:00 grep --color=auto redis
    
    # 通过启动命令检查Redis服务器状态
    ~ netstat -nlt|grep 6379
    tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN
    
    # 通过启动命令检查Redis服务器状态
    ~ sudo /etc/init.d/redis-server status
    redis-server is running
    
    通过命令行客户端访问Redis

    安装Redis服务器,会自动地一起安装Redis命令行客户端程序。
    在本机输入redis-cli命令就可以启动,客户端程序访问Redis服务器。

    ~ redis-cli
    redis 127.0.0.1:6379>
    
    # 命令行的帮助
    redis 127.0.0.1:6379> help
    redis-cli 2.2.12
    Type: "help @" to get a list of commands in 
          "help " for help on 
          "help " to get a list of possible help topics
          "quit" to exit
    
    
    # 查看所有的key列表
    redis 127.0.0.1:6379> keys *
    (empty list or set)
    
    修改Redis的配置

    默认情况下,访问Redis服务器是不需要密码的,为了增加安全性我们需要设置Redis服务器的访问密码。设置访问密码为redisredis。

    • 用vi打开Redis服务器的配置文件redis.conf
    ~ sudo vi /etc/redis/redis.conf
    
    #取消注释requirepass
    requirepass redisredis
    
    让Redis服务器被远程访问
    ~ sudo vi /etc/redis/redis.conf
    
    #注释bind
    #bind 127.0.0.1
    
    修改后,重启Redis服务器。
    
    ~ sudo /etc/init.d/redis-server restart
    Stopping redis-server: redis-server.
    Starting redis-server: redis-server.
    
    • 我们检查Redis的网络监听端口
    检查Redis服务器占用端口
    ~ netstat -nlt|grep 6379
    tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN
    
    我唯一的害怕,是你们已经不相信了——不相信规则能战胜潜规则,不相信学场有别于官场,不相信学术不等于权术,不相信风骨远胜于媚骨,在这个怀疑的时代,我们仍然要有信仰,信仰努力而不是运气,这个世界虽然不够纯洁,但我仍然相信它还不能埋没真正有才华的人
  • 相关阅读:
    大数据Hadoop-2
    大数据Hadoop-1
    Consistent Hashing
    分支的创建、删除、切换、合并以及冲突解决
    windows WEB 高可用/可伸缩
    Oracle行转列、列转行的Sql语句总结
    从零到百亿互联网金融架构发展史---架构变迁
    WebJars
    springcloud(五):熔断监控Hystrix Dashboard和Turbine
    SpringBoot编写自定义的starter 专题
  • 原文地址:https://www.cnblogs.com/wyh0923/p/14906056.html
Copyright © 2020-2023  润新知