当前位置:网站首页>[redis] redis high availability deployment scheme in distributed scenarios
[redis] redis high availability deployment scheme in distributed scenarios
2022-07-22 16:56:00 【Hi, Sen Bao】
Article content
1、Redis High availability Overview
Refer to the post :
Introducing Redis Before high availability , First of all, let's explain that in Redis The meaning of high availability in the context of .
We know , stay web Server , High availability refers to the time when the server can be accessed normally , The measure is how long a normal service can be provided (99.9%、99.99%、99.999% wait ). But in Redis In context , The meaning of high availability seems to be broader , In addition to ensuring normal service ( Such as Master slave separation 、 Rapid disaster recovery technology ), We also need to consider the data capacity Expand 、 Data security will not be lost etc. .
stay Redis in , Technologies to achieve high availability mainly include Persistence
、 Copy
、 sentry
and colony
, Their functions are described below , And what kind of problems have been solved .
- Persistence : Persistence is the simplest high availability method ( Sometimes it's not even classified as a highly available means ), The main functions are The data backup , Store data on hard disk , Ensure that data is not lost due to process exit .
- Copy : Copy is Redis High availability Foundation , Sentinels and clusters are highly available based on replication . Replication mainly realizes data Multi machine backup ( Solve the single point of failure problem ), And for Load balancing for read operations and Simple fault recovery . defects : Failure recovery cannot be automated ; Write operations are not load balanced ; Storage capacity is limited by a single machine .
- sentry : On the basis of replication , The Sentinels achieved Automated fault recovery . defects : Write operations are not load balanced ; Storage capacity is limited by a single machine .
- colony : By clustering ,Redis It solves the problem that write operation cannot be load balanced , And storage capacity is limited by single machine , A relatively complete high availability scheme has been realized .
2、 Persistence
3、Redis Master slave copy
utilize docker Start two redis example
# Pull redis Mirror image
docker pull redis:5.0.0
# create profile
touch /docker/redis/conf/redis.conf
# Start mirror container
docker run -p 6379:6379 --name redis \
-v /docker/redis/data:/data \
-v /docker/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis:5.0.0 redis-server
# Turn on self starting
docker update redis --restart=always
The server ip by 172.16.31.128 Respectively mapped in 6379( Lord ) and 6380( from ) Under port ( The default is the master node )
Realization way
We need to pay attention to , The opening of master-slave replication , It's all from the node ; We don't need to do anything at the master node .
Enable master-slave replication from the slave node , Yes 3 Ways of planting :
- The configuration file . Add to profile from server :slaveof <masterip> <masterport>
- Start command .redis-server Add after starting command --slaveof <masterip> <masterport>
- Client commands .Redis After the server starts , Execute commands directly from the client :slaveof , Then Redis Instance becomes slave .
Above 3 This is equivalent to , Take the client command as an example , Take a look at the execution of slaveof after ,Redis Changes in master and slave nodes .
Input from the node slaveof command , Join the master node
Add hello ——> world
The slave node can get come out , It shows that the master and subordinate are ok !!!
View the slave node after deletion , It is found that the slave node is also deleted synchronously .
Can pass slaveof no one
Command to disconnect all master-slave connections
4、Redis Sentinel mode
3、Redis Cluster pattern
边栏推荐
猜你喜欢
Jincang database kmonitor user guide --3. deployment
Cartopy绘图入门指南
Qt warning: C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
QDataStream
TensorFlow 各优化器在鸢尾花分类任务中的应用
汉得数字平台体系及试用知多少?
Leetcode daily question 814. Binary tree pruning
opencv支持H264视频编码
Bryntum Scheduler Pro 5.0.6 \Gantt\Crack
5. SSH Remote Service
随机推荐
ffmpeg-rk3399 ffplay 学习分析
UE4 用灰度图构建地形
The function and application of tostring() and rewriting
1143. 最长公共子序列
HZERO企业级数字PaaS平台 (二)| 企业级权限体系
[论文翻译] Generalized Radiograph Representation Learning via Cross-Supervision Between Images
汉得企业级数字化PaaS平台 HZERO 1.9.0 版本正式发布!
AlterNet Studio 8.1 Crack
Analyzing the upsurge of participating in robot education competition
AT1225 かかし
How to install a pagoda on IBM's free machine
教程更新20220719
UE4 钥匙开门
14_响应模型
tf.get_default_graph
Yuanqi Digitalization: existing mode or open source innovation Lixia action
Mecol Studio - the third assignment of harmonyos application development training
PHP QR code decoding qrreader class | QR code image to string
微信支付项目实战、创建订单到支付退款代码详解
AT4379 [AGC027E] ABBreviate