当前位置:网站首页>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 了 :
边栏推荐
- Quartz:老而弥坚的开源任务调度框架,用起来够丝滑
- JMeter piezometric interface programming North
- [cnn]| translation invariance
- Product milestones in May 2022
- OpenGL Chapter 10 illuminant
- openssl enc 加解密
- SSL交互过程
- three. JS cool technology background H5 animation
- Course classification tree structure display
- [cnn]|differences between CNN and transformer
猜你喜欢

Shopping and retail backstage management system of chain supermarket based on SSM framework

基于SSM框架的连锁超市购物零售后台管理系统

OpenGL第七章 基础光照

大厂外包or自研公司?测试人找工作怎么选?

Writing shell scripts using vscode

Exam item management system based on SSM

基于SSM框架的学生在线教育教学课程管理系统

Thoughts on the number of threads and CPU caused by the CPU load high alarm

Thinkphp3.2.3 deserialization using chain analysis

给孩子的国学经典
随机推荐
three. JS cool technology background H5 animation
Docker swarm installing MySQL Cluster
SQL query users logged in for three consecutive days
Lua removing elements from a loop in a list
1_ Attribute management function
Lianyirong (passed)
[elt.zip] openharmony paper Club - Data high-throughput lossless compression scheme
【SignalR全套系列】之在.Net6中实SignalR通信
Image scaling with aspect ratio preserving by opencv
OpenGl第九章 光照贴图
[cnn]|differences between CNN and transformer
Record the problem of Galaxy Kirin V10 server version once: an error is reported when installing KVM
RHEL7 切换字符编码为GBK
OpenGL第八章 材质material
Unity's data persistence -- Jason
J. Balanced Tree
Pthread in the multithreaded Trilogy
Guide de migration Maui
Two solutions for reliable message consistency
Canvas rotation drawing H5 animation JS effect