CentOS 7 平台下编译安装Redis 5.0

悠悠 2021-12-23 14:23 251阅读 0赞

1、下载当前稳定版

  1. wget http://download.redis.io/releases/redis-stable.tar.gz

或者

  1. wget http://download.redis.io/releases/redis-5.0.5.tar.g

2、加压缩

  1. tar -zxvf redis-5.0.5.tar.gz

3、编译

  1. cd redis-5.0.5/
  2. make
  3. make install PREFIX=/usr/local/redis

4、编辑配置文件

  1. vi redis.conf
  2. bind 10.17.12.160
  3. protected-mode no
  4. port 6379
  5. daemonize yes
  6. requirepass 123456

说明:
daemonize yes表示后台运行
protected-mode no表示关闭保护模式

  1. cp redis.conf /usr/local/redis

5、启动服务

  1. cd /usr/local/redis
  2. bin/redis-server redis.conf >> /var/log/redis.log &

6、简单使用

登录bin/redis-cli -h 10.17.12.XXX -p 6379 -a 123456

  1. [root@server redis]# bin/redis-cli -h 10.17.12.xxx -p 6379 -a 123456
  2. Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
  3. 10.17.12.xxx:6379> set "name" "chengyuqiang"
  4. OK
  5. 10.17.12.xxx:6379> get "name"
  6. "chengyuqiang"
  7. 10.17.12.xxx:6379> quit
  8. [root@server redis]#

7、关闭服务

  1. [root@server ~]# ps -aux | grep redis
  2. root 763 0.1 0.1 159468 11952 ? Ssl 09:35 0:02 /usr/local/redis/bin/redis-server 10.17.12.xxx:6379
  3. root 1182 0.0 0.0 112648 952 pts/0 S+ 10:08 0:00 grep --color=auto redis
  4. [root@server ~]# kill 763

发表评论

表情:
评论列表 (有 0 条评论,251人围观)

还没有评论,来说两句吧...

相关阅读