当前位置:网站首页>Docker compose public network deployment redis sentinel mode
Docker compose public network deployment redis sentinel mode
2022-07-04 14:29:00 【mp9105】
docker-compose Public network deployment redis Sentinel mode
Cloud services are used here redis The sentry cluster , And exposed to the public network , This is for testing purposes only , Production should not be exposed to the public network
About online redis Sentinel and cluster docker There are many deployment tutorials , Refer to the following
https://segmentfault.com/a/1190000040755506
https://cloud.tencent.com/developer/news/688466
These deployment tutorials are available on the intranet , But it will not be connected under the public network , Make a note of the main differences
1 start-up redis Master slave node
To write reids Master-slave docker-compose.yml
version: '3.8'
services:
master:
image: redis:6.0.8
container_name: redis-master
privileged: true
restart: always
# Note that there --cluster-announce-ip Specify the exposed address , Fill in the public network address here
# Many deployments here are not specified --masterauth,master After the node restarts, it will not be able to join the cluster
command: redis-server --port 6380 --requirepass redispwd --masterauth redispwd --appendonly yes --cluster-announce-ip xxx.xxx.xxx.xxx --cluster-announce-port 6380 --cluster-announce-bus-port 16380
ports: # As specified above --port Agreement
- 6380:6380
volumes:
- ./data1:/data
slave1:
image: redis:6.0.8
container_name: redis-slave-1
privileged: true
restart: always
# There's a pit here ,--slaveof Don't write directly redis-master, Otherwise, it will be recognized as an intranet IP
command: redis-server --port 6381 --slaveof xxx.xxx.xxx.xxx 6380 --requirepass redispwd --masterauth redispwd --appendonly yes --cluster-announce-ip xxx.xxx.xxx.xxx --cluster-announce-port 6381 --cluster-announce-bus-port 16381
ports: # As specified above --port Agreement
- 6381:6381
volumes:
- ./data2:/data
slave2:
image: redis:6.0.8
container_name: redis-slave-2
privileged: true
restart: always
command: redis-server --port 6382 --slaveof xxx.xxx.xxx.xxx 6380 --requirepass redispwd --masterauth redispwd --appendonly yes --cluster-announce-ip xxx.xxx.xxx.xxx --cluster-announce-port 6382 --cluster-announce-bus-port 16382
ports: # As specified above --port Agreement
- 6382:6382
volumes:
- ./data3:/data
networks:
default:
external:
name: redis_default
Get into redis Corresponding docker-compose.yml The catalog of , Carry out orders :
# Creating networks , There is no need to create
docker network create redis_default
# -d Means running in the background
docker-compose up -d
2 Sentinel file preparation
To write docker-compose.yml
version: '3.8'
services:
sentinel1:
image: redis:6.0.8
container_name: redis-sentinel-1
privileged: true
restart: always
ports:
- 26380:26380
volumes:
- ./sentinel1.conf:/usr/local/etc/redis/sentinel.conf
command: bash -c "redis-sentinel /usr/local/etc/redis/sentinel.conf && chmod 777 /usr/local/etc/redis/sentinel.conf"
sentinel2:
image: redis:6.0.8
container_name: redis-sentinel-2
privileged: true
restart: always
ports:
- 26381:26380
volumes:
- ./sentinel2.conf:/usr/local/etc/redis/sentinel.conf
command: bash -c "redis-sentinel /usr/local/etc/redis/sentinel.conf && chmod 777 /usr/local/etc/redis/sentinel.conf"
sentinel3:
image: redis:6.0.8
container_name: redis-sentinel-3
privileged: true
ports:
- 26382:26380
volumes:
- ./sentinel3.conf:/usr/local/etc/redis/sentinel.conf
command: bash -c "redis-sentinel /usr/local/etc/redis/sentinel.conf && chmod 777 /usr/local/etc/redis/sentinel.conf"
networks:
default:
external:
name: redis_default
To write sentinel.conf The configuration file
# mymaster Is the custom cluster name
# xxx.xxx.xxx.xxx Master node IP The public address of
# 6380 by redis-master The port of ,2 Is the minimum number of votes ( Because there is 3 platform Sentinel So it can be set to 2)
port 26380
dir /tmp
# protected-mode no
# bind 0.0.0.0
sentinel monitor mymaster xxx.xxx.xxx.xxx 6380 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
# The password is consistent with the above
sentinel auth-pass mymaster redispwd
sentinel failover-timeout mymaster 180000
sentinel deny-scripts-reconfig yes
Copy the above documents separately 3 The copies are named sentinel1.conf、sentinel2.conf、sentinel3.conf And docker-compose.yml The configuration file in corresponds to , Then place and the sentry's docker-compose.yml In the same directory
3 Activate the sentry
# Get into docker-compose.yml Execute in the folder
docker-compose up -d
4 Test connection
With ARDM For example , Fill in the corresponding information

It can be connected normally.

边栏推荐
- Abnormal value detection using shap value
- sql优化之explain
- Visual Studio调试方式详解
- Incremental ternary subsequence [greedy training]
- 按照功能对Boost库进行分类
- The game goes to sea and operates globally
- MATLAB中tiledlayout函数使用
- 递增的三元子序列[贪心训练]
- [information retrieval] link analysis
- Sqlserver functions, creation and use of stored procedures
猜你喜欢

富文本编辑:wangEditor使用教程

迅为IMX6Q开发板QT系统移植tinyplay

Oppo find N2 product form first exposure: supplement all short boards

Xcode 异常图片导致ipa包增大问题

Rich text editing: wangeditor tutorial

codeforce:C. Sum of Substrings【边界处理 + 贡献思维 + 灵光一现】

nowcoder重排链表

sql优化之查询优化器

Map of mL: Based on Boston house price regression prediction data set, an interpretable case of xgboost model using map value

潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
随机推荐
Digi XBee 3 rf: 4 protocols, 3 packages, 10 major functions
Real time data warehouse
Scratch Castle Adventure Electronic Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
STM32F1与STM32CubeIDE编程实例-MAX7219驱动8位7段数码管(基于GPIO)
[MySQL from introduction to proficiency] [advanced chapter] (V) SQL statement execution process of MySQL
Codeforce:c. sum of substrings
No servers available for service: xxxx
MATLAB中tiledlayout函数使用
[MySQL from introduction to proficiency] [advanced chapter] (IV) MySQL permission management and control
A collection of classic papers on convolutional neural networks (deep learning classification)
How to operate and invest games on behalf of others at sea
scratch古堡历险记 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
2022游戏出海实用发行策略
R language uses the mutation function of dplyr package to standardize the specified data column (using mean function and SD function), and calculates the grouping mean of the standardized target varia
流行框架:Glide的使用
数据湖(十三):Spark与Iceberg整合DDL操作
C# wpf 实现截屏框实时截屏功能
Test evaluation of software testing
第十七章 进程内存
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat