当前位置:网站首页>Building a cluster: and replacing with error
Building a cluster: and replacing with error
2022-06-12 08:47:00 【Wu Yu】
cluster Cluster building :
Environmental preparation : Three hosts are needed . Port Division :
192.168.181.4 port : 7001, 7002
192.168.181.5 port : 7003, 7004
192.168.181,6 port : 7005, 7006
1. Modify the configuration file of the host , I'm going to modify 7001,7002 For example : Execute the command one by one
# cp /root/redis-6.2.3/redis.conf /root/redis-6.2.3/redis_7001.conf
# cp /root/redis-6.2.3/redis.conf /root/redis-6.2.3/redis_7002.conf
# mkdir -p /var/log/redis/cluster
# mkdir -p /root/redis-6.2.3/cluster/{redis_7001,redis_7002}
- modify Redis_700conf Configuration file for : The contents are as follows :
# vim redis_7001.conf bind 192.168.181.4 port 7001 daemonize yes pidfile "/var/run/redis_7001.pid" // Default road strength logfile "/var/log/redis/cluster/redis_7001.log" // The path of the created log file dir "/root/redis-6.2.3/cluster/redis_7001" // Created cluster File path . masterauth “123456” requirepass “123456” appendonly yes cluster-enabled yes cluster-config-file nodes_7001.conf cluster-node-timeout 15000# vim redis_7002.conf bind 192.168.181.4 port 7002 daemonize yes pidfile "/var/run/redis_7002.pid" // Default road strength logfile "/var/log/redis/cluster/redis_7002.log" // dir /root/redis-6.2.3/cluster/redis_7002" masterauth "123456" requirepass "123456" appendonly yes cluster-enabled yes cluster-config-file nodes_7002.conf cluster-node-timeout 15000
Other host configurations are the same , But you need to pay special attention to the path , Because on every host Redis Directories may be located in different locations .
And then start the... Of each host in turn Redis: stay Redis Use the following command under the directory : ./src/redis-server redis_7001.conf ,
Then trace the log file : tail -f /var/log/redis/cluster/redis_7001.log

There may be warnings , Because the default allocation of device space is too small , It needs to be expanded : Execute the following command :
echo > 1024 /proc/sys/net/core/ somaxconn
Each node on each host has no problem after startup , Next, create a cluster .
Set up the cluster :
Create a cluster on any node : The order is as follows :
./src/redis-cli -a 123456 --cluster create 192.168.181.4:7001 192.168.181.4:7002 192.168.181.5:7003 192.168.181.5:7004 192.168.181.6:7005 192.168.181.6:7006 --cluster-replicas 1

There may be mistakes here :
replace with error
The reason for the mistake : Previously configured Redis password , May have had an impact ,
You can use the following command : solve :
First of all to enter :Redis The client of ./src/redis-cli -h ip -p 7002
And then use : config set requirepass 123456( password )
then :auth 123456

The configuration is complete . The above problems have occurred in the process of each node , So on each node , All the above commands are executed once ,
Then rebuild the cluster :

Input yes after , You can see the master-slave relationship table between nodes . It will also automatically generate nodes.conf file .
At this point, setting up the cluster is preliminarily completed , Later, you can try to enter data on the face for testing , You can also test adding and deleting nodes .
Login cluster :
# redis-cli -c -h ip -p 7001 -a 123456 # -c, Log in as a cluster
CLUSTER INFO # View the cluster status
CLUSTER NODES # List node information
CLUSTER MEET IP Node number # Add node
CLUSTER FORGET Node number # Delete node
CLUSTER SAVECONFIG # Save the node configuration information to the hard disk
redis cluster Clusters are decentralized , Every node is equal , You can get and set data by connecting any node .
Of course , Equality means master node , because slave Nodes don't provide services at all , Just as a counterpart master A backup of the node .
边栏推荐
- 《MATLAB 神经网络43个案例分析》:第7章 RBF网络的回归--非线性函数回归的实现
- The newline character with in the string is converted to an array
- 第六章-包含多个段的程序
- (P14) use of the override keyword
- Triggers in MySQL
- (p21-p24) unified data initialization method: List initialization, initializing objects of non aggregate type with initialization list, initializer_ Use of Lisy template class
- Background location case 1
- Engineers learn music theory (III) interval mode and chord
- 【进阶指针二】数组传参&指针传参&函数指针&函数指针数组&回调函数
- 报错:文件夹在另一个程序中打开无法删除怎么办
猜你喜欢

The difference between deep copy and shallow copy

Analysis of 43 cases of MATLAB neural network: Chapter 8 prediction of GRNN Network - Freight Volume Prediction Based on generalized regression neural network

svg中viewbox图解分析

报错:清除网站内搜索框中的历史记录?

Loading font component loading effect

《MATLAB 神经网络43个案例分析》:第7章 RBF网络的回归--非线性函数回归的实现
![[GUI development] browsing function implementation model of image processing software](/img/37/2162a6047682b9cfc9b8b7c2488068.jpg)
[GUI development] browsing function implementation model of image processing software

【数据存储】浮点型数据在内存中的存储

ip、DNS、域名、URL、hosts

处理异常数据
随机推荐
【新规划】
Analysis of 43 cases of MATLAB neural network: Chapter 7 regression of RBF Network -- Realization of nonlinear function regression
第七章-更灵活定位内存地址
动态创建表单并提交
Configuration and principle of MSTP
Shell basic syntax -- array
Popular understanding of time domain sampling and frequency domain continuation
Loading circling effect during loading
【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C
(p19-p20) delegate constructor (proxy constructor) and inheritance constructor (using)
Judge whether the object is empty
Knee joint
Only use MES as a tool? Looks like you missed the most important thing
What is the quality traceability function of MES system pursuing?
Query in MySQL
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit
Vscode download slow solution
动态线段树leetcode.699
When converting tensor to ndarray in tensorflow, the run or Eval function is constantly called in the loop, and the code runs more and more slowly!
Regular expressions in JS