1、redis6 安装
下载地址 redis.io/download
或使用命令:
wget http://download.redis.io/releases/redis-6.0.8.tar.gz
[root@localhost softhere]# tar -zxvf redis-6.0.8.tar.gz -C /opt/module
[root@localhost module]# cd redis-6.0.8/
[root@localhost redis-6.0.8]# make && make install
2、报错信息
^
server.c:5285:19: 错误:‘struct redisServer’没有名为‘supervised_mode’的成员
if (server.supervised_mode == SUPERVISED_SYSTEMD) {
^
server.c:5286:24: 错误:‘struct redisServer’没有名为‘masterhost’的成员
if (!server.masterhost) {
^
server.c:5296:19: 错误:‘struct redisServer’没有名为‘supervised_mode’的成员
if (server.supervised_mode == SUPERVISED_SYSTEMD) {
^
server.c:5303:15: 错误:‘struct redisServer’没有名为‘maxmemory’的成员
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
^
server.c:5303:39: 错误:‘struct redisServer’没有名为‘maxmemory’的成员
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
^
server.c:5304:176: 错误:‘struct redisServer’没有名为‘maxmemory’的成员
serverLog(LL_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory);
解决方案:
1、查看gcc版本 gcc -v
centos7 默认安装的gcc 版本为:
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
2、 升级gcc到5.3及以上,如下:
升级到gcc 9.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命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。
如果要长期使用gcc 9.3的话:
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
这样退出shell重新打开就是新版的gcc了
以下其他版本同理,修改devtoolset版本号即可。
再重新执行下make && make install 命令
3、安装完成
需要进入/usr/local/bin 目录,默认的安装位置
[root@localhost bin]# ls
redis-benchmark redis-check-rdb redis-sentinel
redis-check-aof redis-cli redis-server
[root@localhost bin]# pwd
/usr/local/bin
把redis.conf 的文件复制过来,对里面的进行配置后,即可以使用
[root@localhost bin]# ./redis-server redis.conf
[root@localhost bin]# ./redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
4、补充命令(需要时使用)
# 编译出错时,清出编译生成的文件
make distclean
# 编译安装到指定目录下
make PREFIX=/usr/local/redis install
# 卸载
make uninstall