Redis入门到高可用-6.Redis复制的原理与优化

2019-09-14  本文已影响0人  笨鸡

1.概要

2.什么是主从复制

Redis单机问题.png
Redis主从1.png
Redis主从2.png
Redis主从复制作用1.png
主从复制的作用.png
主从复制总结.png

3.主从复制的配置

4.实操

5.全量复制

[root@master redis]# redis-cli -p 6379 info server | grep run
run_id:26a8b09874078fda0a18b7a1f08c05ddb7ac8ab0
[root@master redis]# redis-cli -p 6380 info server | grep run
run_id:10858f81e4b3be96fefa9b07af1f9e87c31100ea
[root@master redis]# redis-cli -p 6380 info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:6379
master_link_status:up
master_last_io_seconds_ago:4
master_sync_in_progress:0
slave_repl_offset:6218
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:e21d4f3793ad9495f4cf9ae6d23d3e426df72cb2
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:6218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:6218
[root@master redis]# redis-cli -p 6379 info replication
# Replication
role:master
connected_slaves:1
slave0:ip=127.0.0.1,port=6380,state=online,offset=6246,lag=0
master_replid:e21d4f3793ad9495f4cf9ae6d23d3e426df72cb2
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:6246
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:6246
全量复制.png

6.全量复制开销

7.故障处理

故障转移.png
slave宕掉1.png
slave宕掉2.png
slave宕掉3.png
master宕掉1.png
master宕掉2.png
master宕掉3.png
master宕掉4.png
故障转移问题.png

7.主从复制开发与运维中的问题

上一篇下一篇

猜你喜欢

热点阅读