下载、解压缩和编译Redis:
$ wget http://download.redis.io/releases/redis-5.0.4.tar.gz
$ tar xzf redis-5.0.4.tar.gz
$ cd redis-5.0.4
$ make
(1)命令安装gcc:yum install gcc 如果出现下面错误
[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/src‘
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/root/redis-2.8.17/src‘
make: *** [all] Error 2
则将make改为make MALLOC=libc,推测是因为编译库的问题。
[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/src‘
CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/root/redis-2.8.17/src‘
make: *** [all] Error 2
现在编译的二进制文件可以在src
目录。运行Redis:
$ src/redis-server
您可以使用内置客户端与Redis交互:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
redis关闭
到redis节点目录下执行如下命令
redis-cli -p 6379 shutdown
重启
service redis restart
redis图形化客户端无法连接redis服务
打开配置文件
vim redis-conf
更改系统配置
注释掉 bin 127.0.0.1
更改保护模式
protected-mode no
设置redis默认守护进程方法
daemonize no
最后重启
src/redis-server redis.conf
原文:https://www.cnblogs.com/mengshuo/p/10815773.html