In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Main points of content:
1. Brief introduction of Redis Cluster (Redis Cluster):
Second, the environment needed to build the cluster:
3. Deploy clusters:
1. Brief introduction of Redis Cluster (Redis Cluster):
(1) redis is an open source key value storage system, which is favored by the majority of Internet companies. The redis3.0 version only supports singleton mode before, and clusters are supported only in version 3.0 and later. Here I use the latest version, redis-5.0.7.
(2) redis cluster adopts P2P mode, which is completely decentralized, and there are no central nodes or proxy nodes.
(3) there is no unified entry to the redis cluster. When the client (client) connects to the cluster, it can connect to any node (node) in the cluster. The nodes in the cluster communicate with each other (PING-PONG mechanism), and each node is a redis instance.
Second, the environment needed to build the cluster:
(1) Redis cluster needs at least 3 nodes, because the voting fault tolerance mechanism requires more than half of the nodes to think that a node is dead only if it is dead, so two nodes cannot form a cluster.
(2) to ensure the high availability of the cluster, each node needs to have a slave node, that is, a backup node, so the Redis cluster needs at least 6 servers.
(3) install ruby environment. Redis cluster operation should be based on ruby environment.
3. Deploy clusters:
In order to save resources, two virtual machines are prepared here, each with three network cards, so that there are a total of six network cards, that is, six redis instances are running at the same time.
Role IP address redis1192.168.220.131redis2192.168.220.164redis3192.168.220.165redis4192.168.220.135redis5192.168.220.166redis6192.168.220.167
Step 1: install the redis service first
Step 2: modify the configuration file so that all nodes have the same configuration
Vim / etc/redis/6379.conf1, first of all, comment out the bind entry: / / the bind option in redis listens to all network cards by default. 2, Do the following: protected-mode no / / close protected mode port 6379 / / Open listening port daemonize yes / / start cluster-enabled yes as an independent process / / enable cluster function cluster-config-file nodes-6379.conf / / Cluster name file location cluster-node-timeout 15000 / / Cluster timeout setting appendonly yes / / enable aof persistence
(1) restart the service:
/ etc/init.d/redis_6379 restart
(2) after restarting, there will be two more files in the / var/lib/redis/6379 directory:
Appendonly.aof: persisting files
Nodes-6379.conf: the node starts the generated configuration file for the first time
Step 3: this step only needs to be done in the master master server
1. Import key file:
Gpg-keyserver hkp://keys.gnupg.net-recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2. Install rvm:
Curl-sSL https://get.rvm.io | bash-s stable
3. Execution environment variables:
Source / etc/profile.d/rvm.shrvm list known / / lists the installable versions of Ruby
4. Install the Ruby2.4.1 version
Rvm install 2.4.1
5. Use the Ruby2.4.1 version
Rvm use 2.4.1ruby-v / / View the current Ruby2.4.1 version
6. Install Redis again
Gem install redis
7. Restart redis
/ etc/init.d/redis_6379 restart
Step 4: create a cluster
The six instances are divided into three groups, with one master and one slave for each group.-replicas 1 means each group has one slave. When you interact below, you need to enter yes before you can create it.
Create a cluster using the redis-trib.rb tool in the source code extraction directory.
Redis-cli-- cluster create 192.168.220.131 cluster-replicas 6379 192.168.220.164purl 6379 192.168.220.165 cluster-replicas 1
Step 5: verify:
(1) feel free to log in to a redis and create a pair of key values:
Redis-cli-h 192.168.220.164-p 6379 / / Connect 164this host
(2) at this point, we connect and log in to another host to check the key name:
Redis-cli-h 192.168.220.131-p 6379 / / Connect to this host
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.