当前位置:网站首页>Local redis cluster setup
Local redis cluster setup
2022-06-09 05:26:00 【Anonymous s】
1. install redis service
1) Basic environment installation
yum install -y cpp binutils glibc glibc-kernheaders glibc-common glibc-devel gcc make tcl
yum -y install centos-release-scl centos-release-scl-rh
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils(centos7 default gcc Version less than 5.3 Can't compile )
sudo echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
soruce /etc/profile2) download redis
wget http://download.redis.io/releases/redis-6.0.5.tar.gz3) Unpack the installation
tar -zxvf redis-6.0.5.tar.gz
cd redis-6.0.5
make
make test
make install
The compiled file is copied to /usr/local/bin Under the table of contents
4) reproduce 6 Nodes
The default here is /usr/local/redis Create 6 A folder , The naming rule is node00(1-6)
[[email protected] redis]# ll
Total usage 0
drwxr-xr-x. 2 root root 82 1 month 27 17:09 node001
drwxr-xr-x. 2 root root 82 1 month 27 17:06 node002
drwxr-xr-x. 2 root root 82 1 month 27 17:06 node003
drwxr-xr-x. 2 root root 82 1 month 27 17:06 node004
drwxr-xr-x. 2 root root 82 1 month 27 17:06 node005
drwxr-xr-x. 2 root root 82 1 month 27 17:09 node0065) Copy redis Configure the file to each node , Modify configuration item
modify
port 6379 -> port 4001 // From node port number
protected-mode no -> protected-mode yes // Turn off protection mode
daemonize no -> daemonize yes // The process runs in the background
dir ./ -> dir /usr/local/redis/node001/ // Profile location
# masterauth <master-password> -> masterauth 111111 // Master password Set up your own , If it is not set, the slave node cannot successfully go online after the master node goes offline .
# requirepass foobared -> requirepass 111111 //redis password
appendonly no -> appendonly yes // Persistence
# cluster-enabled yes -> cluster-enabled yes // Enable clustering
# cluster-config-file nodes-6379.conf -> cluster-config-file node001.conf // The configuration file name is defined by itself , It is better to correspond to the port 6) Start all nodes
/usr/local/bin/redis-server /usr/local/redis/node001/redis.conf
/usr/local/bin/redis-server /usr/local/redis/node002/redis.conf
/usr/local/bin/redis-server /usr/local/redis/node003/redis.conf
/usr/local/bin/redis-server /usr/local/redis/node004/redis.conf
/usr/local/bin/redis-server /usr/local/redis/node005/redis.conf
/usr/local/bin/redis-server /usr/local/redis/node006/redis.conf[[email protected] node001]# ps -aux|grep redis
root 9340 0.0 0.4 171632 13676 ? Rsl 17:06 0:01 /usr/local/bin/redis-server 127.0.0.1:4001 [cluster]
root 9346 0.0 0.3 165488 9764 ? Rsl 17:06 0:01 /usr/local/bin/redis-server 127.0.0.1:4002 [cluster]
root 9352 0.0 0.3 165488 9680 ? Rsl 17:06 0:01 /usr/local/bin/redis-server 127.0.0.1:4003 [cluster]
root 9358 0.0 0.3 165488 9840 ? Rsl 17:06 0:01 /usr/local/bin/redis-server 127.0.0.1:4004 [cluster]
root 9366 0.0 0.3 165488 9888 ? Rsl 17:06 0:01 /usr/local/bin/redis-server 127.0.0.1:4005 [cluster]
root 9415 0.0 0.3 165488 9832 ? Rsl 17:09 0:01 /usr/local/bin/redis-server 127.0.0.1:4006 [cluster]
root 9745 0.0 0.0 112828 984 pts/1 R+ 17:38 0:00 grep --color=auto redis7) Start cluster
/usr/local/bin/redis-cli -p 4001 -a 111111 --cluster create 127.0.0.1:4001 127.0.0.1:4002 127.0.0.1:4003 127.0.0.1:4004 127.0.0.1:4005 127.0.0.1:4006 --cluster-replicas 1( Value is the number of slave nodes . Here is 3 Lord 3 from , So each node corresponds to 1 Slave nodes )8) Check the status
127.0.0.1:4002> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:8
cluster_my_epoch:2
cluster_stats_messages_ping_sent:1994
cluster_stats_messages_pong_sent:1973
cluster_stats_messages_fail_sent:4
cluster_stats_messages_auth-ack_sent:2
cluster_stats_messages_sent:3973
cluster_stats_messages_ping_received:1973
cluster_stats_messages_pong_received:1993
cluster_stats_messages_fail_received:1
cluster_stats_messages_auth-req_received:2
cluster_stats_messages_received:3969
127.0.0.1:4002> cluster nodes
fa1bc24665c02d21eb492ecc8d4a06cbe770d206 127.0.0.1:[email protected] master - 0 1643276420195 8 connected 0-5460
8bcbe21d826117ac18cbea31c1b2239c924cb0f5 127.0.0.1:[email protected] myself,master - 0 1643276420000 2 connected 5461-10922
afce1168c68afd8b18cd5e0c076d8e38ae5e4b5a 127.0.0.1:[email protected] slave 8bcbe21d826117ac18cbea31c1b2239c924cb0f5 0 1643276418000 4 connected
fc05a1d4b1f03b513fcf5b07100460ac8dbb64ef 127.0.0.1:[email protected] slave b7975fcc2f9536db5c88f05c102de5b7d4468843 0 1643276419189 5 connected
b7975fcc2f9536db5c88f05c102de5b7d4468843 127.0.0.1:[email protected] master - 0 1643276421203 3 connected 10923-16383
29c0d34e0f730fc4f21d68d7928bb0289096e81f 127.0.0.1:[email protected] slave fa1bc24665c02d21eb492ecc8d4a06cbe770d206 0 1643276418183 8 connected
127.0.0.1:4002> cluster slots
1) 1) (integer) 0
2) (integer) 5460
3) 1) "127.0.0.1"
2) (integer) 4001
3) "fa1bc24665c02d21eb492ecc8d4a06cbe770d206"
4) 1) "127.0.0.1"
2) (integer) 4006
3) "29c0d34e0f730fc4f21d68d7928bb0289096e81f"
2) 1) (integer) 5461
2) (integer) 10922
3) 1) "127.0.0.1"
2) (integer) 4002
3) "8bcbe21d826117ac18cbea31c1b2239c924cb0f5"
4) 1) "127.0.0.1"
2) (integer) 4004
3) "afce1168c68afd8b18cd5e0c076d8e38ae5e4b5a"
3) 1) (integer) 10923
2) (integer) 16383
3) 1) "127.0.0.1"
2) (integer) 4003
3) "b7975fcc2f9536db5c88f05c102de5b7d4468843"
4) 1) "127.0.0.1"
2) (integer) 4005
3) "fc05a1d4b1f03b513fcf5b07100460ac8dbb64ef"9) Test it
kill Drop one of the primary nodes and see cluster info Medium cluster_status Is it still ok, After restarting the slave node, check whether the slave node is rejoined .
边栏推荐
- Li Kou today's question -1037 Effective boomerang
- MarathonLb的负载研究
- Codeigniter3 learning notes 5 (form verification)
- 2022焊工(初级)特种作业证考试题库及模拟考试
- Windows10 installs both MySQL 5 and MySQL 8
- Cmdbuilding搭建简易流程及问题处理
- Summary of Android Engineer interview experience with 5 years' work experience, summary of real interview questions of Ali + Tencent + byte jump
- 1- enter the database
- wps ppt背景图片如何换颜色
- Encapsulation of common methods in projects
猜你喜欢

【IT】福昕pdf保持工具选择

三方账号授权登录系统设计思路

内网渗透 - 哈希传递攻击

ps如何给图像加边框

Why do I need a thread pool? What is pooling technology?

. Net core 3.0 grpc custom service

Alibaba cloud AI training camp MySQL foundation 1:

Li Kou today's question -1037 Effective boomerang

In 2022, the database audit manufacturer will choose cloud housekeeper! Powerful!

2022年危险化学品经营单位主要负责人操作证考试题库及在线模拟考试
随机推荐
FPGA based TDC Research Report
2022 "Cyberspace Security" event module B of Jiangxi secondary vocational group - SQL injection test
Analysis of semaphore source code of AQS
Fundamentals of deep learning: face based common expression recognition (2) - data acquisition and collation
IP address division and subnet
Latest list of 955 companies that do not work overtime (2022 Edition)
优视慕V8投影仪,打开高清新“视”界
Myql error expression 1 of select list is not in group by claim and contains nonaggregated column
SQL optimization notes - forward
ETF operation practice record: March 2, 2022
关于全局异常捕获的思考-真正的全局异常捕获
Sword finger: duplicate number in array (JS)
Requests segmented downloading of files and multi-threaded downloading
Alibaba cloud AI training camp - machine learning 2:xgboost
Design owlook network novel recommendation system
Product weekly report issue 29 | creation center optimization: the sending assistant adds the quality score detection function, and the blog adds the historical version of the content
数据治理:如何提高企业数据质量?
[series of troubles caused by inaccurate positioning] Part 2: what's wrong with the weak satellite signal
Apache devlake code base guide
Basic knowledge of deep learning: face based common expression recognition (1)