参考自己之前写的安装5.0.3 centos7安装redis5.0.3详细步骤_lanren312的博客-CSDN博客
一开始大意了,没有安装gcc,直接就make
[root@localhost redis-5.0.7]# make
cd src && make all
make[1]: Entering directory `/opt/redis-5.0.7/src'
LINK redis-server
cc: error: ../deps/hiredis/libhiredis.a: No such file or directory
cc: error: ../deps/lua/src/liblua.a: No such file or directory
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/opt/redis-5.0.7/src'
make: *** [all] Error 2
先清除 make distclean
[root@localhost redis-5.0.7]# make distclean
cd src && make distclean
make[1]: Entering directory `/opt/redis-5.0.7/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
(cd ../deps && make distclean)
make[2]: Entering directory `/opt/redis-5.0.7/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/opt/redis-5.0.7/deps'
(rm -f .make-*)
make[1]: Leaving directory `/opt/redis-5.0.7/src'
再安装 make && make install
[root@localhost redis-5.0.7]# make && make install
WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
Server initialized
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
Ready to accept connections
编辑/etc/sysctl.conf文件,添加
net.core.somaxconn = 1024
vm.overcommit_memory = 1
检查是否添加成功
sysctl -p
重启 redis
systemctl restart redis.service
还是有报错
Server initialized
WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
DB loaded from disk: 0.000 seconds
Ready to accept connections
编辑 etc/rc.local,在最下面添加
echo never > /sys/kernel/mm/transparent_hugepage/enabled
再次重新启动redis,发现并没有用
期间直接启动 ,开始是成功了,但过一会就断了。
/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
再去检查redis.conf
发现daemonize是 no,protected-mode是 yes, 我记得之前是改过的
再次修改 daemonize yes,protected-mode no
重启redis,就正常了。