根据官网的方法安装:
Installation
Download, extract and compile Redis with:
$ cd /usr/local
$ wget http://download.redis.io/releases/redis-6.0.5.tar.gz
$ tar xzf redis-6.0.5.tar.gz
$ cd redis-6.0.5
$ make
The binaries that are now compiled are available in the src
directory. Run Redis with:
$ src/redis-server
You can interact with Redis using the built-in client:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
可能会碰到“没有什么成员的错误”,解决办法如下:
[root@localhost redis-6.0.1]# gcc -v # 查看gcc版本 [root@localhost redis-6.0.1]# yum -y install centos-release-scl # 升级到9.1版本 [root@localhost redis-6.0.1]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils [root@localhost redis-6.0.1]# scl enable devtoolset-9 bash 以上为临时启用,如果要长期使用gcc 9.1的话: [root@localhost redis-6.0.1]# echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
重新make
make
执行make test 报错: pending querybuf: check size of pending_querybuf after set a big value intests/unit/pendingquerybuf.tcl the used_memory of replica is much larger than master. Master:43869232Replica:69031856
解决如下:直接调整虚拟机的内存