ProxyMySQL的Admin管理接口

ProxySQL的Admin管理接口


当ProxySQL启动后,将监听两个端口:

  • admin管理接口,默认端口6032.该端口用于查看、配置ProxySQL
  • 接收SQL语句的接口,默认端口为6033,这个接口类似于MySQL的3306端口

ProxySQL的admin管理接口是一个使用MySQL协议的接口,所以,可以直接使用mysql客户端、navicat等工具去连接ProxySQL的管理接口:

[ ~]# mysql -uadmin -padmin -h127.0.0.1 -P6032
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.30 (ProxySQL Admin Module)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql> 
mysql> show dataases;
ERROR 1045 (#2800): near "show": syntax error
mysql> show databases;
+-----+---------------+-------------------------------------+
| seq | name          | file                                |
+-----+---------------+-------------------------------------+
| 0   | main          |                                     |
| 2   | disk          | /var/lib/proxysql/proxysql.db       |
| 3   | stats         |                                     |
| 4   | monitor       |                                     |
| 5   | stats_history | /var/lib/proxysql/proxysql_stats.db |
+-----+---------------+-------------------------------------+
5 rows in set (0.00 sec)

mysql>

由于ProxySQL的配置全部保存在几个自带的库中,所以通过管理接口,可以非常方便地通过发送一些SQL命令去修改ProxySQL的配置。ProxySQL会解析通过该接口发送的某些对ProxySQL有效的特定命令,将其合理转换后发送给内嵌的SQLLite3数据据库引擎去运行ProxySQL有效的特定命令,并将其合理转换后发送给内嵌的SQLite3数据库引擎去运行ProxySQL的配置几乎都是通过管理接口来操作的,通过Admin接口管理,可以在线修改几乎所有的配置并使其生效。只有两个变量的配置是必须重启proxySQL才能生效的,它们是:mysql-threads和mysql-stacksize

相关推荐