ProxySQL主要是通过mysql_servers来配置MySQL servers,有时候可能会用到mysql_replication_hostgroups
备注:在读下面内容之前,确保理解multi-layer configuration system,或者看我前面的文章
注意:
mysql_servers
和mysql_replication_hostgroups
表后,如果不执行LOAD MYSQL SERVERS TO RUNTIME,当前配置并不会生效多层配置系统略过,详细内容参考multi-layer configuration system
要添加一个后台MySQL server,insert一条新纪录到mysql_servers表即可,这张表部分列都带有默认值
下面的操作是新增一个MySQL server,除hostname外其他都采用默认值
1 Admin> SELECT * FROM mysql_servers; 2 Empty set (0.00 sec) 3 4 Admin> INSERT INTO mysql_servers (hostname) VALUES ('172.16.0.1'); 5 Query OK, 1 row affected (0.00 sec) 6 7 Admin> SELECT * FROM mysql_servers\G 8 *************************** 1. row *************************** 9 hostgroup_id: 0 10 hostname: 172.16.0.1 11 port: 3306 12 status: ONLINE 13 weight: 1 14 compression: 0 15 max_connections: 1000 16 max_replication_lag: 0 17 use_ssl: 0 18 max_latency_ms: 0 19 comment: 20 1 row in set (0.00 sec)
View Code
本文链接:http://task.lmcjl.com/news/18889.html