redis 6.*安装及问题解决

获取资源

wget https://download.redis.io/releases/redis-6.0.8.tar.gz

解压

tar -zxvf redis-6.0.8.tar.gz

安装

cd redis-6.0.8
make
cd src
make install PREFIX=/usr/local/redis

移动配置文件到安装目录

cd …/
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc

修改配置,支持台启动和远程连接

daemonize yes
protected-mode no
bind 0.0.0.0

拷贝启动脚本至 /usr/local/bin目录

cp /usr/local/redis/bin/redis-server /usr/local/bin
cp /usr/local/redis/bin/redis-cli /usr/local/bin

启动

redis-server /usr/local/redis/etc/redis.conf

启动客户端

redis-cli

设置密码

config set requirepass ****

停止

pkill redis

问题:

6.x以后的版本安装时,可能会碰到如下问题
报错server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’

……
server.c:5101:19: error: ‘struct redisServer’ has no member named ‘sofd’
         if (server.sofd > 0)
                   ^
server.c:5102:94: error: ‘struct redisServer’ has no member named ‘unixsocket’
             serverLog(LL_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
                                                                                              ^
server.c:5103:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
         if (server.supervised_mode == SUPERVISED_SYSTEMD) {
                   ^
server.c:5104:24: error: ‘struct redisServer’ has no member named ‘masterhost’
             if (!server.masterhost) {
                        ^
server.c:5117:15: error: ‘struct redisServer’ has no member named ‘maxmemory’
     if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
               ^
server.c:5117:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
……

原因:查看gcc的版本是否在 5.3以上,centos7默认是4.8.5.我这里的就是4.8.5

解决方案:

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

scl enable devtoolset-9 bash  #scl命令启用只是临时的
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile  #永久生效
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值