This topic describes how to modify and query configuration parameters and system variables in OceanBase Database, and highlights the differences between them.
Parameters
You can use parameters to control the load balancing, major compaction time, major compaction mode, resource allocation, and module switches of a cluster.
Parameter types
OceanBase Database supports cluster-level and tenant-level parameters.
Cluster-level parameters: These parameters are applicable to the entire OceanBase Database cluster. They are global in nature and are used to configure the basic information, performance parameters, and security options of the cluster. These parameters usually include those related to data backup and restore and load balancing. Cluster-level parameters are usually configured when the cluster is started and are rarely modified after configuration.
Tenant-level parameters: These parameters are applicable to tenants. They are used to configure and optimize specific tenants or multiple tenants. These parameters usually include those related to storage engines, SQL execution strategies, and access control. These parameters can be configured when tenants are created and managed and can be modified as needed.
Note
Most parameters take effect dynamically, which means they take effect without restarting the OBServer node.
Query parameters
You can execute the following statement to query whether a parameter is a cluster-level or tenant-level parameter:
obclient> SHOW PARAMETERS LIKE 'max_syslog_file_count';
The execution 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 | max_syslog_file_count | INT | 0 | specifies the maximum number of the log files that can co-exist before the log file recycling kicks in. Each log file can occupy at most 256MB disk space. When this value is set to 0, no log file will be removed. Range: [0, +∞) in integer | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE | 0 | 1 |
+-------+----------+----------------+----------+-----------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
1 row in set
In the preceding result set, if the value of the scope column is CLUSTER, the parameter is a cluster-level parameter. If the value is TENANT, the parameter is a tenant-level parameter.
System variables
You can use system variables to control the behaviors of a database system, such as cache size, concurrent connections, CPU usage, and memory usage. You can also use system variables to configure the features of a database system.
System variable types
OceanBase Database supports global and session variables.
Global variables: These variables are applicable to the entire database system. Different users in the same tenant share global variables. Global variables take effect for all sessions and are not affected by session termination. After a global variable is modified, the modification does not take effect for sessions that are already open. You must establish a new session for the modification to take effect.
Session variables: These variables are applicable to a session. When a client connects to a database, the database automatically generates session variables based on global variables. Session variables take effect only for the current session.
Query system variables
You can execute the following statement to query the value of a system variable:
To query the value of a system variable, execute the following statement:
obclient [oceanbase]> SHOW VARIABLES LIKE 'ob_query_timeout';
obclient [oceanbase]> SHOW GLOBAL VARIABLES LIKE 'ob_query_timeout';
To query the modification records of a global variable and the default value of the variable, execute the following statement:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_SYS_VARIABLES WHERE NAME='ob_query_timeout';
To query the value of a system variable, execute the following statement:
obclient [SYS]> SELECT * FROM SYS.TENANT_VIRTUAL_SESSION_VARIABLE WHERE VARIABLE_NAME = 'ob_query_timeout';
obclient [SYS]> SELECT * FROM SYS.TENANT_VIRTUAL_GLOBAL_VARIABLE WHERE VARIABLE_NAME = 'ob_query_timeout';
To query the modification records of a global variable and the default value of the variable, execute the following statement:
obclient [SYS]> SELECT * FROM SYS.DBA_OB_SYS_VARIABLES WHERE NAME='ob_query_timeout';
Parameters and system variables
| Feature | Parameter | System variable |
|---|---|---|
| Scope | Parameters are applicable to clusters, zones, servers, and tenants. | System variables are applicable to tenants and are divided into global and session variables. |
| Effective method |
|
|
| Modification method |
|
You can modify a system variable by using an SQL statement. Examples:
|
| Query method | You can execute the SHOW PARAMETERS statement. Example: SHOW PARAMETERS LIKE 'schema_history_expire_time'; |
You can execute the SHOW [GLOBAL] VARIABLES statement. Examples:
|
| Persistence | Parameters are persisted to internal tables and configuration files. You can query the parameter in the /home/admin/oceanbase/etc/observer.config.bin and /home/admin/oceanbase/etc/observer.config.bin.history files. |
Only global variables are persisted. Session variables are not persisted. |
| Lifecycle | Long. Parameters are effective from the start to the end of a process. | Short. Session variables are effective only after the schema of a tenant is created. |
References
For more information about configuration items, see Overview of configuration items.
For more information about how to view and set configuration items, see Set parameters.
For more information about system variables, see Overview of system variables.
For more information about how to view and set system variables, see Set variables.
