1.拉取和运行OceanBase CE 容器
docker pull obpilot/oceanbase-ce:latest
docker run -itd -m 10G --name oceanbase-ce obpilot/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)



