前言
OceanBase是阿里巴巴、蚂蚁金服自主研发的可扩展的分布式关系数据库。
具体介绍可以参考官网
https://www.oceanbase.com/
一、Docker方式部署oceanbase
OceanBase是阿里巴巴、蚂蚁金服自主研发的可扩展的分布式关系数据库。
二、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数据库内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
来源:https://www.jb51.net/server/339095jp1.htm
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |