You can modify cluster parameters to ensure that the behavior of OceanBase Database meets your business requirements. Cluster parameters of OceanBase Database are also called cluster parameters. These parameters can be dynamically effective or effective only after a restart. You can set cluster parameters to control the load balancing, major compaction time, major compaction mode, resource allocation, and module switches of a cluster.
Notice
The sys tenant is the system tenant. You can view and set cluster parameters in the system tenant. In user tenants, you can only view cluster parameters and cannot set cluster parameters.
For more information about parameters, see Overview.
Procedure
Log in to the cluster as a system tenant user or a user tenant user.
Here is an example of establishing a connection. You must replace the connection information in the example with the actual information of your environment.
obclient -h10.xx.xx.xx -P2883 -utest@mysql#obdemo -p***** -AFor more information about how to connect to a database, see Overview (MySQL mode) and Overview (Oracle mode).
Execute the following statement to query the value of a cluster parameter.
Here is an example:
obclient [(none)]> SHOW PARAMETERS LIKE '%syslog_level%';The query result is as follows:
+-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+ | ZONE | SVR_TYPE | SVR_IP | SVR_PORT | NAME | DATA_TYPE | VALUE | INFO | SECTION | SCOPE | SOURCE | EDIT_LEVEL | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+ | zone1 | observer | 172.xx.xxx.xxx | 2882 | syslog_level | STRING | WDIAG | specifies the current level of logging. There are DEBUG, TRACE, WDIAG, EDIAG, INFO, WARN, ERROR, seven different log levels. | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+ 1 row in setFor more information about how to query cluster parameters, see View cluster parameters.
Execute the following statement to modify the value of a cluster parameter.
The statement is as follows:
ALTER SYSTEM [SET] parameter_name = expression [SCOPE = {SPFILE | BOTH}] [SERVER [=] 'svr_ip:svr_port' | ZONE [=] 'zone' | TENANT [=] {all | all_user | all_meta | tenant_name}];The parameters in the statement are described as follows:
expressionspecifies the new value of the parameter.SCOPEspecifies the scope in which the parameter modification takes effect. The default value isBOTH. Where:SPFILE: indicates that the parameter value is modified only in the configuration table and takes effect only after the OBServer node is restarted.BOTH: indicates that the parameter value is modified in both the configuration table and the memory, and the modification takes effect immediately. The modification also takes effect after the OBServer node is restarted.
TENANT: specifies the tenant scope for modifying the tenant-level parameters in the system tenant. Valid values:all,all_user,all_meta, andtenant_name.allandall_user: all user tenants.Note
Starting from V4.2.1, OceanBase Database allows you to use
TENANT = all_userandTENANT = allinterchangeably to specify the all user tenants scope. We recommend that you useTENANT = all_userwhen you want the modification to take effect in all user tenants.TENANT = allwill be deprecated.all_meta: all Meta tenants.tenant_name: the name of the specified tenant.
SERVERspecifies the OBServer node to modify in the specified cluster, andZONEspecifies the zone to modify in the specified cluster. You cannot specify bothZONEandSERVERin the sameALTER SYSTEMstatement. Moreover, you can specify only one zone when you specifyZONE, and you can specify only one OBServer node when you specifySERVER. If you modify a cluster-level parameter and do not specify a zone or an OBServer node, the modification takes effect in the entire cluster.
You cannot specify a cluster-level parameter for a user tenant or specify the
systenant to set a cluster-level parameter for a user tenant.For example, the execution of the
ALTER SYSTEM SET memory_limit='100G' TENANT='test_tenant'statement will result in an error becausememory_limitis a cluster-level parameter. You can determine whether a parameter is cluster-level or tenant-level based on the value of thescopecolumn in the execution result of theSHOW PARAMETERS LIKE 'parameter_name';statement:If the value of the
scopecolumn isCLUSTER, the parameter is a cluster-level parameter.If the value of the
scopecolumn isTENANT, the parameter is a tenant-level parameter.
The following example shows how to modify a cluster-level parameter in the sys tenant.
obclient [(none)]> ALTER SYSTEM SET syslog_level='ERROR' SCOPE = SPFILE;obclient [(none)]> ALTER SYSTEM SET log_disk_utilization_threshold = 20 TENANT = all_user;obclient [(none)]> ALTER SYSTEM SET system_memory = '50G' ZONE = 'zone1';obclient [(none)]> ALTER SYSTEM SET syslog_io_bandwidth_limit = '5M';obclient [(none)]> ALTER SYSTEM SET memory_limit = '250G' SERVER='xx.xx.xx.238:2882';After the modification, you can execute the
SHOW PARAMETERSstatement to check whether the parameter value is modified successfully, depending on whether you want to restart the OBServer node.obclient [(none)]> SHOW PARAMETERS LIKE '%syslog_level%';The query result is as follows:
+-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+ | zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+ | zone1 | observer | 172.xx.xxx.xxx | 2882 | syslog_level | STRING | ERROR | specifies the current level of logging. There are DEBUG, TRACE, WDIAG, EDIAG, INFO, WARN, ERROR, seven different log levels. | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+ 1 row in set
References
For more information about cluster parameters, see the following topics:
For more information about each parameter, see Overview.