日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql从节点放家里_添加MySQL 5.6 从节点 Slave

發布時間:2024/1/23 数据库 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql从节点放家里_添加MySQL 5.6 从节点 Slave 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

mysql版本:5.6.36

xtraback版本:version 2.4.6

1、修改主節點MySQL配置文件,并重啟MySQL

cat /usr/local/mysql/my.cnf

[mysqld]

datadir = /var/lib/mysql

socket = /tmp/mysql.sock

binlog-format=ROW

log-slave-updates=true

gtid-mode=on

enforce-gtid-consistency=true

log-bin=mysql-bin

expire_logs_days=2

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-workers=2

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

report-port=3306

port=3306

server_id = 1

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

2、使用xtrabackup全備MySQL,并將備份集拷貝到從節點

innobackupex --defaults-file=/usr/local/mysql/my.cnf --slave-info --user=root --password=mg@Xa9382cs%acd --socket=/tmp/mysql.sock /root

3、修改從節點MySQL配置文件,并重啟MySQL

cat /usr/local/mysql/my.cnf

[mysqld]

datadir = /var/lib/mysql

socket = /tmp/mysql.sock

relay-log = relay-log

relay-log-index = relay-log.index

binlog-format=ROW

log-bin=mysql-bin

log-slave-updates=true

gtid-mode=on

enforce-gtid-consistency=true

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-workers=2

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

report-port=3306

port=3306

server_id = 10

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

4、在從節點使用xtrabackup恢復數據庫

innobackupex --defautls-file=/usr/local/mysql/my.cnf --apply-log --redo-only /root/2017-07-10_16-54-29

innobackupex --defautls-file=/usr/local/mysql/my.cnf --apply-log /root/2017-07-10_16-54-29

innobackupex --defautls-file=/usr/local/mysql/my.cnf --socket=/tmp/mysql.sock --copy-back /root/2017-07-10_16-54-29

5、在主節點創建復制專用賬號

mysql> GRANT REPLICATION SLAVE ON *.* TO 'repluser'@'10.10.45.155' IDENTIFIED BY '123456';

mysql> flush privileges;

6、查看slave復制信息cat /var/lib/mysql/xtrabackup_binlog_pos_innodb ?mysql-bin.000003?124800463?7、將從節點添加到主節點中mysql> change master to master_host='10.10.45.154', master_port=3306,master_user='repluser',master_password='mg@Xa9382cs%acd',master_log_file='mysql-bin.000003',master_log_pos=124800463;mysql> start slave;mysql> show slave status\G;*************************** 1. row ***************************?????????????? Slave_IO_State: Waiting for master to send event????????????????? Master_Host: 10.10.45.154????????????????? Master_User: repluser????????????????? Master_Port: 3306??????????????? Connect_Retry: 60????????????? Master_Log_File: mysql-bin.000005????????? Read_Master_Log_Pos: 1073587699?????????????? Relay_Log_File: relay-log.000009??????????????? Relay_Log_Pos: 1073587202??????? Relay_Master_Log_File: mysql-bin.000005???????????? Slave_IO_Running: Yes??????????? Slave_SQL_Running: Yes????????????? Replicate_Do_DB: ????????? Replicate_Ignore_DB: ?????????? Replicate_Do_Table: ?????? Replicate_Ignore_Table: ????? Replicate_Wild_Do_Table: ? Replicate_Wild_Ignore_Table: ?????????????????? Last_Errno: 0?????????????????? Last_Error: ???????????????? Skip_Counter: 0????????? Exec_Master_Log_Pos: 1073587032????????????? Relay_Log_Space: 1073588154????????????? Until_Condition: None?????????????? Until_Log_File: ??????????????? Until_Log_Pos: 0?????????? Master_SSL_Allowed: No?????????? Master_SSL_CA_File: ?????????? Master_SSL_CA_Path: ????????????? Master_SSL_Cert: ??????????? Master_SSL_Cipher: ?????????????? Master_SSL_Key: ??????? Seconds_Behind_Master: 0Master_SSL_Verify_Server_Cert: No??????????????? Last_IO_Errno: 0??????????????? Last_IO_Error: ?????????????? Last_SQL_Errno: 0?????????????? Last_SQL_Error: ? Replicate_Ignore_Server_Ids: ???????????? Master_Server_Id: 1????????????????? Master_UUID: 5a842cc5-65fb-11e7-b132-0050569b6c3a???????????? Master_Info_File: mysql.slave_master_info??????????????????? SQL_Delay: 0????????? SQL_Remaining_Delay: NULL????? Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it?????????? Master_Retry_Count: 86400????????????????? Master_Bind: ????? Last_IO_Error_Timestamp: ???? Last_SQL_Error_Timestamp: ?????????????? Master_SSL_Crl: ?????????? Master_SSL_Crlpath: ?????????? Retrieved_Gtid_Set: 5a842cc5-65fb-11e7-b132-0050569b6c3a:30491-1028116??????????? Executed_Gtid_Set: 5a842cc5-65fb-11e7-b132-0050569b6c3a:30491-1028116??????????????? Auto_Position: 0

總結

以上是生活随笔為你收集整理的mysql从节点放家里_添加MySQL 5.6 从节点 Slave的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。