Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The latest version of redis5.0.5 cluster building (4 master and 5 slave Centos7)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Redis cluster is a distributed redis storage architecture without center, which can share data among multiple nodes, which solves the problems of high availability and scalability of redis. Redis cluster provides the following two benefits: 1) automatically split data to multiple nodes. 2) when a node in the cluster fails, redis can continue to process client requests.

Redis Cluster has the following characteristics:

Node automatic discovery

Slave- > master election, cluster fault tolerance

Hot resharding: online sharding

Cluster Management: clusterxxx

Cluster Management based on nodes-port.conf

ASK steering / MOVED steering mechanism

Deployment does not need to specify master

Can support clusters with more than 1000 nodes

Server IP hostname | remarks for installation components

192.168.27.211 Client1 redis-5.0.5 cluster each node, a single node opens three service processes to simulate three servers.

192.168.27.212 Client2 redis-5.0.5

192.168.27.213 Client3 redis-5.0.5

192.168.27.210 master ansible Fortress Machine

The latest official download address: http://download.redis.io/releases/redis-5.0.5.tar.gz

Extract and compile the installation:

192.168.27.211 profile configuration: (pay attention to permissions sudo chown jerry.root-R redis-5.0.5 all nodes after switching users)

Mkdir / data/redis-5.0.5/redis-cluster/ {7000rec 7001pr 7002}-pv

[jerry@client1 redis-cluster] $cat 7000/redis.conf

Port 7000

Bind 192.168.27.211

Daemonize yes

Pidfile / var/run/redis_7000.pid

Cluster-enabled yes

Cluster-config-file nodes_7000.conf

Cluster-node-timeout 10100

Appendonly yes

[jerry@client1 redis-cluster] $cat 7001/redis.conf

Port 7001

Bind 192.168.27.211

Daemonize yes

Pidfile / var/run/redis_7001.pid

Cluster-enabled yes

Cluster-config-file nodes_7001.conf

Cluster-node-timeout 10100

Appendonly yes

[jerry@client1 redis-cluster] $cat 7002/redis.conf

Port 7002

Bind 192.168.27.211

Daemonize yes

Pidfile / var/run/redis_7002.pid

Cluster-enabled yes

Cluster-config-file nodes_7002.conf

Cluster-node-timeout 10100

Appendonly yes

Server: 192.168.27.212:

[jerry@client2 redis-5.0.5] $mkdir / data/redis-5.0.5/redis-cluster/ {7003meme 7004pm 7005}-pv

[jerry@client2 redis-cluster] $for i in {3meme4je 5}; do cat. / 700$ i/redis.conf; done

Port 7003

Bind 192.168.27.212

Daemonize yes

Pidfile / var/run/redis_7003.pid

Cluster-enabled yes

Cluster-config-file nodes_7003.conf

Cluster-node-timeout 10100

Appendonly yes

Port 7004

Bind 192.168.27.212

Daemonize yes

Pidfile / var/run/redis_7004.pid

Cluster-enabled yes

Cluster-config-file nodes_7004.conf

Cluster-node-timeout 10100

Appendonly yes

Port 7005

Bind 192.168.27.212

Daemonize yes

Pidfile / var/run/redis_7005.pid

Cluster-enabled yes

Cluster-config-file nodes_7005.conf

Cluster-node-timeout 10100

Appendonly yes

192.168.27.213 configuration file:

[jerry@client3 redis-5.0.5] $mkdir / data/redis-5.0.5/redis-cluster/ {7006 data/redis-5.0.5/redis-cluster/ 7007 7008}-pv

Port 7006

Bind 192.168.27.213

Daemonize yes

Pidfile / var/run/redis_7006.pid

Cluster-enabled yes

Cluster-config-file nodes_7006.conf

Cluster-node-timeout 10100

Appendonly yes

Port 7007

Bind 192.168.27.213

Daemonize yes

Pidfile / var/run/redis_7007.pid

Cluster-enabled yes

Cluster-config-file nodes_7007.conf

Cluster-node-timeout 10100

Appendonly yes

Port 7008

Bind 192.168.27.213

Daemonize yes

Pidfile / var/run/redis_7008.pid

Cluster-enabled yes

Cluster-config-file nodes_7008.conf

Cluster-node-timeout 10100

Appendonly yes

Start redis on each node

[jerry@client1 redis-cluster] $for i in {0.. 2}; do / data/redis-5.0.5/src/redis-server / data/redis-5.0.5/redis-cluster/700$ iUniver redis.confession; done

[jerry@client2 redis-cluster] $for i in {3... 5}; do / data/redis-5.0.5/src/redis-server / data/redis-5.0.5/redis-cluster/700$ iUniver redis.confession; done

[jerry@client3 redis-cluster] $for i in {6... 8}; do / data/redis-5.0.5/src/redis-server / data/redis-5.0.5/redis-cluster/700$ iUniver redis.confession; done

Use the fortress machine to check the start-up of each node:

[root@master ~] # ansible k8s-m shell-a'ps-ef | grep redis'

[jerry@client1 src] $. / redis-trib.rb create-- replicas 1 192.168.27.211 replicas 7001 192.168.27.211 Vera 7002 192.168.27.212 12VV 7003 192.168.27.212VRV 7004 192.168.27.212VV 7004 192.168.27.213Rd 7006 192.168.27.213Rd 7007 192.168.27.213RV 7008

Error report:

Install ruby components: https://centos.pkgs.org/7/centos-sclo-rh-x86_64/rh-ruby22-ruby-devel-2.2.2-16.el7.x86_64.rpm.html (just install a node in the cluster)

Yum install centos-release-scl-rh

Yum install rh-ruby22-ruby-devel

[jerry@client1 src] $sudo yum-y install ruby ruby-devel rubygems rpm-build

[jerry@client1 src] $sudo. / redis-trib.rb create-- replicas 1 192.168.27.211 replicas 7001 192.168.27.211 Vera 7002 192.168.27.211 12VV 7003 192.168.27.212VV 7004 192.168.27.212VV 7004 192.168.27.212RV 7006 192.168.27.213RV 7006 192.168.27.213RV 7007 192.168.27.213pur7008

Prompt 5.0.5 command has been replaced.

Incorrect format:

[jerry@client1 src] $sudo. / redis-cli create-- replicas 1 192.168.27.211 replicas 7001 192.168.27.211 Vera 7002 192.168.27.211 12VV 7003 192.168.27.212VV 7004 192.168.27.212VV 7004 192.168.27.212RV 7006 192.168.27.213RV 7006 192.168.27.213RV 7007 192.168.27.213pur7008

Could not connect to Redis at 127.0.0.1:6379: Connection refused

The new version is in the correct format:

[jerry@client1 src] $sudo. / redis-cli-- cluster create 192.168.27.211 cluster create 7001 192.168.27.211 Vera 7002 192.168.27.212 12VV 7003 192.168.27.212VV 7004 192.168.27.212V 7004 192.168.27.213Rd 7006 192.168.27.213Rd 7007 192.168.27.213pur7007 192.168.27.213pur7008-- cluster-replicas 1

Visit:

Test observation cluster:

The connection is set to a key value of name and the value is set to jerry

Try to get the key value on 212

Change the name value on the 213 server

Attack its value again on 211:

Get its value again on 212:

View the cluster information:

192.168.27.211V7 000 > cluster info

Note that the new version of the command has changed:

Reference: https://redis.io/topics/cluster-tutorial

Https://blog.serverdensity.com/monitor-redis/

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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report