Upgrade the gcc version to 9.1, and execute the compilation
# gcc -v # View gcc version
# yum -y install centos-release-scl # Upgrade to version 9.1
# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
# scl enable devtoolset- 9 bash
Enter the directory: /mnt/redis-6.0.10/src/ installation
[root@node1 src]# make install
Copy redis-server and redis-cli in the src directory to the upper directory
tip: This step can be omitted, just to facilitate the operation of these commands and files
Configure redis
//Edit the configuration file redis.conf /mnt/redis-6.0.10/
-
cd redis
-
vim redis.conf
To find the string /string under vim
//Set redis to support background startup and change no to yes
daemonize yes
//Enable authentication login, authentication is not required by default, let go of comments, set password 123456
requirepass 123456
//Support other server access and comment bind 127.0.0.1
# bind 127.0.0.1
Three: start redis
./redis-server redis.conf
//Connect to the client
-
#-h:指定ip -p:指定端口 -a:若开启验证,需指定验证密码登录
-
[root@node1 redis-6.0.10]# ./redis-cli -h 127.0.0.1 -p 6379 -a 123456
-
Edit the rc.local file
1: Edit the rc.local file under /etc, and write the redis startup command to the file
vim /etc/rc.local
2: Edit the content of the script
/mnt/redis-6.0.10//redis-server /mnt/redis-6.0.10/redis.conf
tip: If the boot script does not work, it may be due to the execution permission of rc.local.
chmod 755 /etc/rc.local