docker部署OceanBase
第一步 ob docker镜像下载
下载镜像
docker pull obpilot/oceanbase-ce:latest
第二步 容器创建
新容器创建
docker run -itd -m 10G -p 2881:2881 -p 2883:2883 –name oceanbase-ce obpilot/oceanbase-ce:latest
进入容器
[root@jeames ~]# docker exec -it oceanbase-ce bash
进入容器后,可以看看 readme.md 文档
第三步 查看集群及启动
启动集群
[admin@3ef732cfb95a ~]$ obd cluster list 配置文件:/home/admin/.obd/cluster/obdemo/config.yaml
启动集群
[admin@3ef732cfb95a ~]$ obd cluster start obdemo
第四步 ob数据库登录,租户创建
admin 用户的密码是 : adminPWD123 [admin@3ef732cfb95a ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbase Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 3 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]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | SYS | | LBACSYS | | ORAAUDITOR | | test | +--------------------+ 7 rows in set (0.014 sec)
创建资源单元、资源池、租户
MySQL [oceanbase]> CREATE resource unit S4C1G max_cpu=4, min_cpu=4, max_memory='1G', min_memory='1G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='1024G'; MySQL [oceanbase]> CREATE resource pool my_pool unit = 'S4C1G', unit_num = 1; MySQL [oceanbase]> create tenant obmysql resource_pool_list=('my_pool'), primary_zone='RANDOM',comment 'mysql tenant/instance', charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';
第五步 obmysql tenant登录,数据库及表的创建
[admin@3ef732cfb95a ~]$ obclient -h 127.1 -uroot@obmysql#obce-single -P2883 -p -c -A test Enter password: Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 7 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 [test]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | test | +--------------------+ 4 rows in set (0.005 sec) MySQL [test]> create database mesdb charset utf8mb4; Query OK, 1 row affected (0.118 sec) MySQL [test]> use mesdb Database changed MySQL [mesdb]> MySQL [mesdb]> MySQL [mesdb]> MySQL [mesdb]> source /tmp/mysql_employees.sql
原创文章,作者:网友投稿,如若转载,请注明出处:https://www.cloudads.cn/archives/3912.html