暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

万里数据库分布式GreatDB-SQL手册集群管理命令: 后台节点管理接口(2)

原创 Dbb 2024-04-26
371

后台节点管理接口

设置sqlnode节点系统变量

存储过程mysql.greatdb_set_var_for_all_sqlnodes
作用在任一 sqlnode 节点,可以通过调用存储过程,统一修改所有 sqlnode 节点的系统变量值
参数variable_name:需要修改的变量名称
value:修改的变量值
persist:是否需要将变量修改进行持久化,如果设置为 true,则数据节点重启后,修改仍生效;否则,数据节点重启后,结果为修改前的值
版本5.0.8

示例:

> SELECT * FROM INFORMATION_SCHEMA.GREATDB_SQLNODE_VARIABLES
   WHERE VARIABLE_NAME='max_connections';
+-----------------+-----------------+----------------+
| SQLNODE         | VARIABLE_NAME   | VARIABLE_VALUE |
+-----------------+-----------------+----------------+
| localhost:13000 | max_connections | 151            |
| 127.0.0.1:13002 | max_connections | 151            |
| 127.0.0.1:13004 | max_connections | 151            |
+-----------------+-----------------+----------------+
3 rows in set (0.06 sec)

> CALL mysql.greatdb_set_var_for_all_sqlnodes('max_connections', 100, 0);
Query OK, 1 row affected (0.03 sec)

> SELECT * FROM INFORMATION_SCHEMA.GREATDB_SQLNODE_VARIABLES
   WHERE VARIABLE_NAME='max_connections';
+-----------------+-----------------+----------------+
| SQLNODE         | VARIABLE_NAME   | VARIABLE_VALUE |
+-----------------+-----------------+----------------+
| localhost:13000 | max_connections | 100            |
| 127.0.0.1:13002 | max_connections | 100            |
| 127.0.0.1:13004 | max_connections | 100            |
+-----------------+-----------------+----------------+
3 rows in set (0.05 sec)

该操作仅支持修改部分的系统变量值,当前支持修改的系统变量如下:

变量名是否全局立即生效
audit_log_enabled1
audit_log_to_table1
gdb_cluster_ddl_metalock0
gdb_direct_processing0
gdb_direct_pushdown_time_funcs0
gdb_enable_xplan0
gdb_strict_create_table0
gdb_xplan_enable_const_pushdown0
gdb_xplan_enable_multi_shards0
general_log1
greatdb_ddl_lock_backend_wait_timeout0
greatdb_deadlock_detection_period1
greatdb_enable_deadlock_detection1
greatdb_enable_instant_add_column0
greatdb_inject_sqlnode_info0
greatdb_max_connections1
greatdb_migrate_table_parallel_num1
greatdb_optimize_direct_delete0
greatdb_optimize_multi_recs_update0
greatdb_physical_migrate_table0
greatdb_physical_migrate_table_mode0
greatdb_records_in_range_from_dn0
greatdb_records_in_range_max_partitions0
greatdb_result_cache_batch_cnt1
greatdb_result_cache_size1
greatdb_rnd_pos_probe1
greatdb_sync_autoincrement_interval1
greatdb_table_cache_size1
greatdb_upgrade_cluster1
group_replication_applier_batch_size_threshold1
group_replication_clone_threshold1
group_replication_ip_allowlist1
group_replication_ip_whitelist1
group_replication_transaction_size_limit1
group_replication_unreachable_majority_timeout1
innodb_buffer_pool_size1
innodb_change_buffering1
innodb_doublewrite1
innodb_flush_log_at_trx_commit1
innodb_spin_wait_delay1
innodb_sync_spin_loops1
innodb_thread_concurrency1
join_buffer_size0
long_query_time0
max_binlog_cache_size1
max_connections1
max_prepared_stmt_count1
replica_parallel_workers0
slave_parallel_workers0
sort_buffer_size0
sync_binlog1
table_definition_cache1
table_open_cache1
transaction_isolation0

如果用户需要修改之外的系统变量,需要连接到各个sqlnode并使用set命令直接设置,或参考拓展可设置的sqlnode/datanode变量

注意:该存储过程会统一修改所有的 sqlnode 节点的变量,如果用户只需要设置某一个 sqlnode 节点,则直连该 sqlnode 节点,使用 MySQL 的 SET 语句即可。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论