In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
one。 What is master-slave replication?
There is a problem with the redis stand-alone:
1. Stand-alone machine failure, can not recover quickly
two。 Memory limit of single machine capacity
3. Stand-alone QPS problem
Simply put, slave replicates master data.
The role of master-slave replication:
1. Provide copy of data (backup)
two。 Extended read performance (read-write separation)
A slave has only one master, and a master has multiple slave
One-way data flow: master- > slave
Second, how to configure replication
1. Specify who the slave service is through the slaveof command configuration
Redis-server / Users/zhangrenjie/redis-master-slave/redis_6381.conf
127.0.0.1 slaveof 6382 > 127.0.0.1 6379
OK
View master and slave information
127.0.0.1purl 6381 > info replication
# Replicationrole:slavemaster_host:127.0.0.1master_port:6379master_link_status:upmaster_last_io_seconds_ago:2master_sync_in_progress:0slave_repl_offset:1418slave_priority:100slave_read_only:1connected_slaves:0master_replid:8ad20b647446628d7f21585a73838af209d9e147master_replid2:0000000000000000000000000000000000000000master_repl_offset:1418second_repl_offset:-1repl_backlog_active:1repl_backlog_size:1048576repl_backlog_first_byte_offset:705repl_backlog_histlen:714
Enter the main service
127.0.0.1 purl 6379 > info replication
# Replicationrole:masterconnected_slaves:3slave0:ip=127.0.0.1,port=6380,state=online,offset=914,lag=1slave1:ip=127.0.0.1,port=6381,state=online,offset=914,lag=0slave2:ip=127.0.0.1,port=6382,state=online,offset=914,lag=0master_replid:8ad20b647446628d7f21585a73838af209d9e147master_replid2:0000000000000000000000000000000000000000master_repl_offset:914second_repl_offset:-1repl_backlog_active:1repl_backlog_size:1048576repl_backlog_first_byte_offset:1repl_backlog_histlen:914
Cancel the slave slave node, and the data passed through the original database will not disappear.
127.0.0.1 purl 6382 > slaveof no one
OK
Note: when slave synchronizes master data, the own data on slave will be erased
two。 Configure through a profile
Slaveof ip portslave-read-only yes slave node read-only
Areas that need to be modified and improved:
1.daemon yes # running in the background
2.pidfile # pid process ID stores files
3.logfile # log storage path
# save 100 1
# save 1000 10
4.dbfilename dump-6379.rdb # data file
5.dir # working directory
6.masterauth # Primary Node password
7.slave-read-only yes # set read-only from slave node
8.slaveof ip port # specifies whose slave node it belongs to
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.