In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Official manual:
Https://mariadb.com/resources/blog/binlog-server
Reference article:
Http://www.linuxidc.com/Linux/2016-12/137892.htm
Http://www.sohu.com/a/120438391_487514
Cons: currently, binlog server does not support GTID replication.
Experimental topology diagram:
Step 1:
Create an account with replication permissions on Node1:
> grant replication client,replication slave,select on *. * to 'rpl'@ "192.168.2.%" identified by' rpl'
# this is the account for copying from the database, and it is also the account for maxscale to pull binlog. It has one more select permission than the regular slave account.
First, hang Node2 under node1 to simulate the architecture before binlog server:
The process is nothing more than exporting all the data of node1, restoring it on node2 and change master it to node1, skipping the specific steps.
Install maxscale on Node3:
Rpm-ivh maxscale-2.1.4-1.rhel.6.x86_64.rpm
Mkdir / data/binlog/-p
Chown maxscale.maxscale / data/binlog/-R
The vim/etc/maxscale.conf content is as follows:
[maxscale]
Threads=4 # set according to the number of CPU cores
# # Information about connecting to Master
[Replication]
Type=service
Router=binlogrouter
Version_string=5.6.36-log
# version_string parameter is used to pass the version information of the master library to the slave library, MaxScale sends server handshakepacket to clients
Router_options=server-id=13,heartbeat=30,transaction_safety=1,rcompatibility=1,send_slave_heartbeat=1
Binlogdir=/data/binlog # this directory belongs to the master group must be maxscale
User=rpl
Passwd=rpl
# description:
# server-id sets the id of maxscale and cannot have the same name as the master or slave database.
# heartbeat=30 means that when maxscale does not receive the binlog log pushed by the main database within 30 seconds, send a heartbeat check
# transaction_safety=1 is used to enable incomplete transaction detection in the binlog log. When MariaDBMaxScale starts, an error message may appear if the current binlog file is corrupted or an incomplete transaction is found. During normal operation, the binlog event is not assigned to the slave library until the transaction has been committed. The default value is off and transaction_safety= on is set to enable incomplete transaction detection. [similar to the role of relay_log_recovery = ON]
# send_slave_heartbeat=1 enables heartbeat check
# # Information provided to slave connection
[ReplicationListener]
Type=listener
Service=Replication
Protocol=MySQLClient
Port=5308
# # maxscale backend management port
[MaxAdmin Service]
Type=service
Router=cli
[MaxAdmin Listener]
Type=listener
Service=MaxAdmin Service
Protocol=maxscaled
Socket=default
Vim / data/binlog/master.ini adds the following:
[binlog_configuration]
Master_host=192.168.2.11 # address of the main library
Master_port=3306 # main library port number
Copy account of master_user=rpl # master
Copy password for master_password=rpl # master
Filestem=mysql # means that the pulled binlog file is named mysql.***. My main library is also named mysql.*.
Add this master.ini file so that after starting maxscale, you will automatically pull all the current binlog files of the main library (even if the binlog of the main library is automatically purge after it expires, the binlog on the maxscale server will still be saved)
Then, open the maxscale service on node3:
/ etc/init.d/maxscale start
Wait a moment, node3 will pull all the binlog of the main library.
The log is recorded in / var/log/maxscale/maxscale.log.
Ss-lnt | if port 5308 is up for grep.
Mysql-urpl-prpl-h 127.0.0.1-P 5308 can log in to the maxscale console, just like mysql.
Now let's add the new node4 from the library to node3's binlog server:
First, import the full backup data of node1 into node4
Then find something similar in the head-35 all.sql full backup:
A record like CHANGE MASTER TOMASTER_LOG_FILE='mysql.000004', MASTER_LOG_POS=2254.
Perform a change master operation on node4:
> CHANGE MASTER TO MASTER_HOST='192.168.2.13'
MASTER_PORT=5308
MASTER_USER='rpl'
MASTER_PASSWORD='rpl'
MASTER_LOG_FILE='mysql.000004'
MASTER_LOG_POS=2254
Note that in the change master operation above, we only changed the address and port of the master, the user name and password used for replication.
Because binlog server is actually the same as master's data, it only drags master's binlog directly.
To do the same, we can also hang node2 under binlog server.
On node2:
Show slave status\ G record Exec_Master_Log_Pos and Master_Log_File.
Stop slave
Reset slave all
Then use change master to point your superiors to binlog server.
Other maxscale commands:
On node3, execute show slave hosts; to see
You can also log in to the maxscale console:
Maxadmin-S / tmp/maxadmin.sock
You can use the help prompt for many other commands that view status, such as MaxScale > show services. That's not the point.
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.