Socialabel

Friday, June 22, 2018

Perintah ProxySQL di Centos

Melihat Koneksi dan Grup yang digunakan
select * from stats_mysql_connection_pool;

Menambah Anggota Cluster
mysql> insert into mysql_servers(hostgroup_id, hostname, port) values (0,'192.168.56.102',3316);
Query OK, 1 row affected (0.00 sec)
 
mysql> insert into mysql_servers(hostgroup_id, hostname, port) values (1,'192.168.56.103',3316);
Query OK, 1 row affected (0.01 sec)
 
mysql> select * from mysql_servers;
3 rows in set (0.01 sec)
 
mysql> save mysql servers to disk;
Query OK, 0 rows affected (0.00 sec)
 
mysql> select * from disk.mysql_servers;
3 rows in set (0.00 sec)
 
mysql> load mysql servers to runtime;
Query OK, 0 rows affected (0.00 sec)

Menghapus Anggota Cluster 
mysql> delete from mysql_servers where hostgroup_id=1 and hostname='192.168.56.102';
Query OK, 1 row affected (0.00 sec)
Mengload Perubahan ProxySQL
mysql> load mysql servers to runtime;
Query OK, 0 rows affected (0.01 sec)
 
Melihat Anggota Cluster
mysql> select * from mysql_servers;