首页  :: 新随笔  :: 管理

重启OceanBase节点

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

提示:

  OceanBase节点重启时间不要超过server_permanent_offline_time参数配置的时长(默认3600S)1个小时,否则该节点会被永久下线。

 

重启节点的步骤:

  • 隔离节点
  • 节点转储
  • 停止observer进程
  • 启动observer进程
  • 启动节点

 

使用root用户连接sys租户

[admin]# mysql -h192.168.1.71 -P2883 -D oceanbase -uroot@sys -pOceanbase2881 -A

 

查看节点信息,所有节点STATUS为ACTIVE,STOP_TIME为NULL

mysql> select * from DBA_OB_SERVERS;
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME         | STOP_TIME | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE | 2023-05-06 15:14:10.951435 | NULL      | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 10:51:49.795243 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE | 2023-05-06 15:07:46.780470 | NULL      | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 10:47:29.100244 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.73 |     2882 |  3 | zone3 |     2881 | NO              | ACTIVE | 2023-05-07 08:31:09.520473 | NULL      | NULL                  | 2023-04-24 18:32:52.252549 | 2023-05-08 10:47:30.065794 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

 

隔离节点192.168.1.73:2882

mysql> alter system stop server '192.168.1.73:2882';
Query OK, 0 rows affected (3.29 sec)

 

再次查看节点信息,192.168.1.73节点STATUS为ACTIVE

mysql> select * from DBA_OB_SERVERS;
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME         | STOP_TIME                  | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE | 2023-05-06 15:14:10.951435 | NULL                       | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 10:51:49.795243 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE | 2023-05-06 15:07:46.780470 | NULL                       | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 10:47:29.100244 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.73 |     2882 |  3 | zone3 |     2881 | NO              | ACTIVE | 2023-05-07 08:31:09.520473 | 2023-05-08 11:24:06.614613 | NULL                  | 2023-04-24 18:32:52.252549 | 2023-05-08 11:24:06.615642 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

 

192.168.1.73节点转储

mysql> alter system minor freeze server=('192.168.1.73:2882');
Query OK, 0 rows affected (0.38 sec)

 

停止192.168.1.73节点observer进程

[admin]# kill -9 `pidof observer`

 

查看节点信息,192.168.1.73节点STATUS值为INACTIVE

mysql> select * from DBA_OB_SERVERS;
+--------------+----------+----+-------+----------+-----------------+----------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS   | START_SERVICE_TIME         | STOP_TIME                  | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+----------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE   | 2023-05-06 15:14:10.951435 | NULL                       | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 10:51:49.795243 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE   | 2023-05-06 15:07:46.780470 | NULL                       | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 10:47:29.100244 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.73 |     2882 |  3 | zone3 |     2881 | NO              | INACTIVE | NULL                       | 2023-05-08 11:24:06.614613 | NULL                  | 2023-04-24 18:32:52.252549 | 2023-05-08 11:29:24.505694 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+----------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

 

启动192.168.1.73节点observer进程

[admin]# cd oceanbase && bin/observer 
bin/observer

 

查看节点信息,192.168.1.73节点状态为ACTIVE,但是STOP_TIME非NULL

mysql> select * from DBA_OB_SERVERS;
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME         | STOP_TIME                  | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE | 2023-05-06 15:14:10.951435 | NULL                       | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 10:51:49.795243 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE | 2023-05-06 15:07:46.780470 | NULL                       | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 10:47:29.100244 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.73 |     2882 |  3 | zone3 |     2881 | NO              | ACTIVE | 2023-05-08 11:35:10.957506 | 2023-05-08 11:24:06.614613 | NULL                  | 2023-04-24 18:32:52.252549 | 2023-05-08 11:35:11.763387 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+----------------------------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

 

启动节点

mysql> alter system start server '192.168.1.73:2882';
Query OK, 0 rows affected (0.22 sec)

 

再次查看节点信息,192.168.1.73节点状态为ACTIVE,STOP_TIME为NULL

mysql> select * from DBA_OB_SERVERS;
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| SVR_IP       | SVR_PORT | ID | ZONE  | SQL_PORT | WITH_ROOTSERVER | STATUS | START_SERVICE_TIME         | STOP_TIME | BLOCK_MIGRATE_IN_TIME | CREATE_TIME                | MODIFY_TIME                | BUILD_VERSION                                                                             |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+
| 192.168.1.71 |     2882 |  1 | zone1 |     2881 | NO              | ACTIVE | 2023-05-06 15:14:10.951435 | NULL      | NULL                  | 2023-04-24 18:32:52.606554 | 2023-05-08 10:51:49.795243 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.72 |     2882 |  2 | zone2 |     2881 | YES             | ACTIVE | 2023-05-06 15:07:46.780470 | NULL      | NULL                  | 2023-04-24 18:32:52.245134 | 2023-05-08 10:47:29.100244 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
| 192.168.1.73 |     2882 |  3 | zone3 |     2881 | NO              | ACTIVE | 2023-05-08 11:35:10.957506 | NULL      | NULL                  | 2023-04-24 18:32:52.252549 | 2023-05-08 12:29:42.901130 | 4.0.0.0_100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be(Nov  1 2022 14:57:18) |
+--------------+----------+----+-------+----------+-----------------+--------+----------------------------+-----------+-----------------------+----------------------------+----------------------------+-------------------------------------------------------------------------------------------+

 

参考:https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001697237