In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The characteristics of redis cluster:
1. There are many machines, which can ensure that when there is a problem with the redis server, the impact is small.
two。 Self-provided master-slave structure, automatically divide the master-slave structure according to the algorithm. Dynamic implementation
3. Can automatically achieve high availability according to the master-slave structure
4. Realize the backup of data files
Steps for building a 3.Redis cluster:
Prepare 9 servers 3 master 6 have 2 child nodes under one host
7000-7008
two。 Copy the redis.conf file to a folder
Cp redis.conf 7000/redis-7000.conf
Mkdir 7000 7001 7002 7003 7004 7005 7006 7007 7008
3. Modify the profile parameter vim redis-conf
1. Logoff the bound port number
two。 Turn off protection mode
3. Modify port number
4. Running in the background is enabled
5. Specify the path to the pid file
Create a related file directory by indicating the location of the files through the absolute path
6. Modify dump log file path
If you do not modify the dump file, then each log file is public.
7. Enable binary Log
8. Enable clustering
9. Modify the cluster coordination file
Change the port number to 7000 and open the cluster timeout
10. If the master-slave relationship is mounted, it needs to be deleted
Delete the master from the mount and get the comment.
11. Copy the configuration file to 7001-7008, and you need to modify the port number.
Execute the following command to first change all 7000 of the file to 7001
:% sleisure 7000Universe 7001Universe Note: it means to replace all 7000 of the current text with 7001.
twelve。 Modify the configuration files of 7002-7008 respectively
13. Create shell script files to start multiple redis services from 7000-7008
#! / bin/sh
Redis-server 7000/redis-7000.conf &
Redis-server 7001/redis-7001.conf &
Redis-server 7002/redis-7002.conf &
Redis-server 7003/redis-7003.conf &
Redis-server 7004/redis-7004.conf &
Redis-server 7005/redis-7005.conf &
Redis-server 7006/redis-7006.conf &
Redis-server 7007/redis-7007.conf &
Redis-server 7008/redis-7008.conf
#! / bin/sh indicates that there is a shell script for editing
14. Start the shell script
15. Check to see if the redis service starts
The above indicates that the redis file was started successfully
16. Turn off the firewall
Service iptables stop
17. Check whether the cluster startup is successful
3. Start the redis cluster through the ruby file (if there is no network, it may not be possible for Baidu to install ruby)
1. Add plug-ins using yum installation has added unnecessary actions
Yum install ruby
Ruby-v # ruby 1.8.7
Yum install rubygems # can also execute yum install ruby rubygems-y in one sentence
Gem install redis # install the interface pack for redis
Gem list # check to see if gem-related interface packs are installed and whether redis already exists
The ruby plug-in is already installed in the distributed virtual machine, so there is no need to install it again
two。 Command execution configuration 1 master 2 slave structure
. / src/redis-trib.rb create-- replicas 2 192.168.247.150 7000 192.168.247.150 7002 192.168.247.150V 7002 192.168.247.150V 7003 192.168.247.150V 7004 192.168.247.150V 7004 192.168.247.150V 7006 192.168.247.150R 7007 192.168.247.150R 7007 192.168.247.150Ru 7008
2 of them indicates that several slave nodes are mounted under one host. This cluster is configured with one master, 2 slaves, 3 hosts, 6 slaves, a total of 9 redis servers.
Indicates that the mount is successful
M for master node S for slave node information
Indicates whether to mount: enter yes or an error will be reported.
Startup of 4.Redis Cluster
1. Do not turn off the service. Save in suspended form
two。 If you start after shutting down, first pay attention to turn off the firewall first.
3. If the cluster starts correctly. But the java program reported an error jedisCluster reported an error.
1. Check whether the jar package file is correct
two。 Check the ip address of the redis cluster. 192.168.154.196
The above Redis cluster building picture and text tutorial is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.
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.