当前位置:网站首页>Docker swarm installs redis cluster (bitnami/redis cluster:latest)
Docker swarm installs redis cluster (bitnami/redis cluster:latest)
2022-06-11 03:50:00 【linmengmeng_ one thousand three hundred and fourteen】
- Preparing the cluster environment :
docker-79、docker-80、docker-81
- Pull the mirror image :
docker pull bitnami/redis-cluster:latest

3. Create a new... In any folder compose.yml Script :redis_compose.yml
abnormal
SELECT is not allowed in cluster mode
Open the connection , Tips :SELECT is not allowed in cluster mode
This is because redis In stand-alone mode redis.conf The default number of databases in the configuration file is 16 individual , This configuration does not work in cluster mode , Cluster clients do not support multiple databases db Of , Only one database defaults to SELECT 0;
redis The cluster version only uses db0,select The command can support select 0. Other db Will return an error .
CLUSTERDOWN Hash slot not served

Use cluster info look down redis State of the cluster :
You can see that the cluster status is fail , And the number of slots below is 0 , This is very abnormal .
Enter the container in turn :docker exec -it Containers ID bash
perform :redis-cli -c -h 172.17.0.1 -p 6379
It can be connected normally redis, And then execute :cluster meet 172.17.0.1 6379
This IP(172.17.0.1) by docker Internal default network IP:
If there is no password , Will prompt directly OK If you have a password Need to enter : auth redis password 
This meet The command is very beautiful , To make the nodes in the cluster know each other ??? Then continue to operate the other two servers IP, Let them know each other .
After this step , Finding out doesn't solve the problem , Try to write a value into the client , Still prompt this exception .
And then execute it in the container :redis-cli --cluster info 192.168.104.79:6379 -a [email protected] , among [email protected] by redis Cluster password , If there is no password , You don't have to add -a password , Find out slots Slot It's empty , This is why the above problem is wrong .
root@docker-80:/# redis-cli --cluster info 192.168.104.79:6379 -a huauN@2021
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.104.79:6379 (6ce9026c...) -> 0 keys | 0 slots | 0 slaves.
[OK] 0 keys in 1 masters.
0.00 keys per slot on average.
root@docker-80:/#
Then use redis-cli --cluster fix Perform cluster repair
root@docker-80:/#
root@docker-80:/# redis-cli --cluster fix 192.168.104.79:6379 -a huauN@2021
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.104.79:6379 (6ce9026c...) -> 0 keys | 0 slots | 0 slaves.
[OK] 0 keys in 1 masters.
0.00 keys per slot on average.
>>> Performing Cluster Check (using node 192.168.104.79:6379)
M: 6ce9026c9f438f8025323bf13787e43f08dc33bd 192.168.104.79:6379
slots: (0 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[ERR] Not all 16384 slots are covered by nodes.
>>> Fixing slots coverage...
The following uncovered slots have no keys across the cluster:
[0-16383]
Fix these slots by covering with a random node? (type 'yes' to accept): yes
>>> Covering slot 660 with 192.168.104.79:6379
>>> Covering slot 4315 with 192.168.104.79:6379
>>> Covering slot 13760 with 192.168.104.79:6379
>>> Covering slot 10315 with 192.168.104.79:6379
The input will then confirm whether to repair the slot :Fix these slots by covering with a random node? (type 'yes' to accept):, Input here yes The slot will be repaired automatically , Wait for the scrolling output to end , Look at the node information , Here's the picture , Number of slots is 16384, That is, the number of normal single node slots .
Now , Directly view the slot points of the other two machines , You can see , It's all normal .

At this time , Test with client connection redis Normal use :
This... Also exists automatically on the other two machines key:
At this time , Let's look at the cluster status , It has become ok 了 :
边栏推荐
- Implementation of publish and subscribe mode ----- hand tearing JS series
- Technology Pro strength evaluation: comprehensive PK of high-end massage chair market, who is worthy of the machine king?
- Picking peaches (double pointer)
- Right click PowerShell here function add
- 路径计数2(dp + 组合数)
- Mavros controls UAV to conduct binocular slam in gazebo environment
- Web upload file Preview
- 【可解释】|深层网络的公理化属性(Axiomatic Attribution for Deep Networks)
- Tweenmax colorful ball bouncing animation
- VNC remote configuration of Galaxy Kirin server system
猜你喜欢

SQL query users logged in for three consecutive days

/The world of 10 recommended websites for learning programming has entered the era of the Internet. According to a recently released Internet trends 2016 report, China has become a leader in the Inter

Canvas interactive star animation background JS special effect

Pthread in the multithreaded Trilogy
![[elt.zip] openharmony paper Club - multi tier storage hierarchical data compression](/img/28/ec83b2ebb1f0772acdec443525c26d.png)
[elt.zip] openharmony paper Club - multi tier storage hierarchical data compression

Detailed explanation of scenario method for common test case design methods

基于SSM的考试项目管理系统

Chinese classics for children

regular expression
![[cnn]|differences between CNN and transformer](/img/ed/2b47387ba390a02c24bf9ff85b36e4.png)
[cnn]|differences between CNN and transformer
随机推荐
PostgreSQL catch exception in function
SQL | some indicators of the game industry
Shell script binary encryption
/The world of 10 recommended websites for learning programming has entered the era of the Internet. According to a recently released Internet trends 2016 report, China has become a leader in the Inter
Azure kubernates service update | improve development experience and efficiency
Quartz:老而弥坚的开源任务调度框架,用起来够丝滑
基于SSM框架的学生在线教育教学课程管理系统
RT thread test
开源项目 英雄联盟 之WPF
让人感到心灵平静,阳光温暖的图片
Using minted to insert highlighted code in texstudio in latex environment
UML系列文章(28)体系结构建模---协作
Multi thread alternate output ab
JMeter piezometric interface programming North
JS to realize coritization
Management system of College Students' associations based on SSM
Lianyirong (passed)
JS top icon menu click to switch background color JS special effect
[数据集]|无人机视角
618 coming! Can oppo reno6, which is sold through all channels with high price and low configuration, win?