In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to deploy Redis3.0 clusters in centos systems. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
(at least 3 master nodes are needed for the cluster to work properly. Here we need to create 6 redis nodes, of which three are master nodes and three are slave nodes. The ip and port correspondence of the corresponding redis nodes are as follows)
192.168.1.160:7000
192.168.1.160:7001
192.168.1.160:7002
192.168.1.160:7003
192.168.1.160:7004
192.168.1.160:7005
1: download redis. Download version 3.0.0 on the official website, 2. 0 before. Which version does not support cluster mode
Download address: http://download.redis.io/releases/redis-3.0.0.tar.gz
2: upload server, decompress, compile
Tar-zxvf redis-3.0.0.tar.gz
Mv redis-3.0.0.tar.gz redis3.0
Cd / usr/local/redis3.0
Make
Make install
3: the directory required to create the cluster
Mkdir-p / usr/local/cluster
Cd / usr/local/cluster
Mkdir 7000
Mkdir 7001
Mkdir 7002
Mkdir 7003
Mkdir 7004
Mkdir 7005
4: modify the configuration file redis.conf
Cp / usr/local/redis3.0/redis.conf / usr.local/cluster
Vi redis.conf
# # modify the following options in the configuration file
Port 7000
Daemonize yes
Cluster-enabled yes
Cluster-config-file nodes.conf
Cluster-node-timeout 5000
Appendonly yes
# # after modifying these configuration items in the redis.conf configuration file, copy the configuration file to the 7000Universe 7001and7002and7003and7004and7005 directory respectively
Cp / usr/local/cluster/redis.conf / usr/local/cluster/7000
Cp / usr/local/cluster/redis.conf / usr/local/cluster/7001
Cp / usr/local/cluster/redis.conf / usr/local/cluster/7002
Cp / usr/local/cluster/redis.conf / usr/local/cluster/7003
Cp / usr/local/cluster/redis.conf / usr/local/cluster/7004
Cp / usr/local/cluster/redis.conf / usr/local/cluster/7005
# # Note: after the copy is completed, modify the port parameter in the redis.conf file under the 7001Universe 7002Universe 7003Universe 7004ax 7005 directory, and change it to the name of the corresponding folder.
5: start these 6 redis instances respectively
Cd / usr/local/cluster/7000
Redis-server redis.conf
Cd / usr/local/cluster/7001
Redis-server redis.conf
Cd / usr/local/cluster/7002
Redis-server redis.conf
Cd / usr/local/cluster/7003
Redis-server redis.conf
Cd / usr/local/cluster/7004
Redis-server redis.conf
Cd / usr/local/cluster/7005
Redis-server redis.conf
# # use the command to check the startup status of redis after startup ps-ef | grep redis
The following figure shows that the startup is successful.
6: execute the create cluster command of redis to create a cluster
Cd / usr/local/redis3.0/src
. / redis-trib.rb create-- replicas 1 192.168.1.1607000 192.168.1.160V 7001 192.168.1.160Rd 7002 192.168.1.160Rd 7003 192.168.1.160Rd 7004 192.168.1.1607005
6.1 an error may be reported when executing the above command, because it is an executed ruby script, which requires the environment of ruby
Error content: / usr/bin/env:ruby: No such file or directory
Therefore, you need to install ruby in the environment. Yum install ruby installation is recommended here.
Yum install ruby
6.2 then execute the create cluster command in step 6, which may also report an error indicating that the rubygems component is missing and install using yum
Error content:
. / redis-trib.rb:24:in `require': no suchfile to load-- rubygems (LoadError)
From./redis-trib.rb:24
Yum install rubygems
6.3 if you execute the command in step 6 again, there may be an error indicating that redis cannot be loaded because of the lack of interfaces for redis and ruby. Install using gem
Error content:
/ usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31: in `gem _ original_require': no such file to load-- redis (LoadError)
From/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
From./redis-trib.rb:25
Gem install redis
6.4 execute the command in step 6 again and execute normally
Enter yes and then the configuration is complete.
At this point, the redis cluster is built successfully!
7: use the redis-cli command to enter the cluster environment
Redis-cli-c-p 7000
Thank you for reading! This is the end of the article on "how to deploy Redis3.0 clusters in the centos system". 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 for more people to see!
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.