OceanBase数据库系列之:基于docker快速安装OceanBase数据库,基于linux服务

文章正文
发布时间:2025-05-12 21:27

OceanBase数据库系列之:基于docker快速安装OceanBase数据库,基于linux服务器快速部署OceanBase数据库

一、docker快速安装OceanBase数据库 下载OceanBase数据库镜像 docker pull quay.io/oceanbase/oceanbase-ce Using default tag: latest latest: Pulling from oceanbase/oceanbase-ce 54273d8675f3: Pull complete 4f4fb700ef54: Pull complete 60f355aa4c4a: Pull complete 83956aed8185: Pull complete 4176f17fd999: Pull complete e3c85a937235: Pull complete e6ea724d067d: Pull complete b8d3209d8507: Pull complete 7b0fa550991a: Pull complete 1c5387c2c4f3: Pull complete 09ba76e17c02: Pull complete fc02c604977f: Pull complete d2086fce6738: Pull complete 98688f58b462: Pull complete ba6dd33fbdab: Pull complete 0948ee851c16: Pull complete a0d8cbe81520: Pull complete beb4f43c14c8: Pull complete Digest: sha256:99f644dc221fd0b8fc685e67445f1e50cbbcb335cb9615e3cf5d3c14350ed815 Status: Downloaded newer image for quay.io/oceanbase/oceanbase-ce:latest quay.io/oceanbase/oceanbase-ce:latest 查看镜像 docker images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/oceanbase/oceanbase-ce latest d29ae3214fa3 2 months ago 649MB 启动OceanBase数据库

部署 mini 的独立实例

sudo docker run -p 2881:2881 --name obstandalone -e MODE=MINI -e OB_TENANT_PASSWORD=debezium1****6A -d quay.io/oceanbase/oceanbase-ce 查看OceanBase数据库是否启动成功

查看容器状态

docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 22b5690ec59e quay.io/oceanbase/oceanbase-ce "bash -c '/usr/sbin/…" 4 minutes ago Up 4 minutes 0.0.0.0:2881->2881/tcp obstandalone

启动预计需要 2~5 分钟。执行以下命令,确认是否启动成功

docker logs obstandalone | tail -1 observer program health check ok 二、基于linux部署OceanBase数据库

OceanBase 从 V4.0.0 开始提供统一的安装包 OceanBase All in One。目前包括 OceanBase 数据库软件和 OCP、obd、OBProxy(又称为 ODP)、OBClient、OCP Express(自 V4.1.0 起支持)、Prometheus、Grafana,以及诊断和测试工具。

在线安装obd bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)" add auto set env logic to profile: /root/.bash_profile ######################################################################################### Install Finished ========================================================================================= Setup Environment: source ~/.oceanbase-all-in-one/bin/env.sh Quick Start: obd demo Use Web Service to install: obd web Use Web Service to upgrade: obd web upgrade More Details: obd -h ========================================================================================= source ~/.oceanbase-all-in-one/bin/env.sh 配置 obd

obd 自带仓库信息,当机器可以连接网络时,无须配置,执行 obd mirror list 命令即可查看 obd 仓库中的软件。

查看 obd 仓库信息

输出如下:

obd mirror list +-----------------------------------------------------------------------------+ | Mirror Repository List | +----------------------------+--------+---------+----------+------------------+ | SectionName | Type | Enabled | Avaiable | Update Time | +----------------------------+--------+---------+----------+------------------+ | local | local | - | True | 2024-11-29 16:24 | | oceanbase.community.stable | remote | False | False | 1970-01-01 08:00 | | oceanbase.development-kit | remote | False | False | 1970-01-01 08:00 | +----------------------------+--------+---------+----------+------------------+ Use `obd mirror list <section name>` for more details Trace ID: 49f40ff6-ae2b-11ef-b877-5254006cf5ec If you want to view detailed obd logs, please run: obd display-trace 49f40ff6-ae2b-11ef-b877-5254006cf5ec

启用远程仓库

obd mirror enable remote Enable remote ok Trace ID: 040cc3d8-ae2c-11ef-a99c-5254006cf5ec If you want to view detailed obd logs, please run: obd display-trace 040cc3d8-ae2c-11ef-a99c-5254006cf5ec

查看 obd 仓库信息

obd mirror list Update OceanBase-community-stable-el7 ok Update OceanBase-development-kit-el7 ok +-----------------------------------------------------------------------------+ | Mirror Repository List | +----------------------------+--------+---------+----------+------------------+ | SectionName | Type | Enabled | Avaiable | Update Time | +----------------------------+--------+---------+----------+------------------+ | local | local | - | True | 2024-11-29 16:29 | | oceanbase.community.stable | remote | True | True | 2024-11-29 16:29 | | oceanbase.development-kit | remote | True | True | 2024-11-29 16:29 | +----------------------------+--------+---------+----------+------------------+ Use `obd mirror list <section name>` for more details Trace ID: 0903521c-ae2c-11ef-8606-5254006cf5ec If you want to view detailed obd logs, please run: obd display-trace 0903521c-ae2c-11ef-8606-5254006cf5ec

查看对应仓库中的软件信息

obd mirror list oceanbase.community.stable

执行 obd mirror list local 命令查看本地镜像库中的安装包

obd mirror list local +---------------------------------------------------------------------------------------------------------------------+ | local Package List | +---------------------------+-----------+------------------------+---------+------------------------------------------+ | name | version | release | arch | md5 | +---------------------------+-----------+------------------------+---------+------------------------------------------+ | grafana | 7.5.17 | 1 | x86_64 | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 | | obagent | 4.2.2 | 100000042024011120.el7 | x86_64 | 19739a07a12eab736aff86ecf357b1ae660b554e | | ob-configserver | 1.0.0 | 2.el7 | x86_64 | feca6b9c76e26ac49464f34bfa0780b5a8d3f4a0 | | ob-deploy | 2.10.1 | 1.el7 | x86_64 | 12bbe7e79275d8ff316769aa9fa909997771db5b | | obproxy-ce | 4.3.2.0 | 26.el7 | x86_64 | fd779e401be448715254165b1a4f7205c4c1bda5 | | ob-sysbench | 1.0.20 | 21.el7 | x86_64 | 34eb6ecba0ebc4c31c4cfa01162045cbbbec55f7 | | obtpcc | 5.0.0 | 1.el7 | x86_64 | 8624590be4bfe16f28bdd9fc5e4849cda19577d6 | | obtpch | 3.0.0 | 1.el7 | x86_64 | 3e3e88f87527677998fedf25087f5c87779dee62 | | oceanbase-ce | 4.2.1.8 | 108000022024072217.el7 | x86_64 | 499b676f2ede5a16e0c07b2b15991d1160d972e8 | | oceanbase-ce | 4.3.4.0 | 100000162024110717.el7 | x86_64 | 5d59e837a0ecff1a6baa20f72747c343ac7c8dce | | oceanbase-ce-libs | 4.2.1.8 | 108000022024072217.el7 | x86_64 | d02f4bfd321370a02550424293beb1be31204038 | | oceanbase-ce-libs | 4.3.4.0 | 100000162024110717.el7 | x86_64 | 8f0416a36198edfc7ec8edc3de765e21159dca54 | | oceanbase-ce-utils | 4.2.1.8 | 108000022024072217.el7 | x86_64 | 6f87392f95b399a21382323f256cfda5969375c4 | | oceanbase-ce-utils | 4.3.4.0 | 100000162024110717.el7 | x86_64 | db5fe222ae61e907aabede05c214d1cfef38a86f | | oceanbase-diagnostic-tool | 2.4.0 | 32024091010.el7 | x86_64 | 3817915bd36866590e1e6a74ad1c308817a6985e | | ocp-agent-ce | 4.3.2 | 20241012145836.el7 | aarch64 | 467f53472b5979c8b90cba439d780eee1510f084 | | ocp-agent-ce | 4.3.2 | 20241012145836.el7 | x86_64 | 13e464a5b51e5787b7e3276c913dea3855a631f0 | | ocp-express | 4.2.2 | 100000022024011120.el7 | x86_64 | 09ffcf156d1df9318a78af52656f499d2315e3f7 | | ocp-server-ce | 4.3.2 | 20241012145836.el7 | noarch | 610610e2daf63f6df08af686f9a88b6d8cefcc52 | | openjdk-jre | 1.8.0_322 | b09.el7 | x86_64 | 051aa69c5abb8697d15c2f0dcb1392b3f815f7ed | | prometheus | 2.37.1 | 10000102022110211.el7 | x86_64 | 58913c7606f05feb01bc1c6410346e5fc31cf263 | +---------------------------+-----------+------------------------+---------+------------------------------------------+ Trace ID: e60fbff0-ae2d-11ef-830f-5254006cf5ec If you want to view detailed obd logs, please run: obd display-trace e60fbff0-ae2d-11ef-830f-5254006cf5ec

官网链接:

部署 OceanBase 数据库

仅部署 OceanBase 数据库

obd demo -c oceanbase-ce

部署默认组件

执行 obd demo 命令后,会自动部署 OceanBase 数据库、OBProxy、OBAgent、Prometheus 和 Grafana,默认版本为镜像库中最新版本。

obd demo

部署默认组件,并指定 OceanBase 数据库版本

obd demo --oceanbase-ce.version=4.3.3.0 三、连接 OceanBase 数据库实例

使用 obd 命令管理和 OBClient 客户端连接实例,也可使用宿主机本地 OBClient 或 MySQL 客户端连接到 OceanBase 数据库实例。

署成功后可复制输出中的连接串,使用 OBClient 客户端连接到 OceanBase 数据库。示例如下:

obclient -h127.0.0.1 -P2881 -uroot@sys -p'*******' -Doceanbase -A

首页
评论
分享
Top