当前位置:网站首页>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 .
边栏推荐
- At present, MES is widely used. Why are there few APS scheduling systems? Why?
- Triggers in MySQL
- This article is required for the popularization of super complete MES system knowledge
- Background position - exact units
- 报错:清除网站内搜索框中的历史记录?
- Record the first step pit of date type
- Seurat package addmodulescore is used for bulk RNA SEQ data
- Regularization to limit the number of digits after the decimal point of an input number
- Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
- Error: ER_ NOT_ SUPPORTED_ AUTH_ MODE: Client does not support authentication protocol requested ... ...
猜你喜欢

Box model border

X64dbg debugging exception_ ACCESS_ VIOLATION C0000005

【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C

Why should enterprises implement MES? What are the specific operating procedures?

通俗理解时域采样与频域延拓

Error: clear the history in the search box in the website?

Centso8 installing mysql8.0 (Part 2)

(p17-p18) define the basic type and function pointer alias by using, and define the alias for the template by using and typedef

【字符集九】gbk拷贝到Unicode会乱码?

根据有效期显示距离当前还剩多少天有效期
随机推荐
Only use MES as a tool? Looks like you missed the most important thing
Vscode download slow solution
Application method of new version UI of idea + use method of non test qualification and related introduction
UMI packaging and subcontracting, and compressing to gzip
What is the quality traceability function of MES system pursuing?
【数据存储】浮点型数据在内存中的存储
[open source project] easycmd command graphical software
This article is required for the popularization of super complete MES system knowledge
ip、DNS、域名、URL、hosts
【指针进阶三】实现C语言快排函数qsort&回调函数
Random acquisition of 4-digit non repeated verification code
Engineers learn music theory (I) try to understand music
【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C
调整svg宽高
Background position - mixed units
Priority issues
[GUI development] browsing function implementation model of image processing software
Installation of Shengxin R package
(p15-p16) optimization of the right angle bracket of the template and the default template parameters of the function template
The newline character with in the string is converted to an array