The method to modify the default port of redis is: first download the file, decompress, compile and install it. After installation, start it globally and set the password, then modify the port number, and finally specify the running configuration
【Recommended course:redis tutorial】
(1) Download through the link below, and then use the following commands to decompress, compile, and install
Download address: http://download.redis.io/redis-stable.tar.gz
tar xzf redis-4.0.9.tar.gz cd redis-4.0.9 make make install
(2) Start globally and set the password, modify the port
First enter the redis installation directory, find utils, there will be an initialization script redis_init_script below, copy it to /etc/init.d in the directory.
Secondly, name the redis_init_script file redis_port number (this port is redis_6879), where the port number represents the port number that you want Redis to listen to, and the client passes this port Connect to Redis. Then modify the value of the REDISPORT variable in the script to the same port number.
Next, copy the configuration file template redis-4.0.7/redis.conf to the /etc/redis directory and name it with the port number (such as 6879.conf), Then edit some of the parameters and modify the port number and password.
Finally specify the running configuration, redis-server /etc/redis/6879.conf
Summary: The above are all the steps to modify the default port of redis. I hope it will be helpful to everyone
The above is the detailed content of How to modify the redis default port. For more information, please follow other related articles on the PHP Chinese website!