1下载redis6.0.9
代码语言:javascript复制[root@linux-001 ~]# wget http://download.redis.io/releases/redis-6.0.9.tar.gz
[root@linux-001 ~]# tar -xf redis-6.0.9.tar.gz /opt/
[root@linux-001 ~]# cd /opt/redis-6.0.9
2 安装redis6.0.9
在进行make的时候出现如下报错:
代码语言:javascript复制[root@linux-001 redis-6.0.9]# make
server.c:5320:44: 错误:‘struct redisServer’没有名为‘tlsfd_count’的成员
if (server.ipfd_count > 0 || server.tlsfd_count > 0)
^
server.c:5322:19: 错误:‘struct redisServer’没有名为‘sofd’的成员
if (server.sofd > 0)
^
server.c:5323:94: 错误:‘struct redisServer’没有名为‘unixsocket’的成员
serverLog(LL_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
^
server.c:5324:19: 错误:‘struct redisServer’没有名为‘supervised_mode’的成员
if (server.supervised_mode == SUPERVISED_SYSTEMD) {
^
server.c:5325:24: 错误:‘struct redisServer’没有名为‘masterhost’的成员
if (!server.masterhost) {
^
server.c:5335:19: 错误:‘struct redisServer’没有名为‘supervised_mode’的成员
if (server.supervised_mode == SUPERVISED_SYSTEMD) {
^
server.c:5342:15: 错误:‘struct redisServer’没有名为‘maxmemory’的成员
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
^
server.c:5342:39: 错误:‘struct redisServer’没有名为‘maxmemory’的成员
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
^
server.c:5343: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);
^
server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员
redisSetCpuAffinity(server.server_cpulist);
^
server.c: 在函数‘hasActiveChildProcess’中:
server.c:1478:1: 警告:在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]
}
^
server.c: 在函数‘allPersistenceDisabled’中:
server.c:1484:1: 警告:在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]
}
^
server.c: 在函数‘writeCommandsDeniedByDiskError’中:
server.c:3934:1: 警告:在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]
}
^
server.c: 在函数‘iAmMaster’中:
server.c:5134:1: 警告:在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]
}
^
make[1]: *** [server.o] 错误 1
make: *** [all] 错误 2
[root@linux-002 redis-6.0.9]# cat install.log
cd src && make all
make[1]: 进入目录“/opt/redis-6.0.9/src”
make[1]: 离开目录“/opt/redis-6.0.9/src”
解决办法:
代码语言:javascript复制[root@linux-001 redis-6.0.9]# yum -y install centos-release-scl
[root@linux-001 redis-6.0.9]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c devtoolset-9-binutils
##以下为临时启用gcc 9.3:
[root@linux-002 redis-6.0.9]# scl enable devtoolset-9 bash
[root@linux-002 redis-6.0.9]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c ,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
如果是长期使用gcc9.3需要使用命令: echo “source /opt/rh/devtoolset-9/enable” >>/etc/profile,继续执行make操作
代码语言:javascript复制[root@linux-001 redis-6.0.9]# make
cd src && make all
make[1]: 进入目录“/opt/redis-6.0.9/src”
CC server.o
CC sds.o
CC zmalloc.o
CC lzf_c.o
CC lzf_d.o
CC pqsort.o
CC zipmap.o
CC sha1.o
CC ziplist.o
CC release.o
CC networking.o
CC util.o
CC object.o
CC db.o
CC replication.o
CC rdb.o
CC t_string.o
CC t_list.o
CC t_set.o
CC t_zset.o
CC t_hash.o
CC config.o
CC aof.o
CC pubsub.o
CC multi.o
CC debug.o
CC sort.o
CC intset.o
CC syncio.o
CC cluster.o
CC crc16.o
CC endianconv.o
CC slowlog.o
CC scripting.o
CC bio.o
CC rio.o
CC rand.o
CC memtest.o
CC crcspeed.o
CC crc64.o
CC bitops.o
CC sentinel.o
CC notify.o
CC setproctitle.o
CC blocked.o
CC hyperloglog.o
CC latency.o
CC sparkline.o
CC redis-check-rdb.o
CC redis-check-aof.o
CC geo.o
CC lazyfree.o
CC module.o
CC evict.o
CC expire.o
CC geohash.o
CC geohash_helper.o
CC childinfo.o
CC defrag.o
CC siphash.o
CC rax.o
CC t_stream.o
CC listpack.o
CC localtime.o
CC lolwut.o
CC lolwut5.o
CC lolwut6.o
CC acl.o
CC gopher.o
CC tracking.o
CC connection.o
CC tls.o
CC sha256.o
CC timeout.o
CC setcpuaffinity.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof
Hint: It's a good idea to run 'make test' ;)
make[1]: 离开目录“/opt/redis-6.0.9/src”
[root@linux-001 redis-6.0.9]# make install
cd src && make install
make[1]: 进入目录“/opt/redis-6.0.9/src”
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: 离开目录“/opt/redis-6.0.9/src”
3. make test 操作
执行make test又会有如下报错:
代码语言:javascript复制[root@linux-002 redis-6.0.9]# make test
cd src && make test
make[1]: 进入目录“/opt/redis-6.0.9/src”
You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] 错误 1
make[1]: 离开目录“/opt/redis-6.0.9/src”
make: *** [test] 错误 2
上代码报错信息需要安装tcl即可解决。
代码语言:javascript复制[root@linux-002 redis-6.0.9]# yum install tcl
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* centos-sclo-rh: mirrors.163.com
* centos-sclo-sclo: mirrors.ustc.edu.cn
* epel: mirrors.neusoft.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 tcl.x86_64.1.8.5.13-8.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==================================================================================================================================================================================================================
Package 架构 版本 源 大小
==================================================================================================================================================================================================================
正在安装:
tcl x86_64 1:8.5.13-8.el7 base 1.9 M
事务概要
==================================================================================================================================================================================================================
安装 1 软件包
总下载量:1.9 M
安装大小:4.4 M
Is this ok [y/d/N]: y
Downloading packages:
tcl-8.5.13-8.el7.x86_64.rpm | 1.9 MB 00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 1:tcl-8.5.13-8.el7.x86_64 1/1
验证中 : 1:tcl-8.5.13-8.el7.x86_64 1/1
已安装:
tcl.x86_64 1:8.5.13-8.el7
完毕!
执行make test的结果如下