proxysql cluster 的搭建
文章转载自:https://blog.51cto.com/lee90/2298804
官方文档: https://proxysql.com/blog/proxysql-cluster
环境架构

在一主两从的MySQL主机上各安装一个proxysql
MySQL环境
主库 172.100.2.13
从库1 172.100.2.11
从库2 172.100.2.14
proxysql节点
172.100.2.13
172.100.2.11
172.100.2.14
具体操作步骤
在主库 172.100.2.13 上执行添加账号的操作
# 添加一个监控用账号(能监控到从库的复制情况) ,在这里要么主从库自带的mysql库需要同步,若是没同步则每个MySQL都需要做这一步操作
GRANT USAGE,process,replication slave,replication client ON *.* TO 'proxysql'@'172.100.%.%' IDENTIFIED BY 'proxysql';
# 注意:这里的账号密码要和下面我们在proxysql里面的mysql_variables段的账号密码配置的一样
# 添加一个程序连接用的账号
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'sbuser'@'172.100.%.%' identified by 'sbuser';
在3台proxysql机器上,执行如下的操作
修改 /etc/proxysql.cnf (修改了admin_variables段、proxysql_servers段、mysql_variables段)
datadir="/var/lib/proxysql"
admin_variables =
{
admin_credentials="admin:admin;cluster_demo:123456"
mysql_ifaces="0.0.0.0:6032"
cluster_username="cluster_demo"
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="172.100.2.11"
port=6032
comment="proxysql11"
},
{
hostname="172.100.2.13"
port=6032
comment="proxysql13"
},
{
hostname="172.100.2.14"
port=6032
comment="proxysql14"
}
)
mysql_variables=
{
threads=4
max_connections=2048
default_query_delay=0
default_query_timeout=36000000
have_compress=true
poll_timeout=2000
# interfaces="0.0.0.0:6033;/tmp/proxysql.sock"
interfaces="0.0.0.0:6033"
default_schema="information_schema"
stacksize=1048576
server_version="5.7.22"
connect_timeout_server=3000
# make sure to configure monitor username and password
# https://github.com/sysown/proxysql/wiki/Global-variables#mysql-monitor_username-mysql-monitor_password
monitor_username="proxysql"
monitor_password="proxysql"
monitor_history=600000
monitor_connect_interval=60000
monitor_ping_interval=10000
monitor_read_only_interval=1500
monitor_read_only_timeout=500
ping_interval_server_msec=120000
ping_timeout_server=500
commands_stats=true
sessions_sort=true
connect_retries_on_failure=10
}
# 启动proxysql进程
systemctl start proxysql
# 然后到3个节点上都确认下是否正常运行
admin@127.0.0.1:(none) 01:19:38>select * from runtime_proxysql_servers ;
+--------------+------+--------+------------+
| hostname | port | weight | comment |
+--------------+------+--------+------------+
| 172.100.2.14 | 6032 | 0 | proxysql14 |
| 172.100.2.13 | 6032 | 0 | proxysql13 |
| 172.100.2.11 | 6032 | 0 | proxysql11 |
+--------------+------+--------+------------+
# 3个节点都是这样的话,就可以做其他操作了。
添加后端mysql信息, 添加读写分离的路由规则
添加后端mysql信息
在3节点中的任意一台proyxql的admin控制台执行下面的这些操作(这个新增的配置会在load runtime时候,自动同步到集群其它节点) :
# 写节点组 100, 读节点组 1000
delete from mysql_servers ;
insert into mysql_servers(hostgroup_id,hostname,port,weight,max_connections,max_replication_lag,comment) values(100,'172.100.2.13',3306,1,1000,10,'test proxysql');
insert into mysql_servers(hostgroup_id,hostname,port,weight,max_connections,max_replication_lag,comment) values(1000,'172.100.2.11',3306,1,1000,10,'test proxysql');
insert into mysql_servers(hostgroup_id,hostname,port,weight,max_connections,max_replication_lag,comment) values(1000,'172.100.2.14',3306,1,1000,10,'test proxysql');
select * from mysql_servers;
# proxysql的核心都在规则,若是从节点关闭,proxysql还是想路由到 hostgroup=1000,它不会自动选择默认的100(mysql_users里配置的default_hostgroup) 。
# 这里解决的办法是:在mysql_servers的hostgroup 1000 里面要插一条主库的记录,然后把weight设小,当读不到从库,回去主库查询。
# 修改之前的从库的权限为9
update mysql_servers set weight=9 where hostgroup_id=100 and hostname='172.100.2.11' ;
update mysql_servers set weight=9 where hostgroup_id=100 and hostname='172.100.2.14' ;
# 插入一条记录,权重为1
insert into mysql_servers(hostgroup_id,hostname,port,weight,max_connections,max_replication_lag,comment) values(1000,'172.100.2.13',3306,1,1000,10,'test proxysql');
# 意思是: 读组里有三个节点,一主两从,但是节点权重不一样,从节点权重高,读请求优先给从节点,若从节点关机导致无法访问,此时会把读请求给权重较低的主节点
# 加载到runtime,并把配置持久化
load mysql servers to runtime;
save mysql servers to disk;
admin@127.0.0.1:(none) 02:31:37>select * from mysql_servers;
+--------------+--------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------------+
| 100 | 172.100.2.11 | 3306 | ONLINE | 9 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
| 100 | 172.100.2.14 | 3306 | ONLINE | 9 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
| 1000 | 172.100.2.13 | 3306 | ONLINE | 1 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
| 100 | 172.100.2.13 | 3306 | ONLINE | 1 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
+--------------+--------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------------+
4 rows in set (0.00 sec)
admin@127.0.0.1:(none) 02:31:40>select * from runtime_mysql_servers;
+--------------+--------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------------+
| 100 | 172.100.2.13 | 3306 | ONLINE | 1 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
| 1000 | 172.100.2.13 | 3306 | ONLINE | 1 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
| 100 | 172.100.2.14 | 3306 | ONLINE | 9 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
| 100 | 172.100.2.11 | 3306 | ONLINE | 9 | 0 | 1000 | 10 | 0 | 0 | test proxysql |
+--------------+--------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------------+
4 rows in set (0.00 sec)
# 添加一个账号,用于proxysql和后端主机的连接
insert into mysql_users(username,password,active,default_hostgroup,transaction_persistent) values('sbuser','sbuser',1,100,1);
# 一些其他的个性化参数设置,在这里再次设置下
set mysql-monitor_username='proxysql';
set mysql-monitor_password='proxysql';
set mysql-default_charset='utf8mb4';
set mysql-query_retries_on_failure=0;
set mysql-ping_timeout_server=500;
set mysql-monitor_connect_timeout=1000;
set mysql-default_max_latency_ms=2000;
set mysql-monitor_replication_lag_interval=500;
set mysql-ping_interval_server_msec=3000;
set mysql-monitor_ping_interval=5000;
set mysql-connect_timeout_server_max=3000;
# 加载到runtime,并把配置持久化
load mysql servers to runtime;
load mysql users to runtime;
load mysql variables to runtime;
save mysql servers to disk;
save mysql users to disk;
save mysql variables to disk;
定义读写分离的路由规则
# 定义sql规则,发送到写组
INSERT INTO mysql_query_rules(active,match_pattern,destination_hostgroup,apply) VALUES(1,'^SELECT.*FOR UPDATE$',100,1);
# 定义sql规则,发送到读组
INSERT INTO mysql_query_rules(active,match_pattern,destination_hostgroup,apply) VALUES(1,'^SELECT',1000,1);
# 加载路由规则到runtime,并把配置持久化
load mysql query rules to runtime;
save mysql query rules to disk;
# 然后,连接proxysql做crud的测试(可以测试下读写分离情况)
mysql -usbuser -psbuser -h 172.100.2.13 -P6033
后期还有新的机器需要加入proxysql集群中的方法
例如3台proxysql觉得性能不够用了,需要加一台新机器为 172.100.2.17 。 可以使用如下的方法:
修改 /etc/proxysql.cnf (修改了admin_variables段、proxysql_servers段、mysql_variables段) 【要和proxysql cluster里面的其他节点运行配置一样,集群名称、各种账号密码要一致】
datadir="/var/lib/proxysql"
admin_variables =
{
admin_credentials="admin:admin;cluster_demo:123456"
mysql_ifaces="0.0.0.0:6032"
cluster_username="cluster_demo"
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="172.100.2.11"
port=6032
comment="proxysql11"
},
{
hostname="172.100.2.13"
port=6032
comment="proxysql13"
},
{
hostname="172.100.2.14"
port=6032
comment="proxysql14"
}
)
mysql_variables=
{
threads=4
max_connections=2048
default_query_delay=0
default_query_timeout=36000000
have_compress=true
poll_timeout=2000
# interfaces="0.0.0.0:6033;/tmp/proxysql.sock"
interfaces="0.0.0.0:6033"
default_schema="information_schema"
stacksize=1048576
server_version="5.7.22"
connect_timeout_server=3000
# make sure to configure monitor username and password
# https://github.com/sysown/proxysql/wiki/Global-variables#mysql-monitor_username-mysql-monitor_password
monitor_username="proxysql"
monitor_password="proxysql"
monitor_history=600000
monitor_connect_interval=60000
monitor_ping_interval=10000
monitor_read_only_interval=1500
monitor_read_only_timeout=500
ping_interval_server_msec=120000
ping_timeout_server=500
commands_stats=true
sessions_sort=true
connect_retries_on_failure=10
}
systemctl start proxysql
启动后, 可以看下 172.100.2.17 的 /var/lib/proxysql/proxysql.log 日志里面, 172.100.2.17 这个新加入的节点 会去其它节点拉取配置(但是其它节点不知道这个172.100.2.17到底是什么身份的存在)。
然后,我们在老的proxysql的任一节点上,将 172.100.2.17 这个新节点加入到集群环境:
Q: 为啥不能在172.100.2.17这个新节点执行下面的加到集群的命令?
A: 老群集的其余部分对新启动的172.100.2.17这个新节点一无所知,这也就意味着直接应用于172.100.2.17新节点的更改将不会复制到群集的其余部分。)
官方原话(https://proxysql.com/blog/proxysql-cluster-part2):
The fact that the rest of the cluster doesn't know anything about the new node means that changes applied directly to the new node won't be replicated to the rest of the cluster.
This creates a core cluster where nodes know about each other and synchronize from each other, and nodes that can only sync from the core cluster without affecting it. This is a big plus: only the core cluster can be the source of truth.
# 插入一条proxysql_server的信息
insert into proxysql_servers(hostname,port,comment ) values('172.100.2.17',6032,'bak proxysql') ;
# 加载到runtime,并把配置持久化
load proxysql servers to runtime;
save proxysql servers to disk;
# 查下结果是否正常
admin@127.0.0.1:(none) 01:33:45> select * from proxysql_servers ;
+--------------+------+--------+--------------+
| hostname | port | weight | comment |
+--------------+------+--------+--------------+
| 172.100.2.14 | 6032 | 0 | proxysql14 |
| 172.100.2.13 | 6032 | 0 | proxysql13 |
| 172.100.2.11 | 6032 | 0 | proxysql11 |
| 172.100.2.17 | 6032 | 0 | bak proxysql |
+--------------+------+--------+--------------+
4 rows in set (0.01 sec)
admin@127.0.0.1:(none) 01:33:49>select * from runtime_proxysql_servers ;
+--------------+------+--------+--------------+
| hostname | port | weight | comment |
+--------------+------+--------+--------------+
| 172.100.2.17 | 6032 | 0 | bak proxysql |
| 172.100.2.14 | 6032 | 0 | proxysql14 |
| 172.100.2.13 | 6032 | 0 | proxysql13 |
| 172.100.2.11 | 6032 | 0 | proxysql11 |
+--------------+------+--------+--------------+
# 看下集群proxysql_server集群的状态
admin@127.0.0.1:(none) 04:01:22> SELECT hostname, port, name, version, FROM_UNIXTIME(epoch) epoch, checksum, FROM_UNIXTIME(changed_at) changed_at, FROM_UNIXTIME(updated_at) updated_at, diff_check, DATETIME('NOW') FROM stats_proxysql_servers_checksums WHERE version > 0 ORDER BY hostname, name;
+--------------+------+-------------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
| hostname | port | name | version | epoch | checksum | changed_at | updated_at | diff_check | DATETIME('NOW') |
+--------------+------+-------------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
| 172.100.2.11 | 6032 | mysql_query_rules | 1 | 2018-10-11 07:27:26 | 0x883C0BB2C4FD83AA | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.11 | 6032 | mysql_servers | 1 | 2018-10-11 07:27:26 | 0x73399E62D70543AA | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.11 | 6032 | mysql_users | 3 | 2018-10-11 07:45:21 | 0x5C08D3C8E9D57E7B | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.11 | 6032 | proxysql_servers | 1 | 2018-10-11 07:27:26 | 0xEF3F04DA70472767 | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.13 | 6032 | mysql_query_rules | 4 | 2018-10-11 05:05:45 | 0x883C0BB2C4FD83AA | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.13 | 6032 | mysql_servers | 4 | 2018-10-11 06:31:24 | 0x73399E62D70543AA | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.13 | 6032 | mysql_users | 3 | 2018-10-11 03:03:11 | 0x5C08D3C8E9D57E7B | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.13 | 6032 | proxysql_servers | 6 | 2018-10-11 05:33:24 | 0xEF3F04DA70472767 | 2018-10-11 07:27:26 | 2018-10-11 08:01:23 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.14 | 6032 | mysql_query_rules | 1 | 2018-10-11 07:32:19 | 0x883C0BB2C4FD83AA | 2018-10-11 07:32:19 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.14 | 6032 | mysql_servers | 1 | 2018-10-11 07:32:19 | 0x73399E62D70543AA | 2018-10-11 07:32:19 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.14 | 6032 | mysql_users | 1 | 2018-10-11 07:32:19 | 0x5C08D3C8E9D57E7B | 2018-10-11 07:32:19 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.14 | 6032 | proxysql_servers | 1 | 2018-10-11 07:32:19 | 0xEF3F04DA70472767 | 2018-10-11 07:32:19 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.17 | 6032 | mysql_query_rules | 2 | 2018-10-11 05:30:41 | 0x883C0BB2C4FD83AA | 2018-10-11 07:27:26 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.17 | 6032 | mysql_servers | 3 | 2018-10-11 06:31:23 | 0x73399E62D70543AA | 2018-10-11 07:27:26 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.17 | 6032 | mysql_users | 2 | 2018-10-11 05:30:41 | 0x5C08D3C8E9D57E7B | 2018-10-11 07:27:26 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
| 172.100.2.17 | 6032 | proxysql_servers | 2 | 2018-10-11 05:33:24 | 0xEF3F04DA70472767 | 2018-10-11 07:27:26 | 2018-10-11 08:01:24 | 0 | 2018-10-11 08:01:24 |
+--------------+------+-------------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
16 rows in set (0.00 sec)
经过上面的步骤后, 172.100.2.17 就完成加集群的操作了。
其他一些tips
1.当群集处于活动状态时,proxysql会为每个活动模块的配置生成校验和。让我们连接到任何proxysql管理界面,并检查当前配置校验和:
admin@127.0.0.1:(none) 01:35:40>SELECT * FROM runtime_checksums_values ORDER BY name;
+-------------------+---------+------------+--------------------+
| name | version | epoch | checksum |
+-------------------+---------+------------+--------------------+
| admin_variables | 0 | 0 | |
| mysql_query_rules | 4 | 1539234345 | 0x883C0BB2C4FD83AA |
| mysql_servers | 3 | 1539226934 | 0xC19E3DC77E992B47 |
| mysql_users | 3 | 1539226934 | 0x5C08D3C8E9D57E7B |
| mysql_variables | 0 | 0 | |
| proxysql_servers | 7 | 1539236004 | 0xEF3F04DA70472767 |
+-------------------+---------+------------+--------------------+
# version为0, 表示没有这个类的数据没有改动过。
2.查看整个集群的状态
admin@127.0.0.1:(none) 01:35:46>SELECT * FROM stats_proxysql_servers_checksums;
+--------------+------+-------------------+---------+------------+--------------------+------------+------------+------------+
| hostname | port | name | version | epoch | checksum | changed_at | updated_at | diff_check |
+--------------+------+-------------------+---------+------------+--------------------+------------+------------+------------+
| 172.100.2.17 | 6032 | admin_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.17 | 6032 | mysql_query_rules | 2 | 1539235841 | 0x883C0BB2C4FD83AA | 1539236004 | 1539236272 | 0 |
| 172.100.2.17 | 6032 | mysql_servers | 2 | 1539235841 | 0xC19E3DC77E992B47 | 1539236004 | 1539236272 | 0 |
| 172.100.2.17 | 6032 | mysql_users | 2 | 1539235841 | 0x5C08D3C8E9D57E7B | 1539236004 | 1539236272 | 0 |
| 172.100.2.17 | 6032 | mysql_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.17 | 6032 | proxysql_servers | 2 | 1539236004 | 0xEF3F04DA70472767 | 1539236004 | 1539236272 | 0 |
| 172.100.2.14 | 6032 | admin_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.14 | 6032 | mysql_query_rules | 4 | 1539234345 | 0x883C0BB2C4FD83AA | 1539234346 | 1539236272 | 0 |
| 172.100.2.14 | 6032 | mysql_servers | 3 | 1539226934 | 0xC19E3DC77E992B47 | 1539226713 | 1539236272 | 0 |
| 172.100.2.14 | 6032 | mysql_users | 3 | 1539226934 | 0x5C08D3C8E9D57E7B | 1539226713 | 1539236272 | 0 |
| 172.100.2.14 | 6032 | mysql_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.14 | 6032 | proxysql_servers | 7 | 1539236004 | 0xEF3F04DA70472767 | 1539236004 | 1539236272 | 0 |
| 172.100.2.13 | 6032 | admin_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.13 | 6032 | mysql_query_rules | 4 | 1539234345 | 0x883C0BB2C4FD83AA | 1539234346 | 1539236272 | 0 |
| 172.100.2.13 | 6032 | mysql_servers | 3 | 1539226991 | 0xC19E3DC77E992B47 | 1539226714 | 1539236272 | 0 |
| 172.100.2.13 | 6032 | mysql_users | 3 | 1539226991 | 0x5C08D3C8E9D57E7B | 1539226714 | 1539236272 | 0 |
| 172.100.2.13 | 6032 | mysql_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.13 | 6032 | proxysql_servers | 6 | 1539236004 | 0xEF3F04DA70472767 | 1539236004 | 1539236272 | 0 |
| 172.100.2.11 | 6032 | admin_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.11 | 6032 | mysql_query_rules | 4 | 1539234345 | 0x883C0BB2C4FD83AA | 1539234345 | 1539236272 | 0 |
| 172.100.2.11 | 6032 | mysql_servers | 3 | 1539226994 | 0xC19E3DC77E992B47 | 1539226714 | 1539236272 | 0 |
| 172.100.2.11 | 6032 | mysql_users | 3 | 1539226994 | 0x5C08D3C8E9D57E7B | 1539226714 | 1539236272 | 0 |
| 172.100.2.11 | 6032 | mysql_variables | 0 | 0 | | 0 | 1539236272 | 0 |
| 172.100.2.11 | 6032 | proxysql_servers | 6 | 1539236003 | 0xEF3F04DA70472767 | 1539236003 | 1539236272 | 0 |
+--------------+------+-------------------+---------+------------+--------------------+------------+------------+------------+
24 rows in set (0.00 sec)
admin@127.0.0.1:(none) 01:40:02>SELECT hostname, port, name, version, FROM_UNIXTIME(epoch) epoch, checksum, FROM_UNIXTIME(changed_at) changed_at, FROM_UNIXTIME(updated_at) updated_at, diff_check, DATETIME('NOW') FROM stats_proxysql_servers_checksums WHERE version > 0 ORDER BY hostname, name;
+--------------+------+-------------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
| hostname | port | name | version | epoch | checksum | changed_at | updated_at | diff_check | DATETIME('NOW') |
+--------------+------+-------------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
| 172.100.2.11 | 6032 | mysql_query_rules | 4 | 2018-10-11 05:05:45 | 0x883C0BB2C4FD83AA | 2018-10-11 05:05:45 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.11 | 6032 | mysql_servers | 3 | 2018-10-11 03:03:14 | 0xC19E3DC77E992B47 | 2018-10-11 02:58:34 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.11 | 6032 | mysql_users | 3 | 2018-10-11 03:03:14 | 0x5C08D3C8E9D57E7B | 2018-10-11 02:58:34 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.11 | 6032 | proxysql_servers | 6 | 2018-10-11 05:33:23 | 0xEF3F04DA70472767 | 2018-10-11 05:33:23 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.13 | 6032 | mysql_query_rules | 4 | 2018-10-11 05:05:45 | 0x883C0BB2C4FD83AA | 2018-10-11 05:05:46 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.13 | 6032 | mysql_servers | 3 | 2018-10-11 03:03:11 | 0xC19E3DC77E992B47 | 2018-10-11 02:58:34 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.13 | 6032 | mysql_users | 3 | 2018-10-11 03:03:11 | 0x5C08D3C8E9D57E7B | 2018-10-11 02:58:34 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.13 | 6032 | proxysql_servers | 6 | 2018-10-11 05:33:24 | 0xEF3F04DA70472767 | 2018-10-11 05:33:24 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.14 | 6032 | mysql_query_rules | 4 | 2018-10-11 05:05:45 | 0x883C0BB2C4FD83AA | 2018-10-11 05:05:46 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.14 | 6032 | mysql_servers | 3 | 2018-10-11 03:02:14 | 0xC19E3DC77E992B47 | 2018-10-11 02:58:33 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.14 | 6032 | mysql_users | 3 | 2018-10-11 03:02:14 | 0x5C08D3C8E9D57E7B | 2018-10-11 02:58:33 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.14 | 6032 | proxysql_servers | 7 | 2018-10-11 05:33:24 | 0xEF3F04DA70472767 | 2018-10-11 05:33:24 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.17 | 6032 | mysql_query_rules | 2 | 2018-10-11 05:30:41 | 0x883C0BB2C4FD83AA | 2018-10-11 05:33:24 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.17 | 6032 | mysql_servers | 2 | 2018-10-11 05:30:41 | 0xC19E3DC77E992B47 | 2018-10-11 05:33:24 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.17 | 6032 | mysql_users | 2 | 2018-10-11 05:30:41 | 0x5C08D3C8E9D57E7B | 2018-10-11 05:33:24 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
| 172.100.2.17 | 6032 | proxysql_servers | 2 | 2018-10-11 05:33:24 | 0xEF3F04DA70472767 | 2018-10-11 05:33:24 | 2018-10-11 05:40:02 | 0 | 2018-10-11 05:40:02 |
+--------------+------+-------------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
16 rows in set (0.00 sec)
admin@127.0.0.1:(none) 01:40:02>SELECT hostname, port, name, version, FROM_UNIXTIME(epoch) epoch, checksum, FROM_UNIXTIME(changed_at) changed_at, FROM_UNIXTIME(updated_at) updated_at, diff_check, DATETIME('NOW') FROM stats_proxysql_servers_checksums WHERE name='mysql_users' ORDER BY hostname, name;
+--------------+------+-------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
| hostname | port | name | version | epoch | checksum | changed_at | updated_at | diff_check | DATETIME('NOW') |
+--------------+------+-------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
| 172.100.2.11 | 6032 | mysql_users | 3 | 2018-10-11 03:03:14 | 0x5C08D3C8E9D57E7B | 2018-10-11 02:58:34 | 2018-10-11 05:40:45 | 0 | 2018-10-11 05:40:45 |
| 172.100.2.13 | 6032 | mysql_users | 3 | 2018-10-11 03:03:11 | 0x5C08D3C8E9D57E7B | 2018-10-11 02:58:34 | 2018-10-11 05:40:45 | 0 | 2018-10-11 05:40:45 |
| 172.100.2.14 | 6032 | mysql_users | 3 | 2018-10-11 03:02:14 | 0x5C08D3C8E9D57E7B | 2018-10-11 02:58:33 | 2018-10-11 05:40:45 | 0 | 2018-10-11 05:40:45 |
| 172.100.2.17 | 6032 | mysql_users | 2 | 2018-10-11 05:30:41 | 0x5C08D3C8E9D57E7B | 2018-10-11 05:33:24 | 2018-10-11 05:40:45 | 0 | 2018-10-11 05:40:45 |
+--------------+------+-------------+---------+---------------------+--------------------+---------------------+---------------------+------------+---------------------+
4 rows in set (0.00 sec)
# 注意: LOAD xxx TO RUNTIME 这种会改变version号。 如果 version=1 则会被当做是proxysql初次启动信息,信息不会被同步到其它节点去。
proxysql cluster 的搭建的更多相关文章
- 【ProxySQL】ProxySQL Cluster的搭建
文章转载自:https://blog.51cto.com/l0vesql/2104643 背景 早期的ProxySQL若需要做高可用,需要搭建两个实例,进行冗余.但两个ProxySQL实例之间的数据并 ...
- ProxySQL Cluster的搭建
环境: proxysql-1.4.10-1-centos7.x86_64 db210 192.168.99.210 老节点,已经做成mysql配置和读写分离设置db211 192.168.99.211 ...
- 重要参考步骤---ProxySQL Cluster 集群搭建步骤
环境 proxysql-1:192.168.20.202 proxysql-2:192.168.20.203 均采用yum方式安装 # cat <<EOF | tee /etc/yum.r ...
- ProxySQL Cluster 高可用集群环境部署记录
ProxySQL在早期版本若需要做高可用,需要搭建两个实例,进行冗余.但两个ProxySQL实例之间的数据并不能共通,在主实例上配置后,仍需要在备用节点上进行配置,对管理来说非常不方便.但是Proxy ...
- ProxySQL Cluster 高可用集群 + MySQL MGR环境部署 (多写模式) 部署记录
文章转载自:https://blog.51cto.com/u_6215974/4937192 ProxySQL 在早期版本若需要做高可用,需要搭建两个实例,进行冗余.但两个ProxySQL实例之间的数 ...
- Redis Cluster的搭建与部署,实现redis的分布式方案
前言 上篇Redis Sentinel安装与部署,实现redis的高可用实现了redis的高可用,针对的主要是master宕机的情况,我们发现所有节点的数据都是一样的,那么一旦数据量过大,redi也会 ...
- 服务发现 consul cluster 的搭建【转】
consul cluster setup 介绍和指南: consul用于服务发现.当底层服务发生变化时,能及时更新正确的mysql服务IP. 并提供给业务查询.但需要自行编写脚本,监测数据库状态和切断 ...
- redis单点、redis主从、redis哨兵sentinel,redis集群cluster配置搭建与使用
目录 redis单点.redis主从.redis哨兵 sentinel,redis集群cluster配置搭建与使用 1 .redis 安装及配置 1.1 redis 单点 1.1.2 在命令窗口操作r ...
- ProxySQL Cluster 概述
文章转载自:https://blog.csdn.net/n88Lpo/article/details/79608639 前言 在ProxySQL 1.4.2 之前,ProxySQL 单点的解决方法有配 ...
随机推荐
- HTTP Status 405 - Request method 'GET' not supported?(尚硅谷Restful案例练习关于Delete方法出现的错误)
哈罗大家好,最近在如火如荼的学习java开发----Spring系列框架,当学习到SpringMVC,动手实践RESTFUL案例时,发现了以上报错405,get请求方法没有被支持. 首先第一步,我查看 ...
- 论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》
论文信息 论文标题:Rethinking the Setting of Semi-supervised Learning on Graphs论文作者:Ziang Li, Ming Ding, Weik ...
- Bash脚本debug攻略
初学Bash时, 我从未想过想过bash也能debug, 也从未想过去debug Bash脚本. 随着技术的增长, 写的脚本越来越复杂, 使用echo打印日志来调试脚本的方式越来越捉襟见肘了. 直到某 ...
- 开发实践丨昇腾CANN的推理应用开发体验
摘要:这是关于一次 Ascend 在线实验的记录,主要内容是通过网络模型加载.推理.结果输出的部署全流程展示,从而快速熟悉并掌握 ACL(Ascend Computing Language)基本开发流 ...
- word段落前的小点·
原因是因为修改论文时,要求在论文的标题前加上 '·' 类似: 在网上搜索了半天,都是加符号,特此记录 解决: 1.文件---选项---显示--勾选段落标记 2.修改样式 至此,设置完毕,章节前的小点已 ...
- ArrayList的操作和对象数组
ArrayList是List接口的一个实现类,它是程序中最常见的一种集合. ArrayList内部的数据存储结构时候数组形式,在增加或删除指定位置的元素时,会创建新的数组,效率比较低,因此不适合做大量 ...
- javascript自执行函数表达式
解析器在解析function关键字的时候,会将相应的代码解析成function表达式,而不是function声明.// 下面2个括弧()都会立即执行(function () { /* code */ ...
- linux-0.11分析:boot文件 bootsect.s 第一篇随笔
boot文件 bootsect.s 第一篇随笔 参考 [github这个博主的][ https://github.com/sunym1993/flash-linux0.11-talk ] bootse ...
- 大数据管理系统架构Hadoop
Hadoop 起源于Google Lab开发的Google File System (GFS)存储系统和MapReduce数据处理框架.2008年,Hadoop成了Apache上的顶级项目,发展到今天 ...
- Apache DolphinScheduler 迎来 2 位 PPMC
经过 Apache DolphinScheduler PPMC 们的推荐和投票,我们高兴的宣布:Apache DolphinScheduler 迎来了 2 位 PPMC .他们是(github id) ...