暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片

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

操作系统的版本

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

学习资源


欢迎各位同学一起来交流学习心得!

最后修改时间:2021-12-24 13:51:00
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论