OBD 全称是 OceanBase Deployer,是 OceanBase 社区版的命令行下自动化部署软件。 根据中控机器能否连接公网,提供两个安装方法:离线和在线。二选一。
安装 OBD 软件(离线)
首先在中控机上部署 OBD 软件。如果中控机不能上网,则需要提前下载好 OBD 、 OBSERVER 和 OBPROXY 相关软件包。
- 下载相关软件包
软件包地址请根据 OS 版本自行选择。
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/ob-deploy-1.1.0-1.el8.x86_64.rpm
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/oceanbase-ce-3.1.0-3.el8.x86_64.rpm
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/oceanbase-ce-libs-3.1.0-3.el8.x86_64.rpm
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/obclient-2.0.0-2.el8.x86_64.rpm
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/libobclient-2.0.0-2.el8.x86_64.rpm
wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/obproxy-3.1.0-1.el8.x86_64.rpm
将上面文件都复制到中控机上临时目录。
- 离线安装 OBD
[admin@obce00 obd]$ sudo rpm -ivh ob-deploy-1.1.0-1.el8.x86_64.rpm
[sudo] password for admin:
warning: ob-deploy-1.1.0-1.el8.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e9b4a7aa: NOKEY
Verifying... ################# []
Preparing... ################# []
Updating / installing...
1:ob-deploy-1.1.0-1.el8 ################# []
Installation of obd finished successfully
Please source /etc/profile.d/obd.sh to enable it
[admin@obce00 obd]$ source /etc/profile.d/obd.sh
[admin@obce00 obd]$ which obd
/usr/bin/obd
ob-deploy
软件默认安装在 /usr/obd
下。不同版本可能有点变化。可以通过下面命令查看位置。
rpm -ql `rpm -qa|grep ob-deploy`
但是 OBD 工作的文件都在当前用户 HOME 目录下:~/.obd/
[admin@obce00 ~]$ tree ~/.obd -L 1
/home/admin/.obd
├── cluster
├── log
├── mirror
├── obd.conf
├── plugins
├── repository
└── version
5 directories, 2 files
命令 obd
使用帮助,可以直接用 -h
查看。
obd -h
输出:
[admin@obce00 ~]$ obd -h
Usage: obd <command> [options]
Available commands:
cluster Deploy and manage a cluster.
mirror Manage a component repository for OBD.
repo Manage local repository for OBD.
test Run test for a running deploy deployment.
update Update OBD.
Options:
--version show program's version number and exit
-h, --help Show help and exit.
-v, --verbose Activate verbose output.
- 将软件包加到离线仓库
首先要删除远程仓库,使用下面命令。 注意:下面命令要在部署运行 OBD 的操作系统用户下操作。这里是用户 admin
。
/bin/rm -rf ~/.obd/mirror/remote/OceanBase.repo
然后将前面的软件包都复制到本地仓库,使用下面命令。
obd mirror clone /tmp/obd/*.rpm
查看仓库的 RPM 列表。
obd mirror list local
输出:
[admin@obce00 ~]$ obd mirror list local
+-------------------------------------------------------------------------------------------+
| local Package List |
+-------------------+---------+---------+--------+------------------------------------------+
| name | version | release | arch | md5 |
+-------------------+---------+---------+--------+------------------------------------------+
| libobclient | 2.0.0 | 2.el8 | x86_64 | 358a90b4a47da193140c3bee023b2450126de4c6 |
| obclient | 2.0.0 | 2.el8 | x86_64 | 71753559d82e9f6c0b8a6d949b9a5194c6c53dc6 |
| ob-deploy | 1.1.0 | 1.el8 | x86_64 | 0c84129b699aca0b43fdfb01fb2c4439f36ff856 |
| obproxy | 3.1.0 | 1.el8 | x86_64 | d242ea5fe45222b8f61c3135ba2aaa778c61ea22 |
| oceanbase-ce | 3.1.0 | 3.el8 | x86_64 | 84bd2fe27f8b8243cc57d8a3f68b4c50f94aab80 |
| oceanbase-ce-libs | 3.1.0 | 3.el8 | x86_64 | 1c20be0df8929f843e9bdd509de4916f883d62f8 |
+-------------------+---------+---------+--------+------------------------------------------+
[admin@obce00 ~]$
安装 OBD 软件(在线)
首先在中控机上部署 OBD 软件。如果中控机能上网,则可以直接添加 OceanBase 的仓库,使用 YUM 安装。
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
yum install -y ob-deploy
查看一下 OceanBase.repo
内容。
cat /etc/yum.repos.d/OceanBase.repo
输出:
# OceanBase.repo
[oceanbase.community.stable]
name=OceanBase-community-stable-el$releasever
baseurl=http://mirrors.aliyun.com/oceanbase/community/stable/el/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/oceanbase/RPM-GPG-KEY-OceanBase
[oceanbase.development-kit]
name=OceanBase-development-kit-el$releasever
baseurl=http://mirrors.aliyun.com/oceanbase/development-kit/el/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/oceanbase/RPM-GPG-KEY-OceanBase