1.拉取和运行OceanBase CE 容器
docker pull obpilot/oceanbase-ce:latest
文章图片
docker run -itd -m 10G --name oceanbase-ceobpilot/oceanbase-ce:latest
文章图片
2.启动集群
obd cluster start test
文章图片
遇到以下两个报错
[ERROR] (127.0.0.1) open files number must not be less than 20000 (Current value: 1024)
[ERROR] (127.0.0.1) not enough memory. (Free: 6.7G, Need: 8.0G)
一个是用户最大打开文件数不够,一个是可用内存不足8G,解决后成功启动。
文章图片
3.创建租户
MySQL [cctest]> alter resource unit sys_unit_config min_cpu=5;
Query OK, 0 rows affected (0.006 sec)MySQL [cctest]>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';
Query OK, 0 rows affected (0.016 sec)
MySQL [cctest]> CREATE resource pool my_pool unit = 'S4C1G', unit_num = 1;
Query OK, 0 rows affected (0.023 sec)
MySQL [cctest]> 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';
Query OK, 0 rows affected (1.121 sec)
文章图片
4.创建数据库表
Welcome to the OceanBase.Commands end with ;
or \g.
Your MySQL connection id is 3221487724
Server version: 5.7.25 OceanBase 3.1.2 (r10000392021123010-d4ace121deae5b81d8f0b40afbc4c02705b7fc1d) (Built Dec 30 2021 02:47:29)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 [(none)]> show databases;
+--------------------+
| Database|
+--------------------+
| oceanbase|
| information_schema |
| mysql|
| test|
+--------------------+
4 rows in set (0.002 sec)MySQL [(none)]> create database cctest;
Query OK, 1 row affected (0.023 sec)MySQL [(none)]>CREATE TABLE cctest (id int,cc varchar(20));
ERROR 1046 (3D000): No database selected
MySQL [(none)]> use cctest
Database changed
MySQL [cctest]>CREATE TABLE cctest (id int,cc varchar(20));
Query OK, 0 rows affected (0.045 sec)MySQL [cctest]>insert into cctest(id,cc) values(1,"test");
Query OK, 1 row affected (0.012 sec)
【数据库|实践练习一(OceanBase Docker 体验)】
文章图片
推荐阅读
- OceanBase|OceanBase Docker 部署&使用
- 最佳实践|意出望外的一次相遇|利楚初探 OceanBase
- OceanBase|《OceanBase 数据库系统概念》首次发布,系统精准定义 OceanBase
- 数据库系列|数据库系列之OceanBase架构及安装部署
- 数据库|全面提升体系化数据管理能力 | OceanBase 发布全新3.X工具家族
- 数据仓库|20000字详解数据湖(概念、特征、架构与案例)
- 数据库|2w字详解数据湖(概念、特征、架构与案例)
- 数据库技术|【SQL刷题】Day3----SQL必会的常用函数专项练习
- redis|Redis的使用--Java连接redis、springboot整合redis、缓存 分布锁 、redssion解决分布锁的bug(超时问题) 以及redis常见面试题