准备 Redis官网 CentOS官网 redis-6.0.6.tar.gz CentOS-7-x86_64-Everything-2003.iso
安装Redis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 yum install -y gcc wget tar vim wget http://download.redis.io/releases/redis-6.0.6.tar.gz tar -zxvf redis-6.0.6.tar.gz cd redis-6.0.6make PREFIX=/usr/local/redis install mkdir /usr/local/redis/conf/cp redis.conf /usr/local/redis/conf/vim /etc/profile export REDIS=/usr/local/redisexport PATH=:$PATH :$REDIS /binESC :wq source /etc/profileredis-server /usr/local/redis/conf/redis.conf
报错 报错1:server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’ 1 2 3 4 5 server.c:5159:49: error: struct redisServer has no member named supervised int background = server.daemonize && !server.supervised; ^ server.c:5163:29: error: struct redisServer has no member named pidfile if (background || server.pidfile) createPidFile();
解决办法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 gcc -v yum -y install centos-release-scl yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils scl enable devtoolset-9 bash gcc -v make PREFIX=/usr/local/redis install
启动警告 WARNING overcommit_memory is set to 0! 1 2 3 4 5 6 7 8 9 10 11 vim /etc/sysctl.conf vm.overcommit_memory=1 ESC :wq sysctl -p
WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. 1 2 3 4 5 6 7 8 9 10 11 echo never > /sys/kernel/mm/transparent_hugepage/enabledvim /etc/rc.local if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabledfi ESC :wq
WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn 1 2 3 4 5 6 7 8 9 10 11 vim /etc/sysctl.conf net.core.somaxconn=1024 ESC :wq sysctl -p