修改租户参数
连接sys租户修改租户参数
使用root连接sys租户
[admin]# mysql -h192.168.1.71 -P2883 -D oceanbase -uroot@sys -pOceanBase010 -A
查看参数
mysql> show parameters like 'writing_throttling_trigger_percentage';
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level |
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone3 | observer | 192.168.1.73 | 2882 | writing_throttling_trigger_percentage | NULL | 60 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 | 2882 | writing_throttling_trigger_percentage | NULL | 60 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone1 | observer | 192.168.1.71 | 2882 | writing_throttling_trigger_percentage | NULL | 60 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
修改my_tenant租户的参数
mysql> alter system set writing_throttling_trigger_percentage='70' server='192.168.1.71:2882' tenant='my_tenant';
Query OK, 0 rows affected (0.50 sec)
查看租户参数
mysql> show parameters like 'writing_throttling_trigger_percentage';
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level |
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone3 | observer | 192.168.1.73 | 2882 | writing_throttling_trigger_percentage | NULL | 60 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 | 2882 | writing_throttling_trigger_percentage | NULL | 60 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone1 | observer | 192.168.1.71 | 2882 | writing_throttling_trigger_percentage | NULL | 60 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
连接my_tenant租户中查看参数
[admin]# mysql -h192.168.1.71 -P2883 -D oceanbase -uroot@my_tenant -pOceanBase010 -A
mysql> show parameters like 'writing_throttling_trigger_percentage';
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level |
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone1 | observer | 192.168.1.71 | 2882 | writing_throttling_trigger_percentage | NULL | 77 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 | 2882 | writing_throttling_trigger_percentage | NULL | 70 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 | 2882 | writing_throttling_trigger_percentage | NULL | 70 | the threshold of the size of the mem store when writing_limit will be triggered. Rang:(0,100]. setting 100 means turn off writing limit | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+---------------------------------------+-----------+-------+-------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+
连接用户租户修改租户参数
使用root连接my_tenant租户
[admin]# mysql -h192.168.1.71 -P2883 -D oceanbase -uroot@my_tenant#ob_cluster -pOceanBase010 -A
修改参数
mysql> alter system set writing_throttling_maximum_duration='1h' server='192.168.1.71:2882';
Query OK, 0 rows affected (0.33 sec)
查看修改的参数
mysql> show parameters like 'writing_throttling_maximum_duration';
+-------+----------+--------------+----------+-------------------------------------+-----------+-------+--------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level |
+-------+----------+--------------+----------+-------------------------------------+-----------+-------+--------------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone1 | observer | 192.168.1.71 | 2882 | writing_throttling_maximum_duration | NULL | 1h | maximum duration of writting throttling(in minutes), max value is 3 days | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 | 2882 | writing_throttling_maximum_duration | NULL | 2h | maximum duration of writting throttling(in minutes), max value is 3 days | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 | 2882 | writing_throttling_maximum_duration | NULL | 2h | maximum duration of writting throttling(in minutes), max value is 3 days | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+-------------------------------------+-----------+-------+--------------------------------------------------------------------------+---------+--------+---------+-------------------+
修改租户变量
连接用户租户修改租户变量
少数变量(如lower_case_table_names)需要在租户创建时候指定,修改变量前请参考OceanBase官方文档“系统参考-->系统变量(MySQL模式/Oracle模式)”。
ALTER TENANT语法
ALTER TENANT {tenant_name | ALL}
[SET] [tenant_option_list] [opt_global_sys_vars_set];
tenant_option_list:
tenant_option [, tenant_option ...]
tenant_option:
COMMENT [=]'string'
| {CHARACTER SET | CHARSET} [=] charset_name
| COLLATE [=] collation_name
| ZONE_LIST [=] (zone [, zone...])
| PRIMARY_ZONE [=] zone
| RESOURCE_POOL_LIST [=](pool_name [, pool_name...])
| DEFAULT TABLEGROUP [=] {NULL | tablegroup_name}
| {READ ONLY | READ WRITE}
| LOCALITY [=] 'locality_description'
| RENAME GLOBAL_NAME TO new_tenant_name
opt_global_sys_vars_set:
VARIABLES system_var_name = expr [,system_var_name = expr] ...
连接sys租户修改租户变量
查看变量语法
show [global | session] variables [like '%变量关键字符%'];
show [global | session] variables [where variable_name = '变量名'];
配置变量语法
set [global | session] 变量 = '变量值';
参考:
https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001697402
https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001700535
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库