一名数据库爱好者

一名数据库爱好者

OceanBase服务

使用obd重启

查看OB服务名

admin@server070 oceanbase-ce]$ obd cluster list
+--------------------------------------------------------+
|                      Cluster List                      |
+------+-------------------------------+-----------------+
| Name | Configuration Path            | Status (Cached) |
+------+-------------------------------+-----------------+
| demo | /home/admin/.obd/cluster/demo | running         |
+------+-------------------------------+-----------------+
Trace ID: 309b2d6c-ece0-11ee-a80c-000c2910d46f
If you want to view detailed obd logs, please run: obd display-trace 309b2d6c-ece0-11ee-a80c-000c2910d46f
[admin@server070 oceanbase-ce]$

重启(所有服务)

[admin@server070 oceanbase-ce]$ obd cluster restart demo
Get local repositories and plugins ok
Load cluster param plugin ok
Open ssh connection ok
Cluster status check ok
Check before restart observer ok
Connect to observer x
[ERROR] OBD-1006: Failed to connect to oceanbase-ce


Observer restart ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.2.2.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase -A


Check before start obagent ok
Stop obagent ok
Check before start obagent ok
Start obagent ok
obagent program health check ok
Connect to Obagent ok
+--------------------------------------------------------------+
|                           obagent                            |
+-----------+--------------------+--------------------+--------+
| ip        | mgragent_http_port | monagent_http_port | status |
+-----------+--------------------+--------------------+--------+
| 10.0.0.70 | 8089               | 8088               | active |
+-----------+--------------------+--------------------+--------+
Check before start obproxy ok
Stop obproxy ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A


Check before start prometheus ok
Stop prometheus ok
Start promethues ok
prometheus program health check ok
Connect to prometheus ok
+--------------------------------------------------+
|                    prometheus                    |
+-----------------------+------+----------+--------+
| url                   | user | password | status |
+-----------------------+------+----------+--------+
| http://10.0.0.70:9090 |      |          | active |
+-----------------------+------+----------+--------+
Check before start grafana ok
Stop grafana ok
Start grafana ok
grafana program health check ok
Connect to Grafana ok
+-----------------------------------------------------------------+
|                             grafana                             |
+-----------------------------------+-------+------------+--------+
| url                               | user  | password   | status |
+-----------------------------------+-------+------------+--------+
| http://10.0.0.70:3000/d/oceanbase | admin | maXVcAyK64 | active |
+-----------------------------------+-------+------------+--------+
demo restart
Trace ID: 593c3dce-ece0-11ee-85be-000c2910d46f
If you want to view detailed obd logs, please run: obd display-trace 593c3dce-ece0-11ee-85be-000c2910d46f
[admin@server070 oceanbase-ce]$
[admin@server070 oceanbase-ce]$

重启(指定服务)

使用 -c 指定服务来重启,这里指定 oceanbase-ce 重启

[admin@server070 oceanbase-ce]$ obd cluster restart demo -c oceanbase-ce 
Get local repositories and plugins ok
Load cluster param plugin ok
Open ssh connection ok
Cluster status check ok
Check before restart observer ok
Connect to observer x
[ERROR] OBD-1006: Failed to connect to oceanbase-ce


Observer restart ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.2.2.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase -A


succeed
Trace ID: 091ce1c0-ece2-11ee-9b14-000c2910d46f
If you want to view detailed obd logs, please run: obd display-trace 091ce1c0-ece2-11ee-9b14-000c2910d46f
[admin@server070 oceanbase-ce]$
[admin@server070 oceanbase-ce]$

也可以使用 -s 指定重启的具体节点

obd cluster restart demo -c oceanbase-ce -s 127.0.0.1
手动重启

停止节点服务

obclient [oceanbase]> alter system stop server '127.0.0.1:2882';
obclient [oceanbase]> ALTER SYSTEM  MINOR FREEZE SERVER = ('127.0.0.1:2882');                   ----进行转储

注意: 单机条件下 不满足paxos协议,此操作不允许

停掉 observer 进程

kill  xxx

重启

cd /home/admin/oceanbase-ce
./bin/observer

obproxy重启

使用obd重启

可以使用 -s 指定 特定节点 的obproxy 重启

[admin@server070 oceanbase-ce]$ obd cluster restart demo -c obproxy-ce -s 127.0.0.1
Get local repositories and plugins ok
Load cluster param plugin ok
Open ssh connection ok
Cluster status check ok
Check before start obproxy ok
Stop obproxy ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A


succeed
Trace ID: ec2765e0-ece1-11ee-934b-000c2910d46f
If you want to view detailed obd logs, please run: obd display-trace ec2765e0-ece1-11ee-934b-000c2910d46f
[admin@server070 oceanbase-ce]$
[admin@server070 oceanbase-ce]$
[admin@server070 oceanbase-ce]$

手动重启

obporxy-ce进程obproxyd守护进程 杀掉

[admin@server070 ~]$ ps -ef|grep obproxy |grep -v grep
admin    15091     1  0 17:02 pts/0    00:00:01 bash /home/admin/obproxy-ce/obproxyd.sh /home/admin/obproxy-ce 127.0.0.1 2883 daemon
admin    15110     1  1 17:02 ?        00:00:39 /home/admin/obproxy-ce/bin/obproxy --listen_port 2883
[admin@server070 ~]$
[admin@server070 ~]$
[admin@server070 ~]$
[admin@server070 ~]$
[admin@server070 ~]$ kill 15091
[admin@server070 ~]$
[admin@server070 ~]$
[admin@server070 ~]$
[admin@server070 ~]$ kill 15110
[admin@server070 ~]$
[admin@server070 ~]$

启动 obproxy 节点

[admin@server070 ~]$ cd /home/admin/obproxy-ce/
[admin@server070 obproxy-ce]$ ./bin/obproxy
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$ chmod 733 obproxyd.sh
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$ sh obproxyd.sh  /home/admin/obproxy-ce 127.0.0.1 2883
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$ ps -ef | grep obproxy | grep -v grep
admin    27105     1  2 17:37 ?        00:00:01 ./bin/obproxy
[admin@server070 obproxy-ce]$ ps -ef | grep obproxy
admin    27105     1  2 17:37 ?        00:00:02 ./bin/obproxy
admin    27451 15200  0 17:39 pts/0    00:00:00 grep --color=auto obproxy
[admin@server070 obproxy-ce]$
[admin@server070 obproxy-ce]$

验证

[admin@server070 oceanbase-ce]$ obclient -h127.0.0.1 -P2883 -uroot@obmysql    -Doceanbase -c  -A -paaAA11__
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 1
Server version: OceanBase_CE 4.2.2.0 (r100000192024011915-fac02c6690de9ff9f9f96c0bdf86ffe39ae0d7e7) (Built Jan 19 2024 15:14:05)


Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


obclient [oceanbase]>
obclient [oceanbase]>
04-01 02:29