Global Variables

Global Variables

我们可以通过global variables来调整ProxySQL的功能,有如下两种方式来调整global variables:

  • at runtime, using the admin interface (preferred)
  • at startup, using the dedicated section in the configuration file

ProxySQL在运行的过程中,大多数参数是可以修改的而且可以立即生效,并不需要重启后台进程,但是mysql-threads 、 mysql-stacksize这两个参数除外

有两种类型的global variables,这可以通过变量的前缀来区分它们各自的功能

  • admin variables, which control the behaviour of the admin interface. Their names begin with the token "admin-"
  • mysql variables, which control the MySQL functionality of the proxy. Their names begin with the token "mysql-"

当这些global variables被频繁的访问的话,为了快速访问这些global variables,每一个proxy线程的内部都会保存这些global variables,它们通过内存跟踪或者连接数来控制proxy的具体行为。

不管何时执行了LOAD MYSQL VARIABLES TO RUNTIME or LOAD ADMIN VARIABLES TO RUNTIME命令,所有用到mysql或者admin variables的线程都会要求变更相应的variables。

可以通过update语句改变global variable的值

UPDATE global_variables SET variable_value=1900 WHERE variable_name='admin-refresh_interval';

或者也可以用类似于简写的MySQL SET语句

SET admin-refresh_interval = 1700;
SET admin-version = '1.1.1beta8';

变量的具体含义,参考文档

admin-web配置

MySQL Variables

注意字符集设置

mysql-default_charset

我设置成utf8mb4,通过proxy 6033连接后端服务器后,client以及connect字符集均没有变成utf8mb4

参考文档:global variables

原文地址:https://www.cnblogs.com/geek-ace/p/9553965.html