首页  :: 新随笔  :: 管理

OceanBase修改配置参数/变量

Posted on 2023-05-09 15:33  高&玉  阅读(264)  评论(0编辑  收藏  举报

修改租户参数

连接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