首页  :: 新随笔  :: 管理

修改OceanBase集群参数

Posted on 2023-04-21 17:06  高&玉  阅读(271)  评论(0编辑  收藏  举报

前言

环境介绍:

  • observer:4.0.0

 

修改ob集群参数的方法:

  • 第1种: alter system set...修改参数,参数修改后会自动同步observer.config.bin
  • 第2种: "obd cluster edit-config 集群名"配置,"obd cluster reload 集群名"重新加载obd配置文件

第1种方法

通过alter system set修改参数会自动同步到observer.config.bin

 

1. 查看config_additional_dir参数值

obclient [oceanbase]> show parameters like 'config_additional_dir';
+-------+----------+--------------+----------+-----------------------+-----------+-----------+------------------------------------------+----------+---------+---------+-------------------+
| zone  | svr_type | svr_ip       | svr_port | name                  | data_type | value     | info                                     | section  | scope   | source  | edit_level        |
+-------+----------+--------------+----------+-----------------------+-----------+-----------+------------------------------------------+----------+---------+---------+-------------------+
| zone1 | observer | 192.168.1.71 |     2882 | config_additional_dir | NULL      | etc2;etc3 | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 |     2882 | config_additional_dir | NULL      | etc2;etc3 | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 |     2882 | config_additional_dir | NULL      | etc2;etc3 | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+-----------------------+-----------+-----------+------------------------------------------+----------+---------+---------+-------------------+

 

2. 修改zone1节点的config_additional_dir参数

修改参数命令:alter system set 参数名='参数值' [server='节点IP:节点RPC端口'];

obclient [oceanbase]> alter system set config_additional_dir='/home/admin/ob_back/etc_back' server='192.168.1.71:2882';
Query OK, 0 rows affected (0.672 sec)

 

3. 查看zone1节点参数文件observer.config.bin,可以看到修改的参数已经同步到参数文件中

[admin]# strings observer.config.bin | grep config_additional_dir
config_additional_dir=/home/admin/ob_back/etc_back

 

4. 验证config_additional_dir参数是否修改成功

obclient [oceanbase]> show parameters like 'config_additional_dir';
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone  | svr_type | svr_ip       | svr_port | name                  | data_type | value                        | info                                     | section  | scope   | source  | edit_level        |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone1 | observer | 192.168.1.71 |     2882 | config_additional_dir | NULL      | /home/admin/ob_back/etc_back | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+

 

5. 重启ob集群,观察参数是否受影响

[admin]# obd cluster restart obce-3zones
Get local repositories and plugins ok
Load cluster param plugin ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Server check ok
Observer restart ok
Wait for observer init ok
+------------------------------------------------+
|                    observer                    |
+--------------+---------+------+-------+--------+
| ip           | version | port | zone  | status |
+--------------+---------+------+-------+--------+
| 192.168.1.71 | 4.1.0.0 | 2881 | zone1 | ACTIVE |
| 192.168.1.72 | 4.1.0.0 | 2881 | zone2 | ACTIVE |
| 192.168.1.73 | 4.1.0.0 | 2881 | zone3 | ACTIVE |
+--------------+---------+------+-------+--------+
obclient -h192.168.1.71 -P2881 -uroot -Doceanbase -A

Stop obproxy ok
Start obproxy ok
obproxy program health check x
[WARN] failed to start 192.168.1.71 obproxy
See https://www.oceanbase.com/product/ob-deployer/error-codes .
Trace ID: 872388ea-e021-11ed-a8eb-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 872388ea-e021-11ed-a8eb-000c29501e19

 

6. 查看集群状态

[admin]# obd cluster list
+----------------------------------------------------------------------+
|                             Cluster List                             |
+-------------+--------------------------------------+-----------------+
| Name        | Configuration Path                   | Status (Cached) |
+-------------+--------------------------------------+-----------------+
| obce-3zones | /home/admin/.obd/cluster/obce-3zones | running         |
+-------------+--------------------------------------+-----------------+
Trace ID: 1ab7ba60-dff3-11ed-9c97-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 1ab7ba60-dff3-11ed-9c97-000c29501e19

 

7. 查看zone1节点config_additional_dir是否受影响

obclient [(none)]> show parameters like 'config_additional_dir';
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone  | svr_type | svr_ip       | svr_port | name                  | data_type | value                        | info                                     | section  | scope   | source  | edit_level        |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone1 | observer | 192.168.1.71 |     2882 | config_additional_dir | NULL      | /home/admin/ob_back/etc_back | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+

第2种方法

通过obd cluster edit-conifg修改obd配置文件修改参数

 

1. 查看集群状态

[admin]# obd cluster list
+----------------------------------------------------------------------+
|                             Cluster List                             |
+-------------+--------------------------------------+-----------------+
| Name        | Configuration Path                   | Status (Cached) |
+-------------+--------------------------------------+-----------------+
| obce-3zones | /home/admin/.obd/cluster/obce-3zones | running         |
+-------------+--------------------------------------+-----------------+
Trace ID: 8f7d63a6-e028-11ed-ac18-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 8f7d63a6-e028-11ed-ac18-000c29501e19

 

2. 使用obd cluser edit-config配置参数,在zone1节点添加“config_additional_dir: /home/admin/ob_back/etc_back”

[admin]# obd cluster edit-config obce-3zones
Search param plugin and load ok
Search param plugin and load ok
Parameter check ok
Save deploy "obce-3zones" configuration
Use `obd cluster reload obce-3zones` to make changes take effect.
Trace ID: c04d8c68-e028-11ed-9a62-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace c04d8c68-e028-11ed-9a62-000c29501e19

 

3. 根据提示重新加载集群配置

[admin]# obd cluster reload obce-3zones
Get local repositories and plugins ok
Load cluster param plugin ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Connect to obproxy ok
obce-3zones reload
Trace ID: fcbe4ce6-e028-11ed-bfab-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace fcbe4ce6-e028-11ed-bfab-000c29501e19

 

4. 查看config_additional_dir参数

obclient [(none)]> show parameters like 'config_additional_dir';
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone  | svr_type | svr_ip       | svr_port | name                  | data_type | value                        | info                                     | section  | scope   | source  | edit_level        |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone1 | observer | 192.168.1.71 |     2882 | config_additional_dir | NULL      | /home/admin/ob_back/etc_back | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+

 

5. 查看observer配置参数文件observer.config.bin,参数已经同步到参数文件

[admin]# strings observer.config.bin | grep config_additional_dir
config_additional_dir=/home/admin/ob_back/etc_back

 

6. 重启ob集群,观察参数是否有影响

[admin]# obd cluster restart obce-3zones
Get local repositories and plugins ok
Load cluster param plugin ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Server check ok
Observer restart ok
Wait for observer init ok
+------------------------------------------------+
|                    observer                    |
+--------------+---------+------+-------+--------+
| ip           | version | port | zone  | status |
+--------------+---------+------+-------+--------+
| 192.168.1.71 | 4.1.0.0 | 2881 | zone1 | ACTIVE |
| 192.168.1.72 | 4.1.0.0 | 2881 | zone2 | ACTIVE |
| 192.168.1.73 | 4.1.0.0 | 2881 | zone3 | ACTIVE |
+--------------+---------+------+-------+--------+
obclient -h192.168.1.71 -P2881 -uroot -Doceanbase -A

Stop obproxy ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
+------------------------------------------------+
|                    obproxy                     |
+--------------+------+-----------------+--------+
| ip           | port | prometheus_port | status |
+--------------+------+-----------------+--------+
| 192.168.1.71 | 2883 | 2884            | active |
+--------------+------+-----------------+--------+
obclient -h192.168.1.71 -P2883 -uroot -Doceanbase -A
obce-3zones restart
Trace ID: 59730616-e029-11ed-9e27-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 59730616-e029-11ed-9e27-000c29501e19

 

7. 查看集群状态

[admin]# obd cluster list
+----------------------------------------------------------------------+
|                             Cluster List                             |
+-------------+--------------------------------------+-----------------+
| Name        | Configuration Path                   | Status (Cached) |
+-------------+--------------------------------------+-----------------+
| obce-3zones | /home/admin/.obd/cluster/obce-3zones | running         |
+-------------+--------------------------------------+-----------------+
Trace ID: 2d453216-e02a-11ed-ace8-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 2d453216-e02a-11ed-ace8-000c29501e19

 

8.  查看zone1节点config_additional_dir是否受影响

obclient [(none)]> show parameters like 'config_additional_dir';
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone  | svr_type | svr_ip       | svr_port | name                  | data_type | value                        | info                                     | section  | scope   | source  | edit_level        |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+
| zone1 | observer | 192.168.1.71 |     2882 | config_additional_dir | NULL      | /home/admin/ob_back/etc_back | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone3 | observer | 192.168.1.73 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
| zone2 | observer | 192.168.1.72 |     2882 | config_additional_dir | NULL      | etc2;etc3                    | additional directories of configure file | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+-------+----------+--------------+----------+-----------------------+-----------+------------------------------+------------------------------------------+----------+---------+---------+-------------------+