Redis multi-open port-based implementation of redis multi-instance tutorials

Image

------ body content display, start to learn new knowledge ------

Sometimes build in the construction of more than one of the same site when found Redis share triggered data conflicts, then we can open through the Redis multi-open to solve this problem!

Implementing multiple instances of redis based on multiple ports:
1, open the panel to install redis, and configure the use of the maximum memory, for example, the test server here is 4G memory, here chose 512M memory for redis use, configured to restart redis (if it is a production environment, at your own discretion, whether you can restart as well as limit the maximum memory).

Image [1]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

2. Make a copy of redis in accordance with the good
The commands are as follows:

\cp -rp /www/server/redis/ /www/server/redis6378
Image [2]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

3. Release port 6378 (can be assigned according to your actual port usage)

Image [3]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

4, open the file manager, into the /www/server/redis6378 directory below
Open redis.conf and change the port in the configuration file to 6378.

Image [4]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

5, modify the redis pid, log, data storage directory

Image [5]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development
Image [6]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

Save after modification

Image [7]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

6, delete the previous redis generated log and pid file (see the path)

Image [8]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

7. Start and verify the startup command:

/www/server/redis6378/src/redis-server
/www/server/redis6378/redis.conf
Image [9]-Redis multi-open port-based implementation of redis multi-instance tutorial - HootSuite Source Code - Software customization and development

The new Redis is now up and running!

Lastly to add to the supplement, if there is cached data within the redis that is copied over, it will still cause the data to be misplaced at the later site.
So you need to newly open redis under the corresponding port to clean the cache.
1. Ensure that the process survives first ps -ef|grep redis

2. Execute . /redis-cli or . /redis-cli -h 127.0.0.1 -p 6388maybe6389(Port number is based on self-set)Go to the newly opened redis instance

3. Execute the dbsize command
127.0.0.1:6388> dbsize

4. cleanup 127.0.0.1:6388> flushall

5. exit 127.0.0.1:6388> exit

6. Repeat 2-5 for multiple instances (note port numbers)

Warm Tip: This article was last updated on2024-08-16 21:39:48Please note that some articles are time-sensitive, so if there are any errors or if they are no longer valid, please check below.leave a messageor contactHootSuite OfficialThe
本站所有系统源码请合法合规使用,严禁从事违法犯罪,侵权等任何非法活动,违法犯罪毁三代,且行且珍惜!
© copyright statement
THE END
Image
kudos14 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

请登录后发表评论

    No comments