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/03 Report--
Preface
Redis cluster is a distributed (distributed), fault-tolerant (fault-tolerant) Redis implementation, and the functions that can be used by clusters are a subset of the functions that can be used by ordinary stand-alone Redis (subset).
There are no central nodes or proxy nodes in the Redis cluster, and one of the main design goals of the cluster is to achieve linear scalability (linear scalability).
Redis clusters provide a way to run Redis, where data is automatically partitioned among multiple Redis nodes. The Redis cluster also provides a degree of availability during partitioning, that is, it can actually continue to run when some nodes fail or are unable to communicate. However, in the event of a major failure (for example, when most primary stations are unavailable), the cluster stops running.
Two Centos 7 virtual machines in the experimental environment All add three network cards to simulate six servers real-world server role IP address centos7- 1 master node M1192.168.142.130centos7-2 master node M2192.168.142.145centos7-3 master node M3192.168.142.146centos7-4 slave node S1192.168.142.143centos7-5 slave node S2192.168.142.147centos7-min slave node S3192.168.142.148 Experimental step 1: install Redis# install compilation environment [root@ Localhost ~] # yum install gcc gcc-c++ make-y # remote mount source code package [root@localhost ~] # mount.cifs / / 192.168.142.1/redis / mntPassword for root@//192.168.142.1/redis: # decompress source code package [root@localhost ~] # cd / mnt [root@localhost mnt] # tar zxvf redis-5.0.7.tar.gz-C / opt# compile and install [root@localhost mnt] # cd / opt/redis-5 .0.7 / [root@localhost redis-5.0.7] # make [root@localhost redis-5.0.7] # make PREFIX=/usr/local/redis/ install# create service command soft link to the system [root@localhost redis-5.0.7] # ln-s / usr/redis/bin/* / usr/local/bin/# cut into the utils directory [root@localhost redis-5.0.7] # cd / opt/redis-5.0.7/utils/ # execute startup script [root@localhost utils] #. / install_server.sh# the following Enter by default Welcome to the redis service installerThis script will help you easily set up a running redis serverPlease select the redis port for this instance: [6379] Selecting default: 6379Please select the redis config file name [/ etc/redis/6379.conf] Selected default-/ etc/redis/6379.confPlease select the redis log file name [/ var/log/redis_6379.log] Selected default-/ var/log/redis_6379.logPlease select the data directory for this instance [/ var/lib/redis/6379] Selected default- / var/lib/redis/6379Please select the redis executable path [] / usr/local/redis/bin/redis-server# here you need to manually specify the extension directory path / usr/local/redis/bin/redis-server# use process control to start the service [root@localhost utils] # / etc/init.d/redis_6379 startStarting Redis server...# configure the 6379.conf file of redis Append listening address [root@localhost utils] # vim / etc/redis/6379.conf # comment line 70 listening address 127, all addresses # bind 127.0.0.1 # remove line 89 comment off security protection protected-mode no# remove line 93 comment, open port 6379port 637comment remove line 137 comment, start daemonize yes# with independent process to remove line 833 comment, turn on cluster function cluster-enabled yes# to remove line 841 comment Cluster name file settings cluster-config-file nodes-6379.conf# to remove line 847 comments, cluster timeout settings cluster-node-timeout 1500 to remove line 700 comments, start aof persistence appendonly yes# restart service [root@localhost utils] # / etc/init.d/redis_6379 restartStopping... Redis stoppedStarting Redis server... Step 2: install rvm components on the master server # Import key file [root@localhost utils] # gpg-- keyserver hkp://keys.gnupg.net-- recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3# install RVM [root @ localhost utils] # curl-sSL https://get.rvm.io | bash-s stable# implements the environment variable [root@localhost utils] # source / etc/profile.d/rvm.sh# lists the versions that ruby can install [root@localhost utils] # rvm list known# Install version 2.4.1 [root@localhost utils] # rvm install 2.4.Use the rubyruby2.4.1 version [root@localhost utils] # rvm use 2.4.1Using / usr/local/rvm/gems/ruby-2.4.1# to view the current ruby2.4.1 version [root@localhost utils] # ruby- vruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] # install Redi [root @ localhost utils] # again Step 3 of gem install redis: create a Redis cluster # join all node addresses And add the 6379 port number [root@localhost utils] # redis-cli-- cluster create 192.168.142.130 cluster create 6379 192.168.142.145cluster create 6379 192.168.142.146cluster create 6379 192.168.142.143cluster create 6379 192.168.142.147192.168.142.147cluster create 6379 192.168.142.148cluster create 6379-- cluster-replicas 1 > > Performing hash slots allocation on 6 nodes...Master [0]-> Slots 0-5460Master [1]-> Slots 5461-10922Master [2]-> Slots 10923 -16383Adding replica 192.168.142.147to 192.168.142.145:6379Adding replica 6379 to 192.168.142.130:6379Adding replica 192.168.142.143V 6379 to 192.168.142.146 to 6379M: a27b43ec695099b36a5c79beae70cb0364f27338 192.168.142.130V 6379 slots: [0-5460] (5461 slots) masterM: a27b43ec695099b36a5c79beae70cb0364f27338 192.168.142.145RV 6379 slots: [5461-10922] (5462 slots) masterM: a27b43ec695099b36a5c79beae70cb0364f27338 192.168.142. 146masterS 6379 slots: [10923-16383] (5461 slots) masterS: b6d317c5f192bf84e8f464ffbf6481529cd0708a 192.168.142.143 masterS 6379 replicates a27b43ec695099b36a5c79beae70cb0364f27338S: b6d317c5f192bf84e8f464ffbf6481529cd0708a 192.168.142.147PLV 6379 replicates a27b43ec695099b36a5c79beae70cb0364f27338S: b6d317c5f192bf84e8f464ffbf6481529cd0708a 192.168.142.148Fluor6379 replicates a27b43ec695099b36a5c79beae70cb0364f27338Can I set the above configuration? (type 'yes' to accept): yes > > Nodes configuration updated > > Assign a different config epoch to each node > > Sending CLUSTER MEET messages to join the clusterWaiting for the cluster to join > > Performing Cluster Check (using node 192.168.142.130 master 6379) M: a27b43ec695099b36a5c79beae70cb0364f27338 192.168.142.130 master 6379 slots: [0-16383] (16384 slots) master 1 additional replica (s) S: b6d317c5f192bf84e8f464ffbf6481529cd0708a 192.168.142.148 master 6379 slots: (0 slots) slave replicates a27b43ec695099b36a5c79beae70cb0364f27338 [OK] All nodes agree about slots configuration. > Check for Check slots coverage... [OK] All 16384 slots covered. Step 4: verify cluster read and write # redis-cli-h 192.168.142.130-p 6379192.168.142.130 yangjia 6379 > set name yangjiaOK192.168.142.130:6379 > get name "yangjia" # View data information from another node [root@localhost ~] # redis-cli-h 192.379192.168.142.146 set name yangjiaOK192.168.142.130:6379 * 1) "name" 192 .168.142.146: 6379 > get name "yangjia" # cannot view data on slave nodes Prompt to switch the primary node server address [root@localhost ~] # redis-cli-h 192.168.142.143-p 6379192.168.142.143get name 6379 > keys * 1) "name" 192.168.142.143keys 6379 > get name (error) server 5798 192.168.142.1466379
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.