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 a user tenant, you can only view cluster parameters and cannot set them.
For more information about parameters, see Overview.
Procedure
Log in to the cluster as the sys tenant user or a user tenant user.
Here is an example of how to connect to a database. You must modify the connection string based on your actual database settings.
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 values of cluster parameters.
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 | default_value | isdefault | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+ | 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 | WDIAG | 1 | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+ 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 value of the parameter after the modification.SCOPEspecifies the scope in which the parameter modification takes effect. Default value:BOTH. Where:SPFILE: indicates that only the parameter values in the configuration table are modified, and the modification takes effect only after the OBServer node is restarted.BOTH: indicates that the parameter values in the configuration table and in memory are modified. The modification takes effect immediately and the parameter values take effect after the OBServer node is restarted.
TENANT: specifies the tenant-level parameters to be modified for the sys tenant user. 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 scope of parameter modification. 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.
SERVER: specifies the OBServer node to modify in the specified cluster.ZONE: specifies the zone to modify in the specified cluster. You cannot specify bothZONEandSERVERin anALTER SYSTEMstatement. When you specifyZONE, you can specify only one zone. When you specifySERVER, you can specify only one server. If you modify a cluster-level parameter without specifyingZONEorSERVER, the modification takes effect in the entire cluster.
You cannot specify tenant-level parameters at the user tenant level or specify them for the sys tenant (
systenant).For example, executing 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 result of theSHOW PARAMETERS LIKE 'parameter_name';statement:scopevalue isCLUSTER: cluster-level parameter.scopevalue isTENANT: tenant-level parameter.
The following examples show how to modify cluster-level parameters as the sys tenant user:
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 verify 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 | default_value | isdefault | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+ | 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 | WDIAG | 0 | +-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+ 1 row in set
References
For more information about cluster parameters, see the following topics:
For more information about each parameter, see Overview.