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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

MaxScale Binlog Server

發布時間:2025/7/14 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MaxScale Binlog Server 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

MaxScale Binlog Server理想架構圖

要點提示:

1、MX只能適合Mariadb自家的版本作為BINLOG ROUTER,其他DB都不適合

2、開通IPTABLES,避免端口唄過濾

3、使用MX服務收集BINLOG減少了M的IO壓力

4、MX到SLAVE的數據同步延遲

5、Master到MX在大數據下寫入有一定的延遲

安裝過程:

1、已經有mariadb的MS架構

2、安裝maxscale

? ?a、yum -y install maxscale-2.0.1-2.CentOS.6.x86_64.rpm

? ?b、添加用戶useradd maxscale

? ?c、添加從主庫拷貝過來的binlog目錄,并授權為maxscale

? ?d、配置文件vim /etc/maxscale.cnf

[maxscale]

threads=16 ?##根據CPU的物理核數來確定


[Replication]

type=service

router=binlogrouter

user=dlan ?

password=root123 ?#作為MAXSCALE的登錄用戶及maxscale同步主庫的binlog日志

router_options=server_id=15575308,heartbeat=30,binlogdir=/home/maxscale,transaction_safety=1,mariadb10-compatibility=1,send_slave_heartbeat=1

[Replication Listener]

type=listener

service=Replication

protocol=MySQLClient

port=5308

[CLI]

type=service

router=cli

[CLI Listener]

type=listener

service=CLI

protocol=maxscaled

port=6603

[MaxAdmin Service]

type=service

router=cli

[MaxAdmin Listener]

type=listener

service=MaxAdmin Service

protocol=maxscaled

port=336677

##部分參數介紹

# server_id設置maxscale的,記得不能與主和從庫重復,要唯一


# ?heartbeat=30秒,意思為當maxscale在30秒內沒有接收到主庫推送的binlog日志,發送心跳檢查


# ?binlogdir設置接收binlog的存放路徑,目錄屬性chown -R maxscale.maxscale ?/data/binlog


# transaction_safety=1此參數用于啟用binlog日志中的不完整事務檢測。 ?當MariaDB MaxScale啟動時,如果當前binlog文件已損壞或找到不完整的事務,則可能會出現錯誤消息。 ?在正常工作期間,binlog事件不會分配到從庫,直到事務已經提交。 默認值為off,設置transaction_safety = on以啟用不完全事務檢測。


# ?send_slave_heartbeat=1開啟心跳檢查

3、在maxscale服務器上執行收集BINLOG信息,確保在主庫上已經存在用戶dlan的信息,不存在添加用戶

mysql -udlan -proot123 -h192.168.1.251 -P5308

CHANGE MASTER TO MASTER_HOST='192.168.15.104',MASTER_USER='dlan',MASTER_PASSWORD='root123',MASTER_PORT=3306,MASTER_LOG_FILE='mysql-bin.000005',MASTER_LOG_POS=4;

mysql> start slave ;

Query OK, 0 rows affected (0.00 sec)


mysql> show slave status\G;

*************************** 1. row ***************************

? ? ? ? ? ? ? ?Slave_IO_State: Binlog Dump

? ? ? ? ? ? ? ? ? Master_Host: 192.168.15.104

? ? ? ? ? ? ? ? ? Master_User: dlan

? ? ? ? ? ? ? ? ? Master_Port: 3306

? ? ? ? ? ? ? ? Connect_Retry: 60

? ? ? ? ? ? ? Master_Log_File: mysql-bin.000005

? ? ? ? ? Read_Master_Log_Pos: 10851096

? ? ? ? ? ? ? ?Relay_Log_File: mysql-bin.000005

? ? ? ? ? ? ? ? Relay_Log_Pos: 10823989

? ? ? ? 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: 10823989

? ? ? ? ? ? ? Relay_Log_Space: 10823989

? ? ? ? ? ? ? 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: 0

Master_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: 221023306

? ? ? ? ? ? ? ? ? Master_UUID: 452ee7b4-bb7e-11e6-97da-f04da23ed470

? ? ? ? ? ? ?Master_Info_File: /home/maxscale/master.ini

? ? ? ? ? ? ? ? ? ? SQL_Delay: 0

? ? ? ? ? SQL_Remaining_Delay: NULL

? ? ? Slave_SQL_Running_State: Slave running

? ? ? ? ? ?Master_Retry_Count: 1000

? ? ? ? ? ? ? ? ? Master_Bind:?

? ? ? Last_IO_Error_TimeStamp:?

? ? ?Last_SQL_Error_Timestamp:?

? ? ? ? ? ? ? ?Master_SSL_Crl:?

? ? ? ? ? ?Master_SSL_Crlpath:?

? ? ? ? ? ?Retrieved_Gtid_Set:?

? ? ? ? ? ? Executed_Gtid_Set:?

? ? ? ? ? ? ? ? Auto_Position:?

1 row in set (0.02 sec)

#同時在本地文件配置的收集BINLOG目錄可以看到當前從主庫收集過來的BINLOG日志及同步用戶的信息

4、配置從庫同步數據從MAXSCALE服務器獲取,這里的master_log_file master_log_pos使用全備后的文件記錄的信息,和MX同步的MASTER_LOG_FILE當前FILE不沖突

CHANGE MASTER TO MASTER_HOST='192.168.15.57',MASTER_USER='dlan',MASTER_PASSWORD='root123',MASTER_PORT=5308,MASTER_LOG_FILE='mysql-bin.000005', MASTER_LOG_POS=168680168;




###測試過程:

?1、主庫寫入100W數據,到MX也有一定的延遲。

?


轉載于:https://blog.51cto.com/dbaspace/1880012

總結

以上是生活随笔為你收集整理的MaxScale Binlog Server的全部內容,希望文章能夠幫你解決所遇到的問題。

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