您好,登錄后才能下訂單哦!
1、緊接上文,配置過程請看上文
2、進(jìn)入proxysql數(shù)據(jù)目錄
[root@12c proxysql]# cd /var/lib/proxysql/
[root@12c proxysql]# ll
total 344
-rw-rw-r-- 1 proxysql proxysql 1050 Jul 18 13:45 proxysql-ca.pem
-rw-rw-r-- 1 proxysql proxysql 1058 Jul 18 13:45 proxysql-cert.pem
-rw------- 1 proxysql proxysql 163840 Jul 18 14:49 proxysql.db
-rw-rw-r-- 1 proxysql proxysql 1679 Jul 18 13:45 proxysql-key.pem
-rw------- 1 proxysql proxysql 26369 Jul 18 16:20 proxysql.log
-rw-r--r-- 1 proxysql proxysql 5 Jul 18 14:24 proxysql.pid
-rw------- 1 proxysql proxysql 143360 Jul 18 16:22 proxysql_stats.db
3、備份目錄
[root@12c proxysql]# cd ..
[root@12c lib]# tar -cvzf proxysql.tar.gz proxysql
proxysql/
proxysql/proxysql-key.pem
proxysql/proxysql-ca.pem
proxysql/proxysql-cert.pem
proxysql/proxysql.log
proxysql/proxysql_stats.db
proxysql/proxysql.db
proxysql/proxysql.pid
[root@12c lib]# cd proxysql/
[root@12c proxysql]# ll
total 344
-rw-rw-r-- 1 proxysql proxysql 1050 Jul 18 13:45 proxysql-ca.pem
-rw-rw-r-- 1 proxysql proxysql 1058 Jul 18 13:45 proxysql-cert.pem
-rw------- 1 proxysql proxysql 163840 Jul 18 14:49 proxysql.db
-rw-rw-r-- 1 proxysql proxysql 1679 Jul 18 13:45 proxysql-key.pem
-rw------- 1 proxysql proxysql 26369 Jul 18 16:20 proxysql.log
-rw-r--r-- 1 proxysql proxysql 5 Jul 18 14:24 proxysql.pid
-rw------- 1 proxysql proxysql 143360 Jul 18 16:23 proxysql_stats.db
4、關(guān)閉并清空
[root@12c proxysql]# /etc/init.d/proxysql stop
Shutting down ProxySQL: DONE!
[root@12c proxysql]# rm *.* -f
[root@12c proxysql]# ll
total 0
5、啟動并觀察
[root@12c proxysql]# /etc/init.d/proxysql start
Starting ProxySQL: 2019-07-18 16:24:16 [INFO] Using config file /etc/proxysql.cnf
2019-07-18 16:24:16 [INFO] No SSL keys/certificates found in datadir (/var/lib/proxysql). Generating new keys/certificates.
DONE!
[root@12c proxysql]# mysql -u admin -padmin -h 127.0.0.1 -P6032
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.30 (ProxySQL Admin Module)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
admin@127.0.0.1 [(none)] 04:24:23>>>SELECT * FROM mysql_servers;
Empty set (0.00 sec)
admin@127.0.0.1 [(none)] 04:25:03>>>exit
Bye
6、關(guān)閉后恢復(fù)
[root@12c proxysql]# /etc/init.d/proxysql stop
Shutting down ProxySQL: DONE!
[root@12c proxysql]# ..
[root@12c proxysql]# ll
total 308
-rw-rw-r-- 1 proxysql proxysql 1050 Jul 18 16:24 proxysql-ca.pem
-rw-rw-r-- 1 proxysql proxysql 1058 Jul 18 16:24 proxysql-cert.pem
-rw------- 1 proxysql proxysql 163840 Jul 18 16:24 proxysql.db
-rw-rw-r-- 1 proxysql proxysql 1679 Jul 18 16:24 proxysql-key.pem
-rw------- 1 proxysql proxysql 4095 Jul 18 16:25 proxysql.log
-rw------- 1 proxysql proxysql 135168 Jul 18 16:24 proxysql_stats.db
[root@12c proxysql]# rm *.* -f
[root@12c proxysql]# cd ..
[root@12c lib]# tar -xvzf proxysql.tar.gz
proxysql/
proxysql/proxysql-key.pem
proxysql/proxysql-ca.pem
proxysql/proxysql-cert.pem
proxysql/proxysql.log
proxysql/proxysql_stats.db
proxysql/proxysql.db
proxysql/proxysql.pid
7、啟動后重新觀察
[root@12c lib]# /etc/init.d/proxysql start
Starting ProxySQL: Removed stale pid file: /var/lib/proxysql/proxysql.pid
2019-07-18 16:25:53 [INFO] Using config file /etc/proxysql.cnf
2019-07-18 16:25:53 [INFO] SSL keys/certificates found in datadir (/var/lib/proxysql): loading them.
DONE!
[root@12c lib]# mysql -u admin -padmin -h 127.0.0.1 -P6032
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.30 (ProxySQL Admin Module)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
admin@127.0.0.1 [(none)] 04:26:15>>>SELECT * FROM mysql_servers;
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10 | 192.168.56.11 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 192.168.56.11 | 3307 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
2 rows in set (0.00 sec)
admin@127.0.0.1 [(none)] 04:26:16>>>exit
Bye
8、查看路由規(guī)律
[root@12c lib]# mysql -urootuser -p123456 -h292.168.56.11 -P6033 -e "SELECT @@server_id;"
+-------------+
| @@server_id |
+-------------+
| 11 |
+-------------+
[root@12c lib]# mysql -urootuser -p123456 -h292.168.56.11 -P6033 -e "BEGIN;SELECT @@server_id;commit;"
+-------------+
| @@server_id |
+-------------+
| 1 |
+-------------+
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。