CentOs安装Redis

1.安装Redis

$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make && make PREFIX=/usr/local/redis install

测试启动Redis

$ Redis-server

2.修改Redis配置文件

复制redis-5.0.5目录中的redis.conf文件到/usr/local/redis/,修改复制过来的文件

$ cp -r redis.conf /usr/local/redis/
$ vi /usr/local/redis/redis.conf

常用修改内容:

  1. daemonize no-->daemonize yes,允许redis-server以后端模式启动
  2. bind 127.0.0.1-->bind 0.0.0.0,允许远程连接
  3. requirepass --> requirepass yourpassword,设置密码
  4. protected-mode yes-->protected-mode no,允许公网访问

保存配置文件后重启Redis

$ redis-cli 
>shutdown
$ redis-server ../redis.conf       #制定配置文件启动redis-server
$ redis-cli yourpassword
posted @ 2019-10-17 11:49  AnotherBlue  阅读(152)  评论(0编辑  收藏  举报