Centos7 安装redis

Step1

下载安装包

$ cd  /home

$ mkdir soft

$ cd /soft

$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz

$ tar -zxvf redis-5.0.5.tar.gz

$ yum install gcc

$ cd redis-5.0.5/src

$ make MALLOC=libc

$ make install 

 

Step2

修改配置文件:

配置文件默认地址:/home/soft/redis-5.0.5/redis.conf

$ vi /home/soft/redis-5.0.5/redis.conf

1、配置后台启动:daemonize no  ------> daemonize yes

2、配置 访问IP:  bind 127.0.0.1 -----> #bind 127.0.0.1(注释起来)或者bind    0.0.0.0(这样就可以任一IP访问)

3、配置密码 requirepass  yourpassword (比如 requirepass 123456)

4、配置指定配置文件

Step3

启动、关闭Redis:

$ /home/soft/redis-5.0.5/src/redis-server /home/soft/redis-5.0.5/redis.conf (   定配置文件启动redis)

 

$ /home/soft/redis-5.0.5/src/redis-cli (客户端访问redis)

$ /home/soft/redis-5.0.5/src/redis-cli -a 123456” (带密码访问redis)

$  在客户端内直接输入: shutdown (关闭redis

*************************************************THE END *****************************************************************************************

 

posted @ 2021-04-26 14:08  爱之-♡信仰  阅读(63)  评论(0)    收藏  举报