首页  :: 新随笔  :: 管理

使用obd demo快速部署单副本oceanbase集群(在线)

Posted on 2023-04-18 17:47  高&玉  阅读(441)  评论(0编辑  收藏  举报

环境介绍:

  • centos 7.6
  • 可用内存不少于8G
  • 安装目录空间不少于50G(默认安装在当前安装用户的家目录下)

 

1. 什么是obd?

odb是oceanbase社区版部署工具oceanbase deployer的简称,通过obd可以快速完成oceanbase clusterr的部署。

在不传入配置文件的情况下,执行obd demo快速部署(默认使用远程仓库,需要联网)oceanbase cluster的最新版本,集群名称是demo。

使用obd demo在线快速部署安装,默认安装的组件:grafana、obproxy-ce、oceanbase-ce、obagent、prometheus,组件是当前最新版本。

 

2. 下载ob-deploy并安装

https://www.oceanbase.com/softwarecenter

[root]# rpm -ivh ob-deploy-2.0.0-10.el7.x86_64.rpm

或者

[root]# yum install -y yum-utils
[root]# yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
[root]# yum install -y ob-deploy

 

3. 执行obd demo快速部署

[root]# obd demo

或者

[root]# obd demo -c oceanbase-ce,obproxy-ce,obagent,prometheus,grafana --home_path=/root/
Cluster param config check ok
Open ssh connection ok
Generate grafana configuration ok
Generate obproxy configuration ok
Generate observer configuration ok
Generate obagent configuration ok
Generate prometheus configuration ok
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| obproxy-ce   | 4.1.0.0 | 7.el7                  | 2a9d9bf67f179dcca2a8c9e7c77373d94e7e2abe |
| oceanbase-ce | 4.1.0.0 | 100000192023032010.el7 | 8439ecf8db5e0649bd49671b41ea9e8c85756b63 |
| obagent      | 1.3.0   | 22.el7                 | d57fbb4962b2fbecb6282358c59295fdfba4d6ac |
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes grafana work home ok
Initializes obproxy work home ok
Initializes observer work home ok
Initializes obagent work home ok
Initializes prometheus work home ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Remote obproxy-ce-4.1.0.0-7.el7-2a9d9bf67f179dcca2a8c9e7c77373d94e7e2abe repository install ok
Remote obproxy-ce-4.1.0.0-7.el7-2a9d9bf67f179dcca2a8c9e7c77373d94e7e2abe repository lib check ok
Remote oceanbase-ce-4.1.0.0-100000192023032010.el7-8439ecf8db5e0649bd49671b41ea9e8c85756b63 repository install ok
Remote oceanbase-ce-4.1.0.0-100000192023032010.el7-8439ecf8db5e0649bd49671b41ea9e8c85756b63 repository lib check !!
Remote obagent-1.3.0-22.el7-d57fbb4962b2fbecb6282358c59295fdfba4d6ac repository install ok
Remote obagent-1.3.0-22.el7-d57fbb4962b2fbecb6282358c59295fdfba4d6ac repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Try to get lib-repository
Package oceanbase-ce-libs-4.1.0.0-100000192023032010.el7 is available.
install oceanbase-ce-libs-4.1.0.0 for local ok
Remote oceanbase-ce-libs-4.1.0.0-100000192023032010.el7-a83b1dd1cab44d3f610d439931322be7a08555f2 repository install ok
Remote oceanbase-ce-4.1.0.0-100000192023032010.el7-8439ecf8db5e0649bd49671b41ea9e8c85756b63 repository lib check ok
demo deployed
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] OBD-1012: (127.0.0.1) clog and data use the same disk (/)

Check before start obagent ok
Check before start prometheus ok
Check before start grafana ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize oceanbase-ce ok
Start obagent ok
obagent program health check ok
Connect to Obagent ok
Start promethues ok
prometheus program health check ok
Connect to Prometheus ok
Initialize prometheus ok
Start grafana ok
grafana program health check ok
Connect to grafana ok
Initialize grafana ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize obproxy-ce ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.1.0.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase -A

+-----------------------------------------------------------------+
|                             obagent                             |
+--------------+--------------------+--------------------+--------+
| ip           | mgragent_http_port | monagent_http_port | status |
+--------------+--------------------+--------------------+--------+
| 192.168.1.71 | 8089               | 8088               | active |
+--------------+--------------------+--------------------+--------+
+-----------------------------------------------------+
|                      prometheus                     |
+--------------------------+------+----------+--------+
| url                      | user | password | status |
+--------------------------+------+----------+--------+
| http://192.168.1.71:9090 |      |          | active |
+--------------------------+------+----------+--------+
+-------------------------------------------------------------------+
|                              grafana                              |
+--------------------------------------+-------+-----------+--------+
| url                                  | user  | password  | status |
+--------------------------------------+-------+-----------+--------+
| http://192.168.1.71:3000/d/oceanbase | admin | oceanbase | active |
+--------------------------------------+-------+-----------+--------+
+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A
demo running
Trace ID: 3056bf54-d834-11ed-9207-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 3056bf54-d834-11ed-9207-000c29501e19

 

4. 查看集群信息,集群名称为demo

[root]# obd cluster list
+--------------------------------------------------+
|                   Cluster List                   |
+------+-------------------------+-----------------+
| Name | Configuration Path      | Status (Cached) |
+------+-------------------------+-----------------+
| demo | /root/.obd/cluster/demo | running         |
+------+-------------------------+-----------------+
Trace ID: 9e0b5fee-d8d1-11ed-831e-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 9e0b5fee-d8d1-11ed-831e-000c29501e19

 

5. 查看demo集群组件信息

[root]# obd cluster display demo
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.1.0.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase -A

Connect to Obagent ok
+-----------------------------------------------------------------+
|                             obagent                             |
+--------------+--------------------+--------------------+--------+
| ip           | mgragent_http_port | monagent_http_port | status |
+--------------+--------------------+--------------------+--------+
| 192.168.1.71 | 8089               | 8088               | active |
+--------------+--------------------+--------------------+--------+
Connect to Prometheus ok
+-----------------------------------------------------+
|                      prometheus                     |
+--------------------------+------+----------+--------+
| url                      | user | password | status |
+--------------------------+------+----------+--------+
| http://192.168.1.71:9090 |      |          | active |
+--------------------------+------+----------+--------+
Connect to grafana ok
+-------------------------------------------------------------------+
|                              grafana                              |
+--------------------------------------+-------+-----------+--------+
| url                                  | user  | password  | status |
+--------------------------------------+-------+-----------+--------+
| http://192.168.1.71:3000/d/oceanbase | admin | oceanbase | active |
+--------------------------------------+-------+-----------+--------+
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
Trace ID: 36f87f38-d8d3-11ed-96c8-000c29501e19
If you want to view detailed obd logs, please run: obd display-trace 36f87f38-d8d3-11ed-96c8-000c29501e19
如果想查看obd的详细日志信息,请执行:
obd display-trace 36f87f38-d8d3-11ed-96c8-000c29501e19

 

6. 通过obclient连接oceanbase

[root]# obclient -h127.0.0.1 -P2881 -uroot -Doceanbase -A
Enter password: 
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221499392
Server version: OceanBase_CE 4.1.0.0 (r100000192023032010-0265dfc6d00ff4f0ff4ad2710504a18962abaef6) (Built Mar 20 2023 10:12:57)

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 [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LBACSYS            |
| mysql              |
| oceanbase          |
| ORAAUDITOR         |
| SYS                |
| test               |
+--------------------+
7 rows in set (0.027 sec)

 

7. 通过mysqlclient连接oceanbase

[root]# mysql --version
mysql  Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL)
[root]# mysql -h 192.168.1.71 -P2881 -uroot@sys -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3221499453
Server version: 5.7.25 OceanBase_CE 4.1.0.0 (r100000192023032010-0265dfc6d00ff4f0ff4ad2710504a18962abaef6) (Built Mar 20 2023 10:12:57)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LBACSYS            |
| mysql              |
| oceanbase          |
| ORAAUDITOR         |
| SYS                |
| test               |
+--------------------+
7 rows in set (0.02 sec)

 

8. 修改oceanbase密码,通过obd demo部署的集群密码默认为空

obclient [(none)]> select user,host,password from mysql.user;
+-------------+------+----------+
| user        | host | password |
+-------------+------+----------+
| root        | %    |          |
| proxyro     | %    |          |
| ocp_monitor | %    |          |
+-------------+------+----------+
obclient [(none)]> alter user 'root'@'%' identified by 'Gaoyu@029';
Query OK, 0 rows affected (0.15 sec)

 

参考:《oceanbase社区版入门与实战.pdf》