目前Redis总共有四个大版本提供下载,分别是:5.0.xx、6.0.xx、6.2.xx、7.0.xx
下载地址如下:
本次安装测试使用的系统为 CentOS 7.9 x86_64,在安装之前,需要预先安装GCC环境,在线安装命令如下:
# yum install -y gcc gcc-c++
Downloading packages:
(1/9): glibc-devel-2.17-326.el7_9.x86_64.rpm
(2/9): cpp-4.8.5-44.el7.x86_64.rpm
(3/9): libmpc-1.0.1-3.el7.x86_64.rpm
(4/9): libstdc++-devel-4.8.5-44.el7.x86_64.rpm
(5/9): gcc-c++-4.8.5-44.el7.x86_64.rpm
(6/9): mpfr-3.1.1-4.el7.x86_64.rpm
(7/9): kernel-headers-3.10.0-1160.76.1.el7.x86_64.rpm
(8/9): glibc-headers-2.17-326.el7_9.x86_64.rpm
(9/9): gcc-4.8.5-44.el7.x86_64.rpm
备注:如果服务器在内网,则需要预先将这些安装包(包括依赖包)下载下来,再安装。
GCC环境安装好后,逐个解压上面下载的四个版本包,然后分别进入安装包中执行编译
# make
备注:为了测试,make install 可先不执行。
测试结果让我感觉有点意外,在CentOS 7.9系统中,Redis 5.0.14、6.2.7、7.0.5这三个版本可以成功编译、安装和运行,但是6.0.16版本,在CentOS7.9上编译失败,网上查询资料,应该与CentOS7自带的GCC的版本过低有关。
[root@www ~]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright © 2015 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。
[root@www redis-7.0.5]# redis-server
20060:C 27 Sep 2022 08:53:34.390 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
20060:C 27 Sep 2022 08:53:34.390 # Redis version=7.0.5, bits=64, commit=00000000, modified=0, pid=20060, just started
20060:C 27 Sep 2022 08:53:34.390 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
20060:M 27 Sep 2022 08:53:34.390 * Increased maximum number of open files to 10032 (it was originally set to 1024).
20060:M 27 Sep 2022 08:53:34.390 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 7.0.5 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 20060
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
20060:M 27 Sep 2022 08:53:34.391 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
20060:M 27 Sep 2022 08:53:34.391 # Server initialized
20060:M 27 Sep 2022 08:53:34.391 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[root@www redis-6.2.7]# redis-server
14326:C 27 Sep 2022 08:30:53.858 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
14326:C 27 Sep 2022 08:30:53.858 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=14326, just started
14326:C 27 Sep 2022 08:30:53.859 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
14326:M 27 Sep 2022 08:30:53.859 * Increased maximum number of open files to 10032 (it was originally set to 1024).
14326:M 27 Sep 2022 08:30:53.859 * monotonic clock: POSIX clock_gettime
14326:M 27 Sep 2022 08:30:53.860 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 14326
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
14326:M 27 Sep 2022 08:30:53.860 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
14326:M 27 Sep 2022 08:30:53.860 # Server initialized
14326:M 27 Sep 2022 08:30:53.860 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[root@www redis-5.0.14]# redis-server
15521:C 27 Sep 2022 08:43:51.843 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
15521:C 27 Sep 2022 08:43:51.843 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=15521, just started
15521:C 27 Sep 2022 08:43:51.843 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
15521:M 27 Sep 2022 08:43:51.844 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.14 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 15521
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
15521:M 27 Sep 2022 08:43:51.844 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
15521:M 27 Sep 2022 08:43:51.844 # Server initialized
15521:M 27 Sep 2022 08:43:51.844 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
15521:M 27 Sep 2022 08:43:51.844 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
15521:M 27 Sep 2022 08:43:51.844 * Ready to accept connections