91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL中搭建ProxySQL Cluster的詳細步驟

發布時間:2020-06-03 17:18:01 來源:網絡 閱讀:1005 作者:三月 欄目:MySQL數據庫

下文給大家帶來關于MySQL中搭建ProxySQL Cluster的詳細步驟,感興趣的話就一起來看看這篇文章吧,相信看完MySQL中搭建ProxySQL Cluster的詳細步驟對大家多少有點幫助吧。

環境:

實例名版本IP系統備注
ProxySQL 11.4.6208CentOS7最初啟動
ProxySQL 21.4.6209CentOS7最初啟動
ProxySQL 31.4.6210Debian9后面加入

搭建:

集群的搭建有很多種方式,如1+1+1的方式,還可以(1+1)+1的方式。

這里采用較簡單的(1+1)+1,即先將兩個節點作為集群啟動,然后其他節點選擇性加入的方式

1.更改所有實例的配置文件:

vim /etc/proxysql.cnf

# 需要更改的部分
admin_variables=
{
        admin_credentials="admin:admin;cluster_20X:123456"       #配置用于實例間通訊的賬號
#       mysql_ifaces="127.0.0.1:6032;/tmp/proxysql_admin.sock"
        mysql_ifaces="0.0.0.0:6032"                            #全網開放登錄
#       refresh_interval=2000
#       debug=true
        cluster_username="cluster_20X"                         #集群用戶名稱,與最上面的相同
        cluster_password="123456"                              #集群用戶密碼,與最上面的相同
        cluster_check_interval_ms=200                       
        cluster_check_status_frequency=100
        cluster_mysql_query_rules_save_to_disk=true
        cluster_mysql_servers_save_to_disk=true
        cluster_mysql_users_save_to_disk=true
        cluster_proxysql_servers_save_to_disk=true
        cluster_mysql_query_rules_diffs_before_sync=3
        cluster_mysql_servers_diffs_before_sync=3
        cluster_mysql_users_diffs_before_sync=3
        cluster_proxysql_servers_diffs_before_sync=3
}
proxysql_servers =                                          #在這個部分提前定義好集群的成員
(
        {
                hostname="192.168.1.208"
                port=6032
                comment="primary"                           #注釋
        },
        {
                hostname="192.168.1.209"
                port=6032
                comment="secondary"
        },
        {
                hostname="192.168.1.210"
                host=6032
                comment="secondary"
        }
)
2.啟動208和209實例:

systemctl start proxysql

3.觀察集群狀況:
mysql> select * from proxysql_servers;
+---------------+------+--------+-----------+
| hostname      | port | weight | comment   |
+---------------+------+--------+-----------+
| 192.168.1.208 | 6032 | 0      | primary   |
| 192.168.1.209 | 6032 | 0      | secondary |
+---------------+------+--------+-----------+
2 rows in set (0.00 sec)
mysql> select * from   stats_proxysql_servers_metrics;
+---------------+------+--------+-----------+------------------+----------+---------------+---------+------------------------------+----------------------------+
| hostname      | port | weight | comment   | response_time_ms | Uptime_s | last_check_ms | Queries | Client_Connections_connected | Client_Connections_created |
+---------------+------+--------+-----------+------------------+----------+---------------+---------+------------------------------+----------------------------+
| 192.168.1.209 | 6032 | 0      | secondary | 0                | 670769   | 11027         | 0       | 0                            | 0                          |
| 192.168.1.208 | 6032 | 0      | primary   | 0                | 702316   | 1169          | 5       | 0                            | 1                          |
+---------------+------+--------+-----------+------------------+----------+---------------+---------+------------------------------+----------------------------+
4.觀察ProxySQL集群中實例之間的數據同步:
#原有數據
mysql> select * from mysql_servers;
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname      | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 7            | 192.168.1.181 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 10           | 192.168.1.182 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 8            | 192.168.1.180 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
3 rows in set (0.00 sec)
#在209上插入一條數據:
mysql> insert into mysql_servers(hostgroup_id,hostname,port,comment) values (20,'192.168.1.120',3306,'zabbix');
# 持久化,并加載到運行環境中
mysql> save mysql servers to disk; 
mysql> load mysql servers to runtime;  
# 觀察208實例的數據:
mysql> select * from mysql_servers;
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname      | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 7            | 192.168.1.181 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 20           | 192.168.1.120 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              | zabbix  |
| 10           | 192.168.1.182 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 8            | 192.168.1.180 | 3306 | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
4 rows in set (0.00 sec)
mysql> select * from runtime_mysql_servers;
+--------------+---------------+------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname      | port | status  | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 7            | 192.168.1.181 | 3306 | ONLINE  | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 8            | 192.168.1.180 | 3306 | ONLINE  | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 10           | 192.168.1.182 | 3306 | ONLINE  | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 20           | 192.168.1.120 | 3306 | SHUNNED | 1      | 0           | 1000            | 0                   | 0       | 0              | zabbix  |
+--------------+---------------+------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
4 rows in set (0.00 sec)

# 可以看到新插入的數據,已經被更新到208實例中的memory和runtime環境中。
# 注意:數據差異檢查是根據runtime進行檢查的,只對memory和disk進行更改,并不觸發同步操作。
5.查看208實例的ProxySQL日志
2018-04-16 19:10:21 [INFO] Cluster: detected a new checksum for mysql_servers from peer 192.168.1.209:6032, version 99434, epoch 1523986027, checksum 0x9AFEA97C6D622D69 . Not syncing yet ... #檢測到209實例傳來的新配置文件校驗值
2018-04-16 19:10:22 [INFO] Cluster: detected a peer 192.168.1.209:6032 with mysql_servers version 99434, epoch 1523986027, diff_check 3. Own version: 3, epoch: 1523876751. Proceeding with remote sync #根據傳來的配置校驗值,版本號,時間戳,與自己的版本進行比較,決定進行同步操作
2018-04-16 19:10:22 [INFO] Cluster: detected a peer 192.168.1.209:6032 with mysql_servers version 99434, epoch 1523986027, diff_check 4. Own version: 3, epoch: 1523876751. Proceeding with remote sync #根據傳來的配置校驗值,版本號,時間戳,與自己的版本進行比較,決定進行同步操作
2018-04-16 19:10:22 [INFO] Cluster: detected peer 192.168.1.209:6032 with mysql_servers version 99434, epoch 1523986027
2018-04-16 19:10:22 [INFO] Cluster: Fetching MySQL Servers from peer 192.168.1.209:6032 started. Expected checksum 0x9AFEA97C6D622D69
2018-04-16 19:10:22 [INFO] Cluster: Fetching MySQL Servers from peer 192.168.1.209:6032 completed      #從遠端獲取新的差異配置信息
2018-04-16 19:10:22 [INFO] Cluster: Fetching checksum for MySQL Servers from peer 192.168.1.209:6032 before proceessing 
2018-04-16 19:10:22 [INFO] Cluster: Fetching checksum for MySQL Servers from peer 192.168.1.209:6032 successful. Checksum: 0x9AFEA97C6D622D69 #獲取完信息后,本地進行校驗,并請求遠端校驗值進行比較
2018-04-16 19:10:22 [INFO] Cluster: Writing mysql_servers table #開始寫mysql_servers表
2018-04-16 19:10:22 [INFO] Cluster: Writing mysql_replication_hostgroups table
2018-04-16 19:10:22 [INFO] Cluster: Loading to runtime MySQL Servers from peer 192.168.1.209:6032   #將剛剛接收并保存到memory的配置加載到runtime環境中
2018-04-16 19:10:22 [INFO] Dumping current MySQL Servers structures for hostgroup ALL
HID: 7 , address: 192.168.1.181 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
HID: 10 , address: 192.168.1.182 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
HID: 8 , address: 192.168.1.180 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
2018-04-16 19:10:22 [INFO] Dumping mysql_servers #先輸出之前自己的配置信息
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
| hostgroup_id | hostname      | port | weight | status | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment | mem_pointer     |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
| 7            | 192.168.1.181 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140116687433856 |
| 8            | 192.168.1.180 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140116687434240 |
| 10           | 192.168.1.182 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140116687434112 |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
2018-04-16 19:10:22 [INFO] Dumping mysql_servers_incoming #再輸出一遍更新傳來的的配置信息
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname      | port | weight | status | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 7            | 192.168.1.181 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         |
| 20           | 192.168.1.120 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              | zabbix  |
| 10           | 192.168.1.182 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         |
| 8            | 192.168.1.180 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
2018-04-16 19:10:22 [INFO] New mysql_replication_hostgroups table
2018-04-16 19:10:22 [INFO] New mysql_group_replication_hostgroups table
2018-04-16 19:10:22 [INFO] Dumping current MySQL Servers structures for hostgroup ALL
HID: 7 , address: 192.168.1.181 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
HID: 20 , address: 192.168.1.120 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: zabbix
HID: 10 , address: 192.168.1.182 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
HID: 8 , address: 192.168.1.180 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
2018-04-16 19:10:22 [INFO] Dumping mysql_servers #最后輸出一遍自己更新后的信息
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
| hostgroup_id | hostname      | port | weight | status | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment | mem_pointer     |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
| 7            | 192.168.1.181 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140116687433856 |
| 8            | 192.168.1.180 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140116687434240 |
| 10           | 192.168.1.182 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140116687434112 |
| 20           | 192.168.1.120 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              | zabbix  | 140116687433984 |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
2018-04-16 19:10:22 [INFO] Cluster: Saving to disk MySQL Servers from peer 192.168.1.209:6032 #經過設置的時間后,自動保存到disk環境中
2018-04-16 19:10:22 [INFO] Cluster: detected a new checksum for mysql_servers from peer 192.168.1.208:6032, version 4, epoch 1523877022, checksum 0x9AFEA97C6D622D69 . Not syncing yet ...
2018-04-16 19:10:22 [INFO] Cluster: checksum for mysql_servers from peer 192.168.1.208:6032 matches with local checksum 0x9AFEA97C6D622D69 , we won't sync.
2018-04-16 19:10:24 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-16 19:10:34 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
6.加入210節點:

210為全新的節點,我們嘗試不使用conf文件啟動,而使用更改global_variable的方式加入集群。

# 更改管理端口的驗證信息
mysql> update global_variables set variable_value="admin:admin;cluster_20X:123456" where variable_name ='admin-admin_credentials'; 
mysql> update global_variables set variable_value="cluster_20X" where variable_name ='admin-cluster_username';
mysql> update global_variables set variable_value="123456" where variable_name ='admin-cluster_password';
# 插入ProxySQL實例信息
mysql> insert into proxysql_servers(hostname,port) values('192.168.1.208',6032),('192.168.1.209',6032),('192.168.1.210',6032);
# 將更改的信息載入runtime環境
mysql >load admin variables to runtime;
mysql >load proxysql servers to runtime;

觀察日志:

Standard Query Processor rev. 0.2.0902 -- Query_Processor.cpp -- Thu Feb  1 02:57:56 2018
In memory Standard Query Cache (SQC) rev. 1.2.0905 -- Query_Cache.cpp -- Thu Feb  1 02:57:56 2018
Standard MySQL Monitor (StdMyMon) rev. 1.2.0723 -- MySQL_Monitor.cpp -- Thu Feb  1 02:57:56 2018
2018-04-17 22:40:55 [INFO] Received load admin variables to runtime command
2018-04-17 22:44:19 [INFO] Received load proxysql servers to runtime command
2018-04-17 22:44:19 [INFO] Created new Cluster Node Entry for host 192.168.1.208:6032 #
2018-04-17 22:44:19 [INFO] Created new Cluster Node Entry for host 192.168.1.209:6032 #
2018-04-17 22:44:19 [INFO] Created new Cluster Node Entry for host 192.168.1.210:6032 #為其他實例開啟自身入口
2018-04-17 22:44:19 [INFO] Cluster: starting thread for peer 192.168.1.210:6032 #
2018-04-17 22:44:19 [INFO] Cluster: starting thread for peer 192.168.1.209:6032 #
2018-04-17 22:44:19 [INFO] Cluster: starting thread for peer 192.168.1.208:6032 # 為其他實例連入創建線程
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_query_rules from peer 192.168.1.210:6032, version 1, epoch 1523975806, checksum 0x0000000000000000 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: checksum for mysql_query_rules from peer 192.168.1.210:6032 matches with local checksum 0x0000000000000000 , we won't sync.
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_servers from peer 192.168.1.210:6032, version 1, epoch 1523975806, checksum 0x0000000000000000 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: checksum for mysql_servers from peer 192.168.1.210:6032 matches with local checksum 0x0000000000000000 , we won't sync.
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_users from peer 192.168.1.210:6032, version 1, epoch 1523975806, checksum 0x0000000000000000 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: checksum for mysql_users from peer 192.168.1.210:6032 matches with local checksum 0x0000000000000000 , we won't sync.
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for proxysql_servers from peer 192.168.1.210:6032, version 2, epoch 1523976259, checksum 0x42904D5D92E2A8FE . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: checksum for proxysql_servers from peer 192.168.1.210:6032 matches with local checksum 0x42904D5D92E2A8FE , we won't sync.
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_query_rules from peer 192.168.1.209:6032, version 1, epoch 1523173084, checksum 0x0000000000000000 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: checksum for mysql_query_rules from peer 192.168.1.209:6032 matches with local checksum 0x0000000000000000 , we won't sync.
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_servers from peer 192.168.1.209:6032, version 99434, epoch 1523986027, checksum 0x9AFEA97C6D622D69 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_users from peer 192.168.1.209:6032, version 2, epoch 1523174009, checksum 0x8EEF803C41343944 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for proxysql_servers from peer 192.168.1.209:6032, version 1, epoch 1523173084, checksum 0xDF7CA570731DA09D . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_query_rules from peer 192.168.1.208:6032, version 1, epoch 1523876494, checksum 0x0000000000000000 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: checksum for mysql_query_rules from peer 192.168.1.208:6032 matches with local checksum 0x0000000000000000 , we won't sync.
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_servers from peer 192.168.1.208:6032, version 4, epoch 1523877022, checksum 0x9AFEA97C6D622D69 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for mysql_users from peer 192.168.1.208:6032, version 2, epoch 1523876495, checksum 0x8EEF803C41343944 . Not syncing yet ...
2018-04-17 22:44:19 [INFO] Cluster: detected a new checksum for proxysql_servers from peer 192.168.1.208:6032, version 1, epoch 1523876494, checksum 0xDF7CA570731DA09D . Not syncing yet ...
2018-04-17 22:44:21 [INFO] Cluster: detected a peer 192.168.1.209:6032 with mysql_servers version 99434, epoch 1523986027, diff_check 3. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:21 [INFO] Cluster: detected a peer 192.168.1.209:6032 with mysql_users version 2, epoch 1523174009, diff_check 3. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:21 [INFO] Cluster: detected a peer 192.168.1.208:6032 with mysql_servers version 4, epoch 1523877022, diff_check 3. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:21 [INFO] Cluster: detected a peer 192.168.1.208:6032 with mysql_users version 2, epoch 1523876495, diff_check 3. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:22 [INFO] Cluster: detected a peer 192.168.1.209:6032 with mysql_servers version 99434, epoch 1523986027, diff_check 4. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:22 [INFO] Cluster: detected peer 192.168.1.209:6032 with mysql_servers version 99434, epoch 1523986027
2018-04-17 22:44:22 [INFO] Cluster: Fetching MySQL Servers from peer 192.168.1.209:6032 started. Expected checksum 0x9AFEA97C6D622D69
2018-04-17 22:44:22 [INFO] Cluster: Fetching MySQL Servers from peer 192.168.1.209:6032 completed
2018-04-17 22:44:22 [INFO] Cluster: Fetching checksum for MySQL Servers from peer 192.168.1.209:6032 before proceessing
2018-04-17 22:44:22 [INFO] Cluster: Fetching checksum for MySQL Servers from peer 192.168.1.209:6032 successful. Checksum: 0x9AFEA97C6D622D69
2018-04-17 22:44:22 [INFO] Cluster: Writing mysql_servers table
2018-04-17 22:44:22 [INFO] Cluster: Writing mysql_replication_hostgroups table
2018-04-17 22:44:22 [INFO] Cluster: Loading to runtime MySQL Servers from peer 192.168.1.209:6032
2018-04-17 22:44:22 [INFO] Dumping current MySQL Servers structures for hostgroup ALL
2018-04-17 22:44:22 [INFO] Dumping mysql_servers
+--------------+----------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-------------+
| hostgroup_id | hostname | port | weight | status | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment | mem_pointer |
+--------------+----------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-------------+
+--------------+----------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-------------+
2018-04-17 22:44:22 [INFO] Dumping mysql_servers_incoming
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname      | port | weight | status | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 7            | 192.168.1.181 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         |
| 20           | 192.168.1.120 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              | zabbix  |
| 10           | 192.168.1.182 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         |
| 8            | 192.168.1.180 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
2018-04-17 22:44:22 [INFO] New mysql_replication_hostgroups table
2018-04-17 22:44:22 [INFO] New mysql_group_replication_hostgroups table
2018-04-17 22:44:22 [INFO] Dumping current MySQL Servers structures for hostgroup ALL
HID: 7 , address: 192.168.1.181 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
HID: 20 , address: 192.168.1.120 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: zabbix
HID: 10 , address: 192.168.1.182 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
HID: 8 , address: 192.168.1.180 , port: 3306 , weight: 1 , status: ONLINE , max_connections: 1000 , max_replication_lag: 0 , use_ssl: 0 , max_latency_ms: 0 , comment: 
2018-04-17 22:44:22 [INFO] Dumping mysql_servers
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
| hostgroup_id | hostname      | port | weight | status | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment | mem_pointer     |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
| 7            | 192.168.1.181 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140641893576576 |
| 8            | 192.168.1.180 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140641893867776 |
| 10           | 192.168.1.182 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              |         | 140641893867648 |
| 20           | 192.168.1.120 | 3306 | 1      | 0      | 0           | 1000            | 0                   | 0       | 0              | zabbix  | 140641893867520 |
+--------------+---------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+-----------------+
2018-04-17 22:44:22 [INFO] Cluster: Saving to disk MySQL Servers from peer 192.168.1.209:6032
2018-04-17 22:44:22 [INFO] Cluster: detected a peer 192.168.1.209:6032 with mysql_users version 2, epoch 1523174009, diff_check 4. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:22 ProxySQL_Cluster.cpp:1268:get_peer_to_sync_mysql_users(): [WARNING] Cluster: detected a peer with mysql_users epoch 1523876495 , but not enough diff_check. We won't sync from epoch 1523174009: temporarily skipping sync
2018-04-17 22:44:22 [INFO] Cluster: detected a peer 192.168.1.208:6032 with mysql_users version 2, epoch 1523876495, diff_check 4. Own version: 1, epoch: 1523975806. Proceeding with remote sync
2018-04-17 22:44:22 [INFO] Cluster: detected peer 192.168.1.208:6032 with mysql_users version 2, epoch 1523876495
2018-04-17 22:44:22 [INFO] Cluster: Fetching MySQL Users from peer 192.168.1.208:6032 started
2018-04-17 22:44:22 [INFO] Cluster: Fetching MySQL Users from peer 192.168.1.208:6032 completed
2018-04-17 22:44:22 [INFO] Cluster: Loading to runtime MySQL Users from peer 192.168.1.208:6032
2018-04-17 22:44:22 [INFO] Cluster: Saving to disk MySQL Query Rules from peer 192.168.1.208:6032
2018-04-17 22:44:23 [INFO] Cluster: detected a new checksum for mysql_servers from peer 192.168.1.210:6032, version 2, epoch 1523976262, checksum 0x9AFEA97C6D622D69 . Not syncing yet ...
2018-04-17 22:44:23 [INFO] Cluster: checksum for mysql_servers from peer 192.168.1.210:6032 matches with local checksum 0x9AFEA97C6D622D69 , we won't sync.
2018-04-17 22:44:23 [INFO] Cluster: detected a new checksum for mysql_users from peer 192.168.1.210:6032, version 2, epoch 1523976262, checksum 0x8EEF803C41343944 . Not syncing yet ...
2018-04-17 22:44:23 [INFO] Cluster: checksum for mysql_users from peer 192.168.1.210:6032 matches with local checksum 0x8EEF803C41343944 , we won't sync.
2018-04-17 22:44:48 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.208:6032 with proxysql_servers version 1, epoch 1523876494, diff_check 30. Own version: 2, epoch: 1523976259. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-17 22:44:48 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with proxysql_servers version 1, epoch 1523173084, diff_check 30. Own version: 2, epoch: 1523976259. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-17 22:44:56 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:45:06 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:45:16 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:45:18 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.208:6032 with proxysql_servers version 1, epoch 1523876494, diff_check 60. Own version: 2, epoch: 1523976259. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-17 22:45:18 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with proxysql_servers version 1, epoch 1523173084, diff_check 60. Own version: 2, epoch: 1523976259. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-17 22:45:26 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:45:36 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:45:46 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:45:48 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.208:6032 with proxysql_servers version 1, epoch 1523876494, diff_check 90. Own version: 2, epoch: 1523976259. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-17 22:45:48 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with proxysql_servers version 1, epoch 1523173084, diff_check 90. Own version: 2, epoch: 1523976259. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-17 22:45:56 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
2018-04-17 22:46:06 MySQL_Monitor.cpp:1370:monitor_ping(): [ERROR] Server 192.168.1.120:3306 missed 3 heartbeats, shunning it and killing all the connections
大致信息即為接收并更新自己的配置文件,但有一點出現了問題,我在210上插入了三條信息(208.209,210),但在之前208和209在達成共識后,將210的proxysql_server信息踢出了表中(只有208,209,沒有210)。導致從現有集群中獲取的proxysql_server信息與自身的不符,且自身的信息版本(時間戳)高于集群中的信息。需要手動LOAD PROXYSQL SERVERS TO RUNTIME,然后在208或者209上重新加上210的信息上,同步到整個集群中,210實例方能排除數據沖突,真正的與208,209組成的集群保持同步。

疑難解答:

1.新加入的節點在已經有和主節點配置不同時,主節點日志輸出如下:
Sun Apr  8 10:06:37 CST 2018 ###### TRYING TO FIX MISSING WRITERS ######
Sun Apr  8 10:06:37 CST 2018 ###### TRYING TO FIX MISSING READERS ######
2018-04-08 10:06:38 ProxySQL_Cluster.cpp:488:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with mysql_query_rules version 1, epoch 1523107592, diff_check 60. Own version: 9, epoch: 1523005649. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD MYSQL QUERY RULES TO RUNTIME is executed on candidate master.
2018-04-08 10:06:38 ProxySQL_Cluster.cpp:509:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with mysql_servers version 1, epoch 1523107592, diff_check 60. Own version: 85814, epoch: 1523153195. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD MYSQL SERVERS TO RUNTIME is executed on candidate master.
2018-04-08 10:06:38 ProxySQL_Cluster.cpp:530:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with mysql_users version 1, epoch 1523107592, diff_check 60. Own version: 9, epoch: 1523110710. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD MYSQL USERS TO RUNTIME is executed on candidate master.
2018-04-08 10:06:38 ProxySQL_Cluster.cpp:551:set_checksums(): [WARNING] Cluster: detected a peer 192.168.1.209:6032 with proxysql_servers version 1, epoch 1523107592, diff_check 60. Own version: 3, epoch: 1523077120. diff_check is increasing, but version 1 doesn't allow sync. This message will be repeated every 30 checks until LOAD PROXYSQL SERVERS TO RUNTIME is executed on candidate master.
Sun Apr  8 10:06:40 CST 2018 ###### TRYING TO FIX MISSING WRITERS ######
Sun Apr  8 10:06:40 CST 2018 ###### TRYING TO FIX MISSING READERS ######

這種情況要求我們強制覆蓋一端的數據。不建議手動在控制臺進行load或者save等操作進行覆蓋,最好將一個實例的配置手動更新至最全的版本,然后刪除另一個ProxySQL的proxysql.db配置文件,并在conf文件中寫定集群信息。啟動后,缺失proxysql.db的實例,會自動下載集群中的配置信息,并生成新的proxysql.db。

2.因為密碼間隔用的‘,’導致日志中輸出無法登錄的情況
2018-04-08 09:40:10 ProxySQL_Cluster.cpp:180:ProxySQL_Cluster_Monitor_thread(): [WARNING] Cluster: unable to connect to peer 192.168.1.208:6032 . Error: ProxySQL Error: Access denied for user 'cluster'@'' (using password: YES)
2018-04-08 09:40:11 ProxySQL_Cluster.cpp:180:ProxySQL_Cluster_Monitor_thread(): [WARNING] Cluster: unable to connect to peer 192.168.1.209:6032 . Error: ProxySQL Error: Access denied for user 'cluster'@'' (using password: YES)
2018-04-08 09:40:11 ProxySQL_Cluster.cpp:180:ProxySQL_Cluster_Monitor_thread(): [WARNING] Cluster: unable to connect to peer 192.168.1.208:6032 . Error: ProxySQL Error: Access denied for user 'cluster'@'' (using password: YES)
ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin'@'' (using password: YES)
ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin'@'' (using password: YES)
ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin'@'' (using password: YES)
ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin'@'' (using password: YES)

將admin_credentials="admin:admin,cluster_20X:123456"中間隔兩個賬戶和密碼對的‘,’改成’;‘

看了以上關于MySQL中搭建ProxySQL Cluster的詳細步驟詳細內容,是否有所收獲。如果想要了解更多相關,可以繼續關注我們的行業資訊板塊。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

金堂县| 淮北市| 肇庆市| 南汇区| 黎平县| 苍梧县| 兴文县| 德令哈市| 游戏| 长垣县| 桦南县| 永济市| 夹江县| 漳平市| 山阳县| 南昌市| 靖远县| 宾阳县| 吴忠市| 河北省| 扬州市| 连江县| 琼海市| 城固县| 改则县| 志丹县| 黔西县| 德庆县| 弋阳县| 芮城县| 红桥区| 阿坝| 夹江县| 建德市| 保亭| 报价| 临夏县| 兴义市| 晋城| 息烽县| 海安县|