OceanBase 在windows上使用docker部署数据库(obcece)

2024年 5月 7日 48.7k 0

操作系统的版本

windows 21H1

docker镜像

oceanbase/obce-ce

部署过程

  • 查找oceanbase相关的镜像
PS C:\Users\admin> docker search oceanbase
NAME                             DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
oceanbase/oceanbase-xe           OceanBase Database 2.2 Express Edition          3
oceanbase/obce-mini              obce-mini is a mini standalone test image fo…   2
obpilot/oceanbase-ce             3 steps to run an OceanBase-CE docker in you…   2
zibuyu886/oceanbase-ce-cluster   OceanBase ce cluster                            1
oceanbase/oceanbase-ce           OceanBase is open source now. This is the do…   1
huweijie/oceanbase-ce-deploy                                                     0
oceanbase/centos7                                                                0
superbigfu/oceanbase                                                             0
hongweiqin/anolisos-oceanbase    A tentative deploy of oceanbase.                0
stutiredboy/centos_ob            Build environment for OceanBase 3.1 CE. Crea…   0
  • pull,需要下载一会儿
PS C:\Users\admin> docker pull obpilot/oceanbase-ce
Using default tag: latest
latest: Pulling from obpilot/oceanbase-ce
7a0437f04f83: Pull complete
615dc48ac9f1: Pull complete
b10c1cdae3af: Pull complete
4f4fb700ef54: Pull complete
c0f6c94a6a6a: Pull complete
792630f35e24: Pull complete
Digest: sha256:7ac28415cf27ba19cb47acb67a55ebf9848ad73a63d80b7e2e85d653233dbaeb
Status: Downloaded newer image for obpilot/oceanbase-ce:latest
docker.io/obpilot/oceanbase-ce:latest

PS C:\Users\admin> docker images
REPOSITORY             TAG       IMAGE ID       CREATED        SIZE
obpilot/oceanbase-ce   latest    943379e0b05b   2 weeks ago    2.25GB
oceanbase/obce-mini    latest    1a5ca6d233a7   4 months ago   690MB
  • 启动容器
  • -m 10G:内存 10G

PS C:\Users\admin> docker run -itd -m 10G --name oceanbase-ce obpilot/oceanbase-ce
b2c3dcda5062ac3730c237730a4b552e9440504b82c7cdd93bafbf490f4b9618
PS C:\Users\admin> docker ps
CONTAINER ID   IMAGE                  COMMAND       CREATED          STATUS          PORTS                NAMES
b2c3dcda5062   obpilot/oceanbase-ce   "/bin/bash"   34 seconds ago   Up 32 seconds   2881/tcp, 2883/tcp   oceanbase-ce
  • 进入容器
PS C:\Users\admin> docker exec -it oceanbase-ce bash
[admin@b2c3dcda5062 ~]$ pwd
/home/admin
[admin@b2c3dcda5062 ~]$ ls
bmsql.sql  obproxy  oceanbase-ce  readme.md
  • 查看并启动集群
[admin@b2c3dcda5062 ~]$ obd cluster list
+------------------------------------------------------------+
|                        Cluster List                        |
+--------+---------------------------------+-----------------+
| Name   | Configuration Path              | Status (Cached) |
+--------+---------------------------------+-----------------+
| obdemo | /home/admin/.obd/cluster/obdemo | deployed        |
+--------+---------------------------------+-----------------+
[admin@b2c3dcda5062 ~]$ obd cluster start obdemo
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
[WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)

Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster
Cluster bootstrap ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.1   | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+

Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster
+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obdemo running
[admin@b2c3dcda5062 ~]$
  • 通过obproxy连接数据库
  • 用户名 root
  • 实例名 sys
  • 集群名 obce-single
  • 端口号 2883
[admin@b2c3dcda5062 ~]$ obclient -h 127.1 -uroot@sys#obce-single -P2883 -prootPW
D123 -c -A oceanbase
Welcome to the OceanBase.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MySQL [oceanbase]> \q
Bye
[admin@b2c3dcda5062 ~]$
  • 直连observer
  • 端口号 2881
  • 不写集群名
[admin@b2c3dcda5062 ~]$ obclient -h 127.1 -uroot@sys -P2881 -prootPWD123 -c -A oceanbase
Welcome to the OceanBase.  Commands end with ; or \g.
Your MySQL connection id is 3221487712
Server version: 5.7.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MySQL [oceanbase]> \q
Bye

结束语:

在学习过程中如果有任何疑问,欢迎钉钉扫码加入教程直播群【钉钉教程直播群:35825151】进行交流~

我们期待你的加入~

钉钉直播群二维码:

OceanBase 在windows上使用docker部署数据库(obce-ce)-1

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论