• 设为首页
  • 收藏本站
  • 积分充值
  • VIP赞助
  • 手机版
  • 微博
  • 微信
    微信公众号 添加方式:
    1:搜索微信号(888888
    2:扫描左侧二维码
  • 快捷导航
    福建二哥 门户 查看主题

    Docker方式部署OceanBase数据库的完整步骤

    发布者: 雪落无声 | 发布时间: 2025-6-17 08:14| 查看数: 105| 评论数: 0|帖子模式

    前言

    OceanBase是阿里巴巴、蚂蚁金服自主研发的可扩展的分布式关系数据库。
    具体介绍可以参考官网
    https://www.oceanbase.com/


    一、Docker方式部署oceanbase

    OceanBase是阿里巴巴、蚂蚁金服自主研发的可扩展的分布式关系数据库。

    二、OceanBase安装步骤


    1.拉取oceanbase镜像

    代码如下(示例):
    1. [root@localhost ~]# docker pull quay.io/oceanbase/oceanbase-ce
    2. Using default tag: latest
    3. latest: Pulling from oceanbase/oceanbase-ce
    4. 54273d8675f3: Pull complete
    5. 4f4fb700ef54: Pull complete
    6. e564f00d9405: Pull complete
    7. e5af5c4b8706: Pull complete
    8. 4facaa54b636: Pull complete
    9. 40903d073efe: Pull complete
    10. 29821a1484a7: Pull complete
    11. 7ad97f3e2e5f: Pull complete
    12. f4965e7c3ff4: Pull complete
    13. 6bcbbaa7a350: Pull complete
    14. c855931abb7c: Pull complete
    15. 3ea130b1a014: Pull complete
    16. 543dbe8ed2e5: Pull complete
    17. 2dcb3d49ca6c: Pull complete
    18. 58a4bd5b99d8: Pull complete
    19. 5c9484abca8d: Pull complete
    20. 8ce058257b10: Pull complete
    21. 62486627ca76: Pull complete
    22. Digest: sha256:13cd5a03f632a2fcd254005c0182d55890e1f783bec2a15e77f5b783a2e3547f
    23. Status: Downloaded newer image for quay.io/oceanbase/oceanbase-ce:latest
    24. quay.io/oceanbase/oceanbase-ce:latest
    25. You have mail in /var/spool/mail/root
    复制代码
    2.启动oceanbase容器

    代码如下(示例):
    1. [root@localhost ~]# docker run -p 2881:2881 --name oceanbase-ce -e MINI_MODE=0 -d quay.io/oceanbase/oceanbase-ce
    2. 41103400ca56e0447f4fa67ad1ca404acb23dbe4767241d273e1a0bd404135eb
    复制代码
    3.查看oceanbase初始化的日志信息

    代码如下(示例):
    1. [root@localhost ~]# docker logs oceanbase-ce
    2. +--------------------------------------------------+
    3. |                   Cluster List                   |
    4. +------+-------------------------+-----------------+
    5. | Name | Configuration Path      | Status (Cached) |
    6. +------+-------------------------+-----------------+
    7. | demo | /root/.obd/cluster/demo | stopped         |
    8. +------+-------------------------+-----------------+
    9. Trace ID: 94fba882-e9b4-11ef-8b1e-0242ac110002

    10. Open ssh connection ok
    11. [WARN] OBD-1007: (172.17.0.2) The recommended number of stack size is unlimited (Current value: 8192)
    12. [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)
    13. [WARN] OBD-2000: (172.17.0.2) not enough memory. (Free: 5G, Need: 6G)
    14. [WARN] OBD-1012: (172.17.0.2) clog and data use the same disk (/)
    15. cluster scenario: express_oltp
    16. Start observer ok
    17. observer program health check ok
    18. Connect to observer ok
    19. Cluster bootstrap ok
    20. obshell start ok
    21. obshell program health check ok
    22. obshell bootstrap ok
    23. Connect to observer ok
    24. Wait for observer init ok
    25. +-----------------------------------------------+
    26. |                  oceanbase-ce                 |
    27. +------------+----------+------+-------+--------+
    28. | ip         | version  | port | zone  | status |
    29. +------------+----------+------+-------+--------+
    30. | 172.17.0.2 | 4.2.1.10 | 2881 | zone1 | ACTIVE |
    31. +------------+----------+------+-------+--------+
    32. obclient -h172.17.0.2 -P2881 -uroot -Doceanbase -A

    33. cluster unique id: bf2e78c3-e718-587c-8a8c-bc579b0ce06d-194fd337e8f-0a010204

    34. obcluster running
    35. Trace ID: 9c8cf858-e9b4-11ef-a485-0242ac110002
    36. If you want to view detailed obd logs, please run: obd display-trace 9c8cf858-e9b4-11ef-a485-0242ac110002
    37. Get local repositories ok
    38. Open ssh connection ok
    39. Connect to observer ok
    40. Create tenant test ok
    41. Exec oceanbase-ce-4.2.1.10-110000072024112010.el8-b03c714bf9d03e3424203240514359a9e8b9317a import_time_zone_info.py ok
    42. Exec oceanbase-ce-4.2.1.10-110000072024112010.el8-b03c714bf9d03e3424203240514359a9e8b9317a import_srs_data.py ok
    复制代码
    4.进入oceanbase容器

    代码如下(示例):
    1. [root@localhost ~]# docker exec -it oceanbase-ce bash
    复制代码
    5.启动oceanbase容器

    代码如下(示例):
    1. [root@localhost ~]# docker run -p 2881:2881 --name oceanbase-ce -e MINI_MODE=0 -d quay.io/oceanbase/oceanbase-ce
    2. 41103400ca56e0447f4fa67ad1ca404acb23dbe4767241d273e1a0bd404135eb
    复制代码
    6.进入oceanbase容器

    代码如下(示例):
    1. [root@localhost ~]# docker exec -it oceanbase-ce bash
    复制代码
    7.查看集群详情

    代码如下(示例):
    1. [root@41103400ca56 ~]# obd cluster list
    2. +------------------------------------------------------------+
    3. |                        Cluster List                        |
    4. +-----------+------------------------------+-----------------+
    5. | Name      | Configuration Path           | Status (Cached) |
    6. +-----------+------------------------------+-----------------+
    7. | demo      | /root/.obd/cluster/demo      | stopped         |
    8. | obcluster | /root/.obd/cluster/obcluster | running         |
    9. +-----------+------------------------------+-----------------+
    10. Trace ID: 4bfc8eec-e9b6-11ef-8d62-0242ac110002
    11. If you want to view detailed obd logs, please run: obd display-trace 4bfc8eec-e9b6-11ef-8d62-0242ac110002
    12. [root@41103400ca56 ~]# obd cluster display obcluster
    13. Get local repositories and plugins ok
    14. Open ssh connection ok
    15. Connect to observer 172.17.0.2:2881 ok
    16. Wait for observer init ok
    17. +-----------------------------------------------+
    18. |                  oceanbase-ce                 |
    19. +------------+----------+------+-------+--------+
    20. | ip         | version  | port | zone  | status |
    21. +------------+----------+------+-------+--------+
    22. | 172.17.0.2 | 4.2.1.10 | 2881 | zone1 | ACTIVE |
    23. +------------+----------+------+-------+--------+
    24. obclient -h172.17.0.2 -P2881 -uroot -Doceanbase -A

    25. cluster unique id: bf2e78c3-e718-587c-8a8c-bc579b0ce06d-194fd337e8f-0a010204

    26. Trace ID: 5c730850-e9b6-11ef-9d33-0242ac110002
    27. If you want to view detailed obd logs, please run: obd display-trace 5c730850-e9b6-11ef-9d33-0242ac110002
    复制代码


    8.连接oceanbase数据库

    代码如下(示例):
    1. [root@localhost ~]# docker exec -it oceanbase-ce obclient -h127.0.0.1 -P2881 -uroot@sys -A
    2. Welcome to the OceanBase.  Commands end with ; or \g.
    3. Your OceanBase connection id is 3221487677
    4. Server version: OceanBase_CE 4.2.1.10 (r110000072024112010-28c1343085627e79a4f13c29121646bb889cf901) (Built Nov 20 2024 10:11:18)

    5. Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

    6. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    复制代码
    9.修改root密码(默认root密码为空)

    代码如下(示例):
    1. obclient(root@sys)[(none)]> ALTER USER root IDENTIFIED BY '123456';
    2. Query OK, 0 rows affected (0.062 sec)
    复制代码
    10.新密码连接

    代码如下(示例):
    1. [root@localhost ~]# docker exec -it oceanbase-ce bash
    2. [root@41103400ca56 ~]# obclient -uroot@sys -h127.1 -P2881 -A -p123456
    3. Welcome to the OceanBase.  Commands end with ; or \g.
    4. Your OceanBase connection id is 3221487684
    5. Server version: OceanBase_CE 4.2.1.10 (r110000072024112010-28c1343085627e79a4f13c29121646bb889cf901) (Built Nov 20 2024 10:11:18)

    6. Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

    7. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    8. obclient(root@sys)[(none)]>
    复制代码
    总结

    到此这篇关于Docker方式部署OceanBase数据库的文章就介绍到这了,更多相关Docker部署OceanBase数据库内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

    来源:https://www.jb51.net/server/339095jp1.htm
    免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    ×

    最新评论

    QQ Archiver 手机版 小黑屋 福建二哥 ( 闽ICP备2022004717号|闽公网安备35052402000345号 )

    Powered by Discuz! X3.5 © 2001-2023

    快速回复 返回顶部 返回列表