Redis 6.0安装排坑
Redis 下载路径:http://www.redis.cn/download.html
环境
- 系统
CentOS Linux release 7.9.2009 (Core)
- gc版本
4.8.5
报错
报错1:src/redis-server: No such file or directory
执行 src/redis-server` 启动Redis,报错src/redis-server: No such file or directory
原因: Redis是C实现的,需要gcc来进行编译,原因可能是未安装gcc,
解决方案: 使用命令安装gcc:yum install -y gcc
删除 Redis解压文件,重新解压编译make
报错2:has no member named
原因: gcc版本过低
方案: 查看gcc的版本是否在 5.3以上,centos7默认是4.8.5.我这里的就是4.8.5
gcc -v升级到 5.3及以上版本
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命令启用只是临时的,推出xshell或者重启就会恢复到原来的gcc版本。
如果要长期生效的话,执行如下:
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
protected mode because protected mode is enabled
redis-cli -h 127.0.0.1 -p 6379
正常访问,输入redis-cli -h IP(e.g 192.168.0.1) -p 6379
报错
(error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients.
原因: protected-mode 和 bind 127.0.0.1配置问题
解决方案: redis.conf 里 找到 bind 127.0.0.1 配置行,加# 注释# bind 127.0.0.1
protected-mode配置行 protected-mode yes 更改为protected-mode no
参考
https://blog.csdn.net/hello_cmy/article/details/106062327
https://blog.csdn.net/tv002/article/details/87882347