In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to build a cluster in redis. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
The Construction of redis Cluster
Cluster building: Redis cluster requires at least 3 nodes
Step 1: create a folder redis-cluster, and then create 6 folders below:
(1) mkdir-p / usr/local/redis-cluster
(2) mkdir 7001, mkdir 7002, mkdir 7003, mkdir 7004, mkdir 7005, mkdir 7006
Step 2: copy the previous redis.conf configuration files to the 700* directory, and modify the contents of each file, as follows:
(1) daemonize yes
(2) port 700 *
(3) bind 192.168.2.2 binds the ip of the current machine
(4) dir / usr/local/redis-cluster/700*/ specifies the location of the data file
(5) cluster-enabled yes (start cluster mode)
(6) cluster-config-file nodes700*.conf
(7) cluster-node-timeout 5000
(8) appendonly yes
Step 3: because the redis cluster needs to use the ruby command. So we need to install ruby with the following command:
(1) yum install ruby
(2) yum install rubygems
(3) gem install redis (the interface for installing redis and ruby)
This error may occur here: ERROR: Error installing redis: redis requires Ruby version > = 2.2.2
Here, you can refer to http://blog.csdn.net/fengye_yulu/article/details/77628094 to solve this problem.
Step 4: start 6 redis instances each, and then check whether the startup is successful
(1) / usr/local/redis/bin/redis-server / usr/local/redis-cluster/700*/redis.conf
(2) ps-el | grep redis
Start all six to complete.
Step 5: first go to the redis3.0 installation directory, and then execute the redis-trib.rb command.
(1) cd / usr/local/redis-3.0.0-rc2/src
(2). / redis-trib.rb create-- replicas 1 139.196.123.218 redis-trib.rb create 7001 139.196.123.218Vera 7002 139.196.123.218Rd 7003 139.196.123.218Rd 7004 139.196.123.218005 139.196.123.218Rd 7006 (1 means the ratio of master to slave nodes, 1 means master: slave; 1:1)
Step 6: successfully build the cluster and verify it:
(1) Connect to any client:. / redis-cli-c-h-p (- c represents cluster mode, specify ip address and port,)
For example, usr/local/redis/bin/redis-cli-c-h 192.168.1.1-p 7001
(2) verify: cluster info (view cluster messages), cluster nodes (view node list)
(3) data operation verification
(4) to shut down the cluster, you need to close it one by one. Use the command:
Usr/local/redis/bin/redis-cli-c-h 192.168.1.1-p 700* shutdown
Thank you for reading! So much for sharing the method of building a cluster in redis. I hope the above content can be of some help to you so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.