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 process of building the official cluster of Redis 5.02

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the process of building the official cluster of Redis 5.02". In the daily operation, I believe many people have doubts about the process of building the official cluster of Redis 5.02. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "the process of building the official cluster of Redis 5.02". Next, please follow the editor to study!

1. Download and install Redis

# wget http://download.redis.io/releases/redis-stable.tar.gz# tar xfz redis-stable.tar.gz# cd redis-stable# make# sets the command execution path # cat ~ / .bash_profilePATH=$PATH:$HOME/bin:/data/redis-stable/src

2. Create the data directory and configuration file of the cluster

On two servers, create six redis instances (three masters and three slaves), each server, and distribute to create three data directories and three configuration files.

Cluster master node

10.152.5.12:7000

10.152.5.12:7001

10.153.115.24:7003

Cluster slave node

10.152.5.12:7002

10.153.115.24:7004

10.153.115.24:7005

# 10.152.5.1 "create data directory # mkdir redis_cluster# cd redis_cluster# mkdir 7000 7001 700" create configuration file # cd 700 grep-v "^ #" redis_7000.confprotected-mode noport 7000daemonize yessupervised nopidfile / var/run/redis_7000.pidloglevel noticelogfile "/ data/redis_cluster/redis_7000.log" dir. / appendonly yescluster-enabled yescluster-config-file nodes_7000.confcluster-node-timeout 500 launch service redis-server / data/ Redis_cluster/7000/redis_7000.conf & # 10.152.5.1 "mkdir redis_cluster# cd redis_cluster# mkdir 7003 7004 7005"

3. Initialize the cluster

# redis-cli-- cluster create 10.152.5.12 cluster-replicas 7000 10.152.5.12 cluster-replicas 7001 10.153.115.24 cluster-replicas 7003 10.152.5.12 7002 10.153.115.24 cluster-replicas 7004 10.153.115.24 cluster-replicas 1 > > Performing hash slots allocation on 6 nodes...Master [0]-> Slots 0-5460Master [1]-> Slots 5461-10922Master [2]-> Slots 10923-16383Adding replica 10.153.115.24vil 7004 To 10.152.5.12:7000Adding replica 10.152.5.12 to 10.152.5.12:7000Adding replica 7002 to 10.153.115.24:7003Adding replica 10.153.115.24 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 10.152.5.12 7001M: 65dba2ed08ecb139589710f9efdfd7eeacbb3775 10.152.5.12 7000 slots: [0-5460] (5461 slots) masterM: 08e714061bdb817c23c72f1e5c9a72ab878a0c8f 10.152.5.12 slots 7001 slots: [10923-16383] (5461 slots) masterM: 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 10.153.115.24 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 7003 slots: (5462 slots) masterS: 030fc4d0e02bb7f8245b0bbecf428066daf23a7a 10.152.5.12 030fc4d0e02bb7f8245b0bbecf428066daf23a7a 7002 replicates 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4S: c33f01a81258077f3d6cd5f97c91a85225279bff 10.153.115.24 030fc4d0e02bb7f8245b0bbecf428066daf23a7a 7004 replicates 65dba2ed08ecb139589710f9efdfd7eeacbb3775S: 18092c18796972c26785a9cfa408cb3a52107818 10.153.115.24 slots 7005 replicates 08e714061bdb817c23c72f1e5c9a72ab878a0c8fCan 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 10.152.5.12 Vol 7000) M: 65dba2ed08ecb139589710f9efdfd7eeacbb3775 10.152.5.12 master 7000 slots: [0-5460] (5461 slots) master 1 additional replica (s) S: c33f01a81258077f3d6cd5f97c91a85225279bff 10.153.115.24 master 7004 slots: (0 slots) slave replicates 65dba2ed08ecb139589710f9efdfd7eeacbb3775S: 18092c18796972c26785a9cfa408cb3a52107818 10.153.115.24: 7005 slots: (0 slots) slave replicates 08e714061bdb817c23c72f1e5c9a72ab878a0c8fM: 08e714061bdb817c23c72f1e5c9a72ab878a0c8f 10.152.5.12 slots 7001 slots: [10923-16383] (5461 slots) master 1 additional replica (s) S: 030fc4d0e02bb7f8245b0bbecf428066daf23a7a 10.152.5.12 slave replicates 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4M 7002 slots: (0 slots) slave replicates 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4M: 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 10.153.115.24 slave replicates 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4M: [5461-10922] (5462 slots) master 1 additional replica (s) [OK] All nodes agree about slots configuration. > > Check for open slots... > Check for open slots... > Check slots coverage... [OK] All 16384 slots covered.

View processes and logs

# ps-ef | grep redisroot 32071 23964 18 11:01 pts/0 00:09:31 redis-server *: 7003 [cluster] root 32120 23964 1 11:02 pts/0 00:00:42 redis-server *: 7004 [cluster] root 32165 23964 1 11:03 pts/0 00:00:41 redis-server *: 7005 [cluster] root 34550 32071 0 11:39 pts/0 00:00:00 redis-aof-rewrite *: 7003 [cluster] # tail redis_7003. Log30922:M 07 Dec 2018 10 Ready to accept connections32071:C 07 Dec 2018 11 Ready to accept connections32071:C 01 log30922:M 32.731 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo32071:C 07 Dec 2018 11V 01R 32.731 # Redis version=5.0.2 Bits=64, commit=00000000, modified=0, pid=32071, just started32071:C 07 Dec 2018 11 purl 32.731 # Configuration loaded32071:M 07 Dec 2018 111purl 32.733 * Node configuration loaded Ichimm 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 _. _ _.-``_ _'-. _ _.-```. `_. '' -. _ Redis 5.0.2 (00000000Universe 0) 64 bit.-``.- ```. ```\ / _., _'-. _ (.-`|` ) Running in cluster mode | `-. _`...-.`` -. _ |'`_. -'| Port: 7003 |` -. _ `. _ / _. -'| PID: 32071` -. _ `-. _`. / _. -'_. -'| `-. `-. _` -'_. | | `-. _` -. _ _. -'_. -'| http://redis.io `-. _` -. _ _. -'. | | `-. _` -. _ `. -'_. -'| |` -. _ `-. -'_. -'. _. -'`-. _`. -'. 32071 cannot be enforced because M 07 Dec 2018 1111 The TCP backlog setting of 01V 32.734 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128.32071 V M 07 Dec 2018 11V 01V 32.734 # Server initialized32071:M 07 Dec 2018 11V 01V 32.734 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > / sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your / etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.32071:M 07 Dec 2018 11 Ready to accept connections32071:M 01Redis must be restarted after THP is disabled.32071:M 32.734 * Ready to accept connections32071:M 07 2018 11V 06VO 15.060 # configEpoch set to 3 via CLUSTER SET-CONFIG-EPOCH32071:M 07 Dec 2018 11V 06VO 15.116 # IP address for this node updated to 10.153.115.2432071 V M 07 Dec 2018 11V 06V 18.146 * Replica 10.152.5.12 V 7002 asks for synchronization32071:M 07 Dec 2018 11L 06V 18.146 * Partial resynchronization not Accepted: Replication ID mismatch (Replica asked for 'b8db3eb5c491ab9e2ff92de627925a93105ddd96' My replication IDs are '054964ff1a25320ff6d97c24594f2683e30d43c0' and' 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 : 06ok32071:M 18.196 * Synchronization with replica 10.152.5.12 Synchronization with replica 7002 succeeded32071:M 07 Dec 2018 11 Dec 06Dec 20.001 # Cluster state changed: ok32071:M 07 Dec 2018 11 virtual 31rides 25.118 * 1 changes in 900seconds. Saving...32071:M 07 Dec 2018 11 Freud 25.118 * Background saving started by pid 3374033740 Background saving started by pid 3374033740 Verus C 07 Dec 2018 11VlV 31VO 25.119 * DB saved on disk33740:C 07 Dec 2018 11VO 31Rd 25.120 * RDB: 0 MB of memory used by copy-on-write32071:M 07 Dec 2018 11VlV 31Rd 25.218 * Background saving terminated with success32071:M 07 Dec 2018 111Vera 37.418 * Starting automatic rewriting of AOF on 6722641000% growth32071:M 07 Dec 07 2018 11Rd 37.418 * Background append only file rewriting started by pid 3375132071 AOF rewrite child asks to stop sending diffs.33751:C M 07 Dec 2018 11 Parent agreed to stop sending diffs 31 Dec 2018 11 Parent agreed to stop sending diffs. Finalizing AOF...33751:C 07 Dec 2018 11 MB of AOF diff received from parent 31 Concatenating 38.420. At this point, the study on "the process of building the official cluster of Redis 5.02" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Database

Wechat

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

12
Report