Docker方式部署OceanBase數據庫的完整步驟
前言
OceanBase是阿里巴巴、螞蟻金服自主研發(fā)的可擴展的分布式關系數據庫。
具體介紹可以參考官網

一、Docker方式部署oceanbase
OceanBase是阿里巴巴、螞蟻金服自主研發(fā)的可擴展的分布式關系數據庫。
二、OceanBase安裝步驟
1.拉取oceanbase鏡像
代碼如下(示例):
[root@localhost ~]# docker pull quay.io/oceanbase/oceanbase-ce Using default tag: latest latest: Pulling from oceanbase/oceanbase-ce 54273d8675f3: Pull complete 4f4fb700ef54: Pull complete e564f00d9405: Pull complete e5af5c4b8706: Pull complete 4facaa54b636: Pull complete 40903d073efe: Pull complete 29821a1484a7: Pull complete 7ad97f3e2e5f: Pull complete f4965e7c3ff4: Pull complete 6bcbbaa7a350: Pull complete c855931abb7c: Pull complete 3ea130b1a014: Pull complete 543dbe8ed2e5: Pull complete 2dcb3d49ca6c: Pull complete 58a4bd5b99d8: Pull complete 5c9484abca8d: Pull complete 8ce058257b10: Pull complete 62486627ca76: Pull complete Digest: sha256:13cd5a03f632a2fcd254005c0182d55890e1f783bec2a15e77f5b783a2e3547f Status: Downloaded newer image for quay.io/oceanbase/oceanbase-ce:latest quay.io/oceanbase/oceanbase-ce:latest You have mail in /var/spool/mail/root
2.啟動oceanbase容器
代碼如下(示例):
[root@localhost ~]# docker run -p 2881:2881 --name oceanbase-ce -e MINI_MODE=0 -d quay.io/oceanbase/oceanbase-ce 41103400ca56e0447f4fa67ad1ca404acb23dbe4767241d273e1a0bd404135eb
3.查看oceanbase初始化的日志信息
代碼如下(示例):
[root@localhost ~]# docker logs oceanbase-ce +--------------------------------------------------+ | Cluster List | +------+-------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +------+-------------------------+-----------------+ | demo | /root/.obd/cluster/demo | stopped | +------+-------------------------+-----------------+ Trace ID: 94fba882-e9b4-11ef-8b1e-0242ac110002 Open ssh connection ok [WARN] OBD-1007: (172.17.0.2) The recommended number of stack size is unlimited (Current value: 8192) [WARN] OBD-1017: (172.17.0.2) The value of the "vm.max_map_count" must be within [327600, 1310720] (Current value: 65530, Recommended value: 655360) [WARN] OBD-2000: (172.17.0.2) not enough memory. (Free: 5G, Need: 6G) [WARN] OBD-1012: (172.17.0.2) clog and data use the same disk (/) cluster scenario: express_oltp Start observer ok observer program health check ok Connect to observer ok Cluster bootstrap ok obshell start ok obshell program health check ok obshell bootstrap ok Connect to observer ok Wait for observer init ok +-----------------------------------------------+ | oceanbase-ce | +------------+----------+------+-------+--------+ | ip | version | port | zone | status | +------------+----------+------+-------+--------+ | 172.17.0.2 | 4.2.1.10 | 2881 | zone1 | ACTIVE | +------------+----------+------+-------+--------+ obclient -h172.17.0.2 -P2881 -uroot -Doceanbase -A cluster unique id: bf2e78c3-e718-587c-8a8c-bc579b0ce06d-194fd337e8f-0a010204 obcluster running Trace ID: 9c8cf858-e9b4-11ef-a485-0242ac110002 If you want to view detailed obd logs, please run: obd display-trace 9c8cf858-e9b4-11ef-a485-0242ac110002 Get local repositories ok Open ssh connection ok Connect to observer ok Create tenant test ok Exec oceanbase-ce-4.2.1.10-110000072024112010.el8-b03c714bf9d03e3424203240514359a9e8b9317a import_time_zone_info.py ok Exec oceanbase-ce-4.2.1.10-110000072024112010.el8-b03c714bf9d03e3424203240514359a9e8b9317a import_srs_data.py ok
4.進入oceanbase容器
代碼如下(示例):
[root@localhost ~]# docker exec -it oceanbase-ce bash
5.啟動oceanbase容器
代碼如下(示例):
[root@localhost ~]# docker run -p 2881:2881 --name oceanbase-ce -e MINI_MODE=0 -d quay.io/oceanbase/oceanbase-ce 41103400ca56e0447f4fa67ad1ca404acb23dbe4767241d273e1a0bd404135eb
6.進入oceanbase容器
代碼如下(示例):
[root@localhost ~]# docker exec -it oceanbase-ce bash
7.查看集群詳情
代碼如下(示例):
[root@41103400ca56 ~]# obd cluster list +------------------------------------------------------------+ | Cluster List | +-----------+------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-----------+------------------------------+-----------------+ | demo | /root/.obd/cluster/demo | stopped | | obcluster | /root/.obd/cluster/obcluster | running | +-----------+------------------------------+-----------------+ Trace ID: 4bfc8eec-e9b6-11ef-8d62-0242ac110002 If you want to view detailed obd logs, please run: obd display-trace 4bfc8eec-e9b6-11ef-8d62-0242ac110002 [root@41103400ca56 ~]# obd cluster display obcluster Get local repositories and plugins ok Open ssh connection ok Connect to observer 172.17.0.2:2881 ok Wait for observer init ok +-----------------------------------------------+ | oceanbase-ce | +------------+----------+------+-------+--------+ | ip | version | port | zone | status | +------------+----------+------+-------+--------+ | 172.17.0.2 | 4.2.1.10 | 2881 | zone1 | ACTIVE | +------------+----------+------+-------+--------+ obclient -h172.17.0.2 -P2881 -uroot -Doceanbase -A cluster unique id: bf2e78c3-e718-587c-8a8c-bc579b0ce06d-194fd337e8f-0a010204 Trace ID: 5c730850-e9b6-11ef-9d33-0242ac110002 If you want to view detailed obd logs, please run: obd display-trace 5c730850-e9b6-11ef-9d33-0242ac110002

8.連接oceanbase數據庫
代碼如下(示例):
[root@localhost ~]# docker exec -it oceanbase-ce obclient -h127.0.0.1 -P2881 -uroot@sys -A Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221487677 Server version: OceanBase_CE 4.2.1.10 (r110000072024112010-28c1343085627e79a4f13c29121646bb889cf901) (Built Nov 20 2024 10:11:18) 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.
9.修改root密碼(默認root密碼為空)
代碼如下(示例):
obclient(root@sys)[(none)]> ALTER USER root IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.062 sec)
10.新密碼連接
代碼如下(示例):
[root@localhost ~]# docker exec -it oceanbase-ce bash [root@41103400ca56 ~]# obclient -uroot@sys -h127.1 -P2881 -A -p123456 Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221487684 Server version: OceanBase_CE 4.2.1.10 (r110000072024112010-28c1343085627e79a4f13c29121646bb889cf901) (Built Nov 20 2024 10:11:18) 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(root@sys)[(none)]>
總結
到此這篇關于Docker方式部署OceanBase數據庫的文章就介紹到這了,更多相關Docker部署OceanBase數據庫內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
詳解使用Docker快速部署ELK環(huán)境(最新5.5.1版本)
這篇文章主要介紹了詳解使用Docker快速部署ELK環(huán)境(最新5.5.1版本),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-09-09
Docker之修改/etc/default/docker 里的DOCKER_OPTS參數不生效問題
這篇文章主要介紹了Docker之修改/etc/default/docker 里的DOCKER_OPTS參數不生效問題,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-09-09
Docker 修改docker存儲位置 修改容器鏡像大小限制操作
這篇文章主要介紹了Docker 修改docker存儲位置 修改容器鏡像大小限制操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-11-11
使用Docker-compose離線部署Django應用的方法
這篇文章主要介紹了使用Docker-compose離線部署Django應用的方法,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2019-03-03
通過Docker安裝啟動DB2在Spring?Boot整合DB2的方法
DB2是IBM的一款優(yōu)秀的關系型數據庫,這篇文章主要介紹了通過Docker啟動DB2,并在Spring?Boot整合DB2,需要的朋友可以參考下2023-01-01

