变量作用域问题疑问

—tidb变量作用域的设置
set session autocommit=‘off’; --session级别

set global autocommit=‘off’; --global级别

set cconfig pd log.level =‘info’; --集群级别配置 edit-config 也可以配置

set config ‘192.168.2.22:2379’ log.level=‘warning’; --实例级别配置集群参数 edit-config 也可以配置

global: 对新建会话连接有效,当前连接会话或已建立的会话不生效
session: 仅在当前会话生效
instance: 节点上实例重启后生效


似乎是 这类参数 instance.tidb_slow_log_threshold

–比如
mysql -h192.168.2.22 -uroot -poracle -P4000
set global tidb_slow_log_threshold=1000;

mysql> show config where type=‘tidb’ and name like ‘%tidb_slow_log_threshold%’;
±-----±------------------±---------------------------------±------+
| Type | Instance | Name | Value |
±-----±------------------±---------------------------------±------+
| tidb | 192.168.2.21:4000 | instance.tidb_slow_log_threshold | 300 |
| tidb | 192.168.2.23:4000 | instance.tidb_slow_log_threshold | 300 |
| tidb | 192.168.2.22:4000 | instance.tidb_slow_log_threshold | 1000 |
±-----±------------------±---------------------------------±------+
注意:300是默认值。1000是修改的新值

–集群重启
mysql> show config where type=‘tidb’ and name like ‘%tidb_slow_log_threshold%’;
±-----±------------------±---------------------------------±------+
| Type | Instance | Name | Value |
±-----±------------------±---------------------------------±------+
| tidb | 192.168.2.22:4000 | instance.tidb_slow_log_threshold | 300 |
| tidb | 192.168.2.23:4000 | instance.tidb_slow_log_threshold | 300 |
| tidb | 192.168.2.21:4000 | instance.tidb_slow_log_threshold | 300 |
±-----±------------------±---------------------------------±------+
注意:tiup cluster stop tpln_qa 值变回默认值