暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

OceanBase 单点实验环境部署

原创 董小姐 2024-06-22
559

背景信息

OceanBase 数据库自 V4.0.0 开始提供统一的安装包 all-in-one package。可以通过这个统一的安装包一次性完成 OBD、OceanBase 数据库、ODP、OBAgent、Grafana、Prometheus 的安装,自 V4.1.0 起,all-in-one package 新增支持安装 OCP Express。可以根据实际需求选择部分或全部组件安装。

前提条件

在参考本文安装 OceanBase 数据库之前,确保软硬件环境满足以下要求:

项目

描述

系统

  • Anolis OS 8.X 版本(内核 Linux 3.10.0 版本及以上)
  • Red Hat Enterprise Linux Server 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上)
  • CentOS Linux 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上)
  • Debian 9.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)
  • Ubuntu 20.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)
  • SUSE / OpenSUSE 15.X 版本及以上版本(内核 Linux 3.10.0 版本及以上)
  • openEuler 22.03 和 24.03 版本(内核 Linux 5.10.0 版本及以上)
  • KylinOS V10 版本
  • 统信 UOS 1020a/1021a/1021e/1001c 版本
  • 中科方德 NFSChina 4.0 版本及以上
  • 浪潮 Inspur kos 5.8 版本

说明

通过源仓库安装 OceanBase 数据库时仅支持以下系统:

  • Anolis OS 8.X 版本(内核 Linux 3.10.0 版本及以上)
  • CentOS Linux 7.X 版本、8.X 版本(内核 Linux 3.10.0 版本及以上)
  • Debian 10、11 和 12 版本(内核 Linux 3.10.0 版本及以上)
  • openEuler 22.03 和 24.03 版本(内核 Linux 5.10.0 版本及以上)
  • Ubuntu 18.04、20.04 和 22.04 版本(内核 Linux 3.10.0 版本及以上)

CPU

最低要求 2 核,推荐 4 核及以上。

内存

最低要求 6 GB,推荐设置在 16 GB 至 1024 GB 范围内。

磁盘类型

推荐使用 SSD 存储。

磁盘存储空间

最低要求 20 GB。

文件系统

EXT4 戓 XFS,当数据超过 16T 时,使用 XFS。

all-in-one 安装包

  • 若选择使用 obd demo 命令部署单机 OceanBase 数据库,all-in-one 安装包选择 V4.0.0 及以上版本即可。
  • 若使用 OBD 白屏界面部署分布式 OceanBase 集群,all-in-one 安装包需选择 V4.1.0 及以上版本。

说明

以下内容以 x86 架构的 CentOS Linux 7.9 主机作为环境,其他环境可能略有不同。

方案一:部署 OceanBase Demo 环境

当仅拥有一台可用机器时,该机器需要能访问外网,可参考本节内容通过 YUM 源安装 OceanBase 数据库,或使用 obd demo 命令快速部署单机 OceanBase 数据库。

法一:通过源仓库在线自动安装 OceanBase 数据库

说明:本方法仅快速安装 OceanBase 数据库

本方法所使用的机器系统需是基于 RPM 包管理的 Linux 发行版(如 CentOS、Red Hat Enterprise Linux 或 Fedora),在这些机器上,您可以利用 YUM 包管理器执行单节点安装。此外,您可以使用 systemd 服务管理系统来控制 OceanBase 数据库服务的启动、停止和重启操作,并配置服务器的自启动。

您可直接执行如下命令自动安装最新的 LTS 版本。该命令会在脚本中执行本节下述中的所有步骤,并进行一些简单检查,如系统参数检查、磁盘空间检查等。

--创建用户
useradd admin
passwd admin

--允许用户在不输入该用户的密码的情况下使用所有命令
vi /etc/sudoers
root    ALL=(ALL)       ALL
admin   ALL=(ALL)       ALL

--切换到admin用户
su - admin

--一键安装最新的 OceanBase  LTS 版本
sudo bash -c "$(curl -s https://obcommunityprod.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase/x3/installer.sh)"

安装以下组件:

obclient.x86_64 0:2.2.6-1.el7

oceanbase-ce.x86_64 0:4.2.1.7-107000162024060611.el7

oceanbase-ce-libs.x86_64 0:4.2.1.7-107000162024060611.el7

问题报错

--问题描述
安装到最后一直重复,OceanBase 数据库未正常启动
......
yum installer: Attempt 122/200: Waiting for the oceanbase service to be ready...
yum installer: Attempt 200/200: Waiting for the oceanbase service to be ready...
yum installer: Maximum attempts reached (200). The oceanbase service is not ready. Please check the logs for more information.
......

--排查思路
查看进程
[root@localhost ~]# ps -ef |grep observer
root       2543      1 18 17:11 ?        00:03:39 /home/admin/oceanbase/bin/observer -c 1 -z zone1 -p 2881 -n ob -d /home/admin/oceanbase/store -I 192.168.40.53 -P 2882 -o __min_full_resource_pool_memory=1073741824,datafile_maxsize=20G,datafile_next=2G,cpu_count=16,enable_syslog_recycle=true,log_disk_size=13G,max_syslog_file_count=4,memory_limit=6G,datafile_size=2G,enable_syslog_wf=false,system_memory=1G
root       4891   1332  0 17:31 pts/1    00:00:00 grep --color=auto observer

查看一下监听
[root@localhost ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1024/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1161/master
tcp        0      0 0.0.0.0:2881            0.0.0.0:*               LISTEN      2543/observer
tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      2543/observer
tcp        0      0 192.168.40.53:2886      0.0.0.0:*               LISTEN      2452/obshell
tcp6       0      0 :::22                   :::*                    LISTEN      1024/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1161/master

查看一下内存
[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.8G        2.0G        4.4G         11M        1.4G        5.5G
Swap:          2.0G          0B        2.0G

查看一下文件系统
[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G   12M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   38G   18G   20G  47% /
/dev/sda1                497M  131M  367M  27% /boot
tmpfs                    797M     0  797M   0% /run/user/0
/dev/sr0                 4.4G  4.4G     0 100% /mnt

--查看oceanbase服务状态
[root@localhost ~]# systemctl status oceanbase
● oceanbase.service - oceanbase
   Loaded: loaded (/etc/systemd/system/oceanbase.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2024-06-22 17:13:03 CST; 5min ago
 Main PID: 2543 (observer)
   CGroup: /system.slice/oceanbase.service
           ├─2437 /home/admin/oceanbase/bin/obshell daemon --ip 192.168.40.53 --port 2886
           ├─2452 /home/admin/oceanbase/bin/obshell server --ip 192.168.40.53 --port 2886
           └─2543 /home/admin/oceanbase/bin/observer -c 1 -z zone1 -p 2881 -n ob -d /home/admin/oceanbase/store -I 192.168.40.53 -P 2882 -o __min_full_resource_pool_memory=1073741824,datafile_maxsize=20G,datafile_next=2G,cpu_count=16...

Jun 22 17:12:37 localhost.localdomain bash[1884]: wait 6s and the retry
Jun 22 17:12:43 localhost.localdomain bash[1884]: the response state is RUNNING
Jun 22 17:12:43 localhost.localdomain bash[1884]: wait 6s and the retry
Jun 22 17:12:49 localhost.localdomain bash[1884]: the response state is RUNNING
Jun 22 17:12:49 localhost.localdomain bash[1884]: wait 6s and the retry
Jun 22 17:12:55 localhost.localdomain bash[1884]: the response state is RUNNING
Jun 22 17:12:55 localhost.localdomain bash[1884]: wait 6s and the retry
Jun 22 17:13:01 localhost.localdomain bash[1884]: the response state is SUCCEED
Jun 22 17:13:01 localhost.localdomain bash[1884]: start observer request successfully
Jun 22 17:13:03 localhost.localdomain systemd[1]: Started oceanbase.


--连接数据库
[admin@localhost ~]$ obclient -h192.168.40.53 -uroot@sys -P2881 -pdhh -Doceanbase -A
ERROR 1045 (42000): Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES)
[admin@localhost ~]$ obclient -h192.168.40.53 -uroot@sys -P2881  -Doceanbase -A
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221487626
Server version: OceanBase_CE 4.2.1.7 (r107000162024060611-69b64b84b656a4cfa126dab60b4e66dc1bc156ca) (Built Jun  6 2024 11:51:48)

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]> SELECT NOW(6);
+----------------------------+
| NOW(6)                     |
+----------------------------+
| 2024-06-22 17:30:40.573223 |
+----------------------------+
1 row in set (0.001 sec)

感觉这个提示可以忽略,因为服务状态、访问都正常。
法二:通过源仓库在线手动安装 OceanBase 数据库

说明:推荐安装 OceanBase 数据库 LTS 版本,其他版本可能会出现非预期问题。

--创建用户
useradd admin
passwd admin

--允许用户在不输入该用户的密码的情况下使用所有命令
vi /etc/sudoers
root    ALL=(ALL)       ALL
admin   ALL=(ALL)       ALL

--切换到admin用户
su - admin
安装 OceanBase YUM 仓库
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
安装 OceanBase 数据库
sudo yum install -y oceanbase-ce-libs-4.2.1.7 oceanbase-ce-4.2.1.7 obclient

目前 V4.2.1 为 LTS 版本,OceanBase 数据库实际版本号为 4 位,因此在执行 yum install 命令安装时需指定完整的四位版本号。您可通过 OceanBase 数据库 V4.2.1 版本发布记录 查看当前最新的 RPM 版本号。

启动和使用 OceanBase 数据库

在启动前您可以在 /etc/oceanbase.cnf 文件中修改 OceanBase 数据库的启动参数。OceanBase 数据库在首次启动前会加载 /etc/oceanbase.cnf 的配置,可通过修改该配置文件中的 root_pwd 设置 root@sys 用户的初始密码 。

  1. (可选)修改配置文件
sudo vi /etc/oceanbase.cnf

OceanBase 数据库在首次启动前会加载 /etc/oceanbase.cnf 的配置,可通过修改该配置文件中的 root_pwd 设置 root@sys 用户的初始密码 。

配置文件中配置项的详细介绍可参见《OceanBase 数据库》文档中 使用 systemd 部署 OceanBase 数据库 一文介绍。

/etc/oceanbase.cnf文件内容如下:

[root@localhost ~]# more /etc/oceanbase.cnf
# The IP can only be configured during the initial startup.
# By default, the IP is set to the output of hostname -i unless specified otherwise.
# To modify the observer IP after startup, you must uninstall OceanBase and remove the data directory.
# Afterward, you can reinstall and launch OceanBase with the new IP address.
# For instance, to set the observer IP to 127.0.0.1, you would use the line:
# ip=127.0.0.1
mysql_port=2881
rpc_port=2882
obshell_port=2886
root_pwd="dhh"
redo_dir=/var/lib/oceanbase/redo
data_dir=/var/lib/oceanbase/data
datafile_size=2G
datafile_next=2G
datafile_maxsize=20G
cpu_count=16
memory_limit=6G
system_memory=1G
log_disk_size=13G
enable_syslog_wf=false
enable_syslog_recycle=true
max_syslog_file_count=4
__min_full_resource_pool_memory=1073741824
  1. 修改 OceanBase 安装目录(默认是 /home/admin/oceanbase)下 etc 目录的属主
sudo chown root /home/admin/oceanbase/etc
  1. 启动 OceanBase 数据库
sudo systemctl start oceanbase
  1. 查看 OceanBase 数据库的启动状态
sudo systemctl status oceanbase

当状态显示为 Service is ready 时,表示 OceanBase 数据库已正常启动。

  1. 通过客户端连接 OceanBase 数据库
# 通过 2881 端口直连数据库
obclient -h127.0.0.1 -P2881 -uroot@sys -p{Passwd} -Doceanbase -A

# 通过 ODP 代理访问数据库
obclient -h127.0.0.1 -P2883 -uroot@sys -p{Passwd} -Doceanbase -A

IP 默认为 127.0.0.1,Port 为 /etc/oceanbase.cnf 中 mysql_port 的值,Passwd 为 /etc/oceanbase.cnf 中 root_pwd 的值。

示例:连接oceanbase

[admin@localhost ~]$ obclient -h192.168.40.53 -uroot@sys -P2881 -pdhh -Doceanbase -A
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221487624
Server version: OceanBase_CE 4.2.1.7 (r107000162024060611-69b64b84b656a4cfa126dab60b4e66dc1bc156ca) (Built Jun  6 2024 11:51:48)

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]> SELECT NOW(6);
+----------------------------+
| NOW(6)                     |
+----------------------------+
| 2024-06-22 15:19:09.304951 |
+----------------------------+
1 row in set (0.001 sec)
通过 systemd 管理 OceanBase 数据库

Systemd 可自动化管理 OceanBase 数据库的启动和停止,可通过 systemctl 指令对 OceanBase 数据库进行管理。

--启动和停止oceanbase
sudo systemctl {start|stop|restart|status} oceanbase

--将 OceanBase 数据库服务设置为开机自启动
sudo systemctl enable oceanbase
扩展:卸载 OceanBase 数据库

卸载 OceanBase 数据库时可根据实际情况选择卸载 OceanBase 数据库的二进制,或卸载 OceanBase 数据库并清除数据。

1) 自动卸载

--执行卸载脚本卸载 OceanBase 数据库
sudo bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/service/cleaner.sh)"

2)手动卸载

2.1. 卸载 OceanBase 数据库二进制

--卸载 OceanBase 数据库二进制
sudo yum remove -y oceanbase-ce

说明:OceanBase 数据库的数据会被保留,二次安装时可以使用这份数据再次启动 OceanBase 数据库。


2.2.清除 OceanBase 数据库数据

OceanBase 数据库默认的安装目录为 /home/admin/oceanbase,数据目录为 /var/lib/oceanbase(配置在 /etc/oceanbase.cnf 中)。

sudo rm -rf /home/admin/oceanbase 
sudo rm -rf /var/lib/oceanbase 
法三:使用 obd demo 命令快速部署 OceanBase 数据库
参数配置
[root@localhost ~]# echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf
[root@localhost ~]# echo -e "* soft nproc 120000\n* hard nproc 120000" >> /etc/security/limits.d/nproc.conf

重启操作系统生效

若未配置,后面部署过程中会提示如下报错:

Check before start observer x
[WARN] OBD-1011: (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[ERROR] OBD-1007: (127.0.0.1) The value of the ulimit parameter "open files" must not be less than 20000 (Current value: 1024), Please execute `echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf` as root in 127.0.0.1. if it dosen'twork, please check whether UsePAM is yes in /etc/ssh/sshd_config.
[ERROR] OBD-1007: (127.0.0.1) The value of the ulimit parameter "max user processes" must not be less than 120000 (Current value: 31760), Please execute `echo -e "* soft nproc 120000\n* hard nproc 120000" >> /etc/security/limits.d/nproc.conf` as root in 127.0.0.1. if it dosen't work, please check whether UsePAM is yes in /etc/ssh/sshd_config.
下载并安装 all-in-one 安装包
  • 若机器需要连接网络,可执行如下命令在线下载并安装 all-in-one 安装包
bash -c "$(curl -s https://obcommunityprod.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/x3/installer.sh)"
source ~/.oceanbase-all-in-one/bin/env.sh
  • 若机器不能连接网络,可从 OceanBase 软件下载中心 下载最新的 all-in-one package 安装包,将其上传到机器任一目录下,在该目录下执行如下命令解压安装包并安装。
tar -xzf oceanbase-all-in-one-*.tar.gz
cd oceanbase-all-in-one/bin/
./install.sh
source ~/.oceanbase-all-in-one/bin/env.sh
单机部署 OceanBase 数据库
  1. 快速部署 OceanBase 数据库
obd demo

obd demo 命令默认在当前家目录下以最小规格部署并启动 OceanBase 数据库及相关组件(包括 ODP、OBAgent、Grafana 和 Prometheus),固定部署名为 demo。如需更多定制化的部署形式,参见 快速部署命令

您也可以使用 OBD 命令管理该 OceanBase 数据库,详细命令介绍请参考 集群命令组

部署配置是一份 yaml 文件,里面包含各个整个部署的全部配置信息,包括服务器登录信息、组件信息、组件配置信息和组件服务器列表等。

说明

当安装 grafana 或 prometheus 时,会输出 grafana 或 prometheus 的访问地址。在阿里云或其他云环境下,可能出现因无法获取公网 IP 而输出内网地址的情况,此 IP 非公网地址,您需要使用正确的地址。

安装详细过程如下:

[root@localhost ~]# obd demo
Get local repositories ok
Open ssh connection ok
Check for standby tenant ok
Search plugins ok
Cluster status check ok
obproxy work dir cleaning ok
obagent work dir cleaning ok
grafana work dir cleaning ok
prometheus work dir cleaning ok
observer work dir cleaning ok
demo destroyed
Cluster param config check ok
Open ssh connection ok
Generate obproxy configuration ok
Generate obagent configuration ok
Generate observer configuration ok
Generate grafana configuration ok
Generate prometheus configuration ok
+--------------------------------------------------------------------------------------------+
|                                          Packages                                          |
+--------------+---------+------------------------+------------------------------------------+
| Repository   | Version | Release                | Md5                                      |
+--------------+---------+------------------------+------------------------------------------+
| prometheus   | 2.37.1  | 10000102022110211.el7  | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
| grafana      | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
| oceanbase-ce | 4.3.1.0 | 100000032024051615.el7 | f3cd399aa780d23fbb60faed68e32a7dbd4e6a3c |
| obagent      | 4.2.2   | 100000042024011120.el7 | 19739a07a12eab736aff86ecf357b1ae660b554e |
| obproxy-ce   | 4.2.3.0 | 3.el7                  | 0490ebc04220def8d25cb9cac9ac61a4efa6d639 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Cluster status check ok
Initializes prometheus work home ok
Initializes grafana work home ok
Initializes observer work home ok
Initializes obagent work home ok
Initializes obproxy work home ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Remote oceanbase-ce-4.3.1.0-100000032024051615.el7-f3cd399aa780d23fbb60faed68e32a7dbd4e6a3c repository install ok
Remote oceanbase-ce-4.3.1.0-100000032024051615.el7-f3cd399aa780d23fbb60faed68e32a7dbd4e6a3c repository lib check !!
Remote obagent-4.2.2-100000042024011120.el7-19739a07a12eab736aff86ecf357b1ae660b554e repository install ok
Remote obagent-4.2.2-100000042024011120.el7-19739a07a12eab736aff86ecf357b1ae660b554e repository lib check ok
Remote obproxy-ce-4.2.3.0-3.el7-0490ebc04220def8d25cb9cac9ac61a4efa6d639 repository install ok
Remote obproxy-ce-4.2.3.0-3.el7-0490ebc04220def8d25cb9cac9ac61a4efa6d639 repository lib check ok
Try to get lib-repository
Remote oceanbase-ce-libs-4.3.1.0-100000032024051615.el7-68f0b5f988bd5fb80d44ac29afad0c2b2f2d3763 repository install ok
Remote oceanbase-ce-4.3.1.0-100000032024051615.el7-f3cd399aa780d23fbb60faed68e32a7dbd4e6a3c repository lib check ok
demo deployed
Get local repositories ok
Search plugins ok
Load cluster param plugin ok
Open ssh connection ok
Check before start observer ok
[WARN] OBD-1011: (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] OBD-1007: (127.0.0.1) The recommended number of open files is 655350 (Current value: 20000)
[WARN] OBD-1007: (127.0.0.1) The recommended number of max user processes is 655350 (Current value: 120000)
[WARN] OBD-1007: (127.0.0.1) The recommended number of core file size is unlimited (Current value: 0)
[WARN] OBD-1007: (127.0.0.1) The recommended number of stack size is unlimited (Current value: 8192)
[WARN] OBD-1017: (127.0.0.1) The value of the "vm.max_map_count" must be within [327600, 1310720] (Current value: 65530, Recommended value: 655360)
[WARN] OBD-1017: (127.0.0.1) The value of the "fs.file-max" must be greater than 6573688 (Current value: 777793, Recommended value: 6573688)
[WARN] OBD-1012: (127.0.0.1) clog and data use the same disk (/)

Check before start obagent ok
Check before start obproxy ok
Check before start prometheus ok
Check before start grafana ok
Start observer ok
observer program health check ok
Connect to observer 127.0.0.1:2881 ok
Initialize oceanbase-ce ok
Start obagent ok
obagent program health check ok
Connect to Obagent ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize obproxy-ce 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
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.3.1.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase -A

+--------------------------------------------------------------+
|                           obagent                            |
+-----------+--------------------+--------------------+--------+
| ip        | mgragent_http_port | monagent_http_port | status |
+-----------+--------------------+--------------------+--------+
| 127.0.0.1 | 8089               | 8088               | active |
+-----------+--------------------+--------------------+--------+
+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A

+--------------------------------------------------+
|                    prometheus                    |
+-----------------------+------+----------+--------+
| url                   | user | password | status |
+-----------------------+------+----------+--------+
| http://127.0.0.1:9090 |      |          | active |
+-----------------------+------+----------+--------+
+-----------------------------------------------------------------+
|                             grafana                             |
+-----------------------------------+-------+------------+--------+
| url                               | user  | password   | status |
+-----------------------------------+-------+------------+--------+
| http://127.0.0.1:3000/d/oceanbase | admin | evyOTVHsdm | active |
+-----------------------------------+-------+------------+--------+
demo running
Trace ID: 4c817154-307d-11ef-9578-000c29493cc7
If you want to view detailed obd logs, please run: obd display-trace 4c817154-307d-11ef-9578-000c29493cc7
  1. 使用 OBClient 客户端连接到 OceanBase 数据库
# 通过 2881 端口直连数据库
obclient -h127.0.0.1 -P2881 -uroot@sys -p{Passwd} -Doceanbase -A

# 通过 ODP 代理访问数据库
obclient -h127.0.0.1 -P2883 -uroot@sys -p{Passwd} -Doceanbase -A
补充:常用obd命令

--查看帮助信息
obd -h/--help

--修改一个部署配置,当部署配置不存在时创建  参数 deploy name 为部署名,可以理解为配置文件的别名
obd cluster edit-config <deploy name>
示例:obd cluster edit-config test

--重载一个运行中集群。当您使用 edit-config 修改一个运行的集群的配置信息后,可以通过 reload 命令应用修改
obd cluster reload <deploy name>

示例:obd cluster reload test
注意:并非全部的配置项都可以通过 reload 来应用。有些配置项需要重启集群,甚至是重新部署集群才能生效。请根据 edit-config 后返回的信息进行操作。

--重启一个运行中集群  选项 -f 为 --force-kill。作用为:检查到工作目录下有运行中的进程时,强制停止进程。
obd cluster restart <deploy name> [-f]

示例:obd cluster restart test -c obproxy-ce --wp


--显示当前 OBD 内注册的全部集群(deploy name)的状态
obd cluster list

--展示指定集群的状态  参数 deploy name 为部署名,可以理解为配置文件的别名
obd cluster display <deploy name>

示例:obd cluster display test

--停止一个运行中的集群  参数 deploy name 为部署名,可以理解为配置文件的别名
obd cluster stop <deploy name>

示例:obd cluster stop test -s server1

--销毁已部署的集群  -f 为 --force-kill。作用为:检查到工作目录下有运行中的进程时,强制停止进程。
obd cluster stop <deploy name>   先停止
obd cluster destroy <deploy name> [-f] 
最后修改时间:2024-06-24 10:17:21
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论