Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure two Redis to work independently without conflict

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

What this article shares to you is about the method of configuring two Redis to work independently without conflict. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Start two Redis on the same server. The default port of Redis is 6379, and you need to start another Redis with port 6389. The two Redis work independently without conflict.

The redis-server.exe in the root directory loads the default configuration with port 6379. The second Redis only needs to create a new configuration file so that the new configuration file is loaded when exe is turned on.

The principle and steps of redis multi-opening:

Principle:

The principle of ① is the same as adding containers such as nginx and tomcat. For multiple applications with a single instance, copy the new configuration file, change the configuration name, and modify the port number, PID file path, log file path and dump file path in the configuration file to ensure that two or more redis services will not conflict.

②: the default Redis program is installed in / usr/local/redis directory

Configuration file: / usr/local/redis/redis.conf, the port configured in this profile is the default port: 6379

The startup command path for Redis: / usr/local/bin/redis-server.

You can specify a port to start multiple Redis processes.

Specific steps:

Cd / usr/local/redie # switch to redis installation path cp redis.conf redis6380.conf # copy to the new configuration file for the second redis to use vim redis6380.conf # to configure the new redis file to avoid conflicts between the two redis, find the following items in the configuration file and modify them Pidfile / var/run/redis/redis_6380.pid # specify new PID file path port 6380 # specify new port number logfile / var/log/redis/redis_6380.log # specify new log file path dbfilename dump_6380.rdb # specify new dump file path # configuration file modification completed save exit

Start the multi-instance command and view the startup result:

Redis-server / usr/local/redis/redis6380.conf # start a new instance command netstat-lnpt # check whether the server is started through the port The results are as follows: tcp 0 0127.0.0.1 Redis 6379 0.0.0.0 LISTEN 4084/redis-server * LISTEN 1288/redis-server 1tcp 0 0127.0.0.1 LISTEN 4084/redis-server 0.80 0.0.0.0 LISTEN 4084/redis-server 1 is the method to configure two Redis to work independently without conflict. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report