Home  >  Article  >  How to modify the redis default port

How to modify the redis default port

清浅
清浅Original
2019-04-02 15:27:3512603browse

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

How to modify the redis default port

【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.

How to modify the redis default port

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.

How to modify the redis default port

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

How to modify the redis default port

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn