This topic describes the information about parameters and system variables, such as their modification and query, and the differences in using parameters and system variables in OceanBase Database.
Parameters
You can set these parameters to control the load balancing, major compaction time, major compaction mode, resource allocation, and module switches of a cluster.
Categories of parameters
OceanBase Database offers parameters at both the cluster-level and tenant-level.
Cluster-level parameters encompass the fundamental details, performance settings, and security options for the entire OceanBase cluster. These parameters are primarily utilized for global tasks such as data backup, restore, and load balancing. Generally, cluster-level parameters are set during the cluster's startup and are rarely altered afterwards.
Tenant-level parameters, on the other hand, are designed to address specific configurations for one or multiple tenants, allowing for optimized feature options. These parameters are commonly used for storage engine settings, SQL execution strategies, and access control. Tenant-level parameters are typically defined during tenant creation and management and can be modified as required at any given time.
Note
Most parameters take effect immediately after you set or modify their values, while some parameters take effect after you restart the OBServer node.
Query parameters
You can use the following method to query whether a parameter is a cluster-level or tenant-level parameter:
obclient> SHOW PARAMETERS LIKE 'max_syslog_file_count';
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 | 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 |
+-------+----------+----------------+----------+-----------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
1 row in set
If the value in the scope column is CLUSTER, the parameter is a cluster-level parameter. If the value in the scope column is TENANT, the parameter is a tenant-level parameter.
System variables
System variables provide control over various behaviors of a database system, such as cache size, concurrent connections, CPU utilization, and memory usage. They also enable configuration of different features within the database system.
Categories of system variables
System variables in OceanBase Database can be divided into global variables and session-level variables.
Global variables facilitate changes that affect the entire database tenant. Users within the same tenant share the settings of global variables. Changes to global variables persist even after the session is exited. Notably, modifications to global variables do not immediately impact the ongoing session; they take effect only when a new session is established.
On the other hand, session-level variables enable modifications at the session level. When a client connects to the database, global variable settings are automatically copied to create session-level variables. Changes made to session-level variables are confined to the current session and do not extend beyond it.
Query system variables
You can query a system variable by using the following methods:
MySQL mode
obclient> SHOW VARIABLES LIKE 'ob_query_timeout'; obclient> SHOW GLOBAL VARIABLES LIKE 'ob_query_timeout';Oracle mode
obclient> SELECT * FROM SYS.TENANT_VIRTUAL_SESSION_VARIABLE WHERE VARIABLE_NAME = 'ob_query_timeout'; obclient> SELECT * FROM SYS.TENANT_VIRTUAL_GLOBAL_VARIABLE WHERE VARIABLE_NAME = 'ob_query_timeout';
Differences between parameters and system variables
| Comparison item | Parameter | System variable |
|---|---|---|
| Applicable scope | Affects a cluster, zone, server, or tenant. | Affects a tenant globally or at the session level. |
| Effective mode |
|
|
| Modification |
|
Modification can only be performed by using SQL statements. Examples:
|
| Query method | You can query a system parameter by using the SHOW PARAMETERS statement. Example: SHOW PARAMETERS LIKE 'schema_history_expire_time';. |
You can query a variable by using the SHOW [GLOBAL] VARIABLES statement. Examples:
|
| Persistence | Parameters are persisted into internal tables and configuration files, and can be queried from the /home/admin/oceanbase/etc/observer.config.bin and /home/admin/oceanbase/etc/observer.config.bin.history files. |
Only global variables are persisted. |
| Lifecycle | Long. A system parameter remains effective for the entire duration of a process. | Short. A system variable takes effect only after the tenant schema is created. |
References
For more information about parameters, see Overview of parameters.
For more information about how to query and set parameters, see Set parameters.
For information about system variables, see Overview of system variables.
For more information about how to query and set system variables, see Set variables.