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 单点的解决方法有配 ...
随机推荐
- Nginx越界读取缓存漏洞 CVE-2017-7529
1.漏洞描述 Nginx在反向代理站点的时候,通常会将一些文件进行缓存,特别是静态文件.缓存的部分存储在文件中,每个缓存文件包括"文件头"+"HTTP返回包头" ...
- Java开发学习(十)----基于注解开发定义bean 已完成
一.环境准备 先来准备下环境: 创建一个Maven项目 pom.xml添加Spring的依赖 <dependencies> <dependency> < ...
- 攻防世界MISC—进阶区1-10
1.something_in_image zip中的文件用010 Editor打开后直接搜索flag,即可找到flag 2.wireshark-1 zip内是pcap文件,打开后根据题目知道要寻找登录 ...
- mobaxterm会话同步
前言 之前用过MobaXterm,想不起来为啥不用了.后面主要还是用xshell,最近又在用WindTerm,WindTerm还不错,奈何有不少的Bug,所以又来研究一下MobaXterm 下午摸索了 ...
- 第十三天python3 生成器yield
生成器generator 生成器指的是生成器对象,可由生成器表达式得到,也可以使用yield关键字得到一个生成器函数,调用这个函数得到一个生成器对象: 生成器函数 函数体中包含yield语句的函数,返 ...
- 重写并自定义依赖的原生的Bean方法
转载请注明出处: 在项目开发过程中,往往是直接应用很多jar包中依赖且声明好的Bean,拿来即用,但很多场景也需要对这些原生的Bean 进行自定义,定制化封装,这样在项目使用的过程中,可以使用自定义的 ...
- 处理化学SDF文件出现乱码的解决经验
近期,在VS2019中用WTL编写一个处理化学SDF文件的程序,遇到多处数据出现乱码的问题,典型一处情况如下:在原始SDF文件的一个字段中,有个形如下面的文字信息: https://product.p ...
- 案例复现,带你分析Priority Blocking Queue比较器异常导致的NPE问题
摘要:本文通过完整的案例复现来演示在什么情况会触发该问题,同时给出了处理建议.希望读者在编程时加以借鉴,避免再次遇到此类问题. 本文分享自华为云社区<Priority Blocking Queu ...
- DolphinScheduler 集群高可用测试:有效分摊服务器压力,达到性能最大优化!
点击上方 蓝字关注我们 1 文档编写目的 Apache DolphinScheduler(简称DS)是一个分布式去中心化,易扩展的可视化DAG工作流任务调度平台.在生产环境中需要确保调度平台的稳定可靠 ...
- 文心大模型api使用
文心大模型api使用 首先,我们要获取硅谷社区的连个key 复制两个api备用 获取Access Token 获取access_token示例代码 之后就会输出 作文创作 作文创作:作文创作接口基于文 ...