docker 创建oceanbase数据库

docker 快速创建oceanbase数据库

##docker拉取oceanbase镜像

docker pull obpilot/oceanbase-ce

##docker启动oceanbase容器

docker run -itd -m 10G -p 2881:2881 -p 2883:2883 --name oceanbase-ce obpilot/oceanbase-ce

##进入oceanbase容器

docker exec -it oceanbase-ce bash

##obclient客户端使用租户集群密码连接proxy 2883 数据库 oceanbase

obclient -h127.1 -P2883 -uroot@sys#obdemo -prootPWD123 -c -A oceanbase

##创建资源单元(Resource Unit, RU)

drop resource unit unit_1c2g;

create resource unit unit_1c2g max_cpu=1, min_cpu=1, memory_size='2G';

##调整资源单元(Resource Unit, RU)的日志磁盘大小

ALTER RESOURCE unit unit_1c2g log_disk_size='2G';

##创建资源池(Resource Pool)

create resource pool pool_1 unit='unit_1c2g', unit_num=1;

##创建租户

create tenant tenant_1 resource_pool_list=('pool_1'), charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';

##使用tenant_1租户连接oceanbase库

obclient -h127.1 -uroot@tenant_1 -P2883 -Doceanbase -c -A

##创建数据库testdb

create database testdb;

##创建表

create table test1(id int primary key,name varchar(256),age int,sex int);

insert into test1 values(1,'zhangsan',25,0),(2,'lisi',26,0),(3,'xiaoli',22,1);

##使用mysql客户端连接testdb

mysql -h192.168.3.160 -uroot@tenant_1 -P2883 -Dtestdb -c -A

相关推荐
DemonAvenger1 天前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥1 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
RestCloud2 天前
揭秘 CDC 技术:让数据库同步快人一步
数据库·api
得物技术2 天前
MySQL单表为何别超2000万行?揭秘B+树与16KB页的生死博弈|得物技术
数据库·后端·mysql
可涵不会debug2 天前
【IoTDB】时序数据库选型指南:工业大数据场景下的技术突围
数据库·时序数据库
ByteBlossom2 天前
MySQL 面试场景题之如何处理 BLOB 和CLOB 数据类型?
数据库·mysql·面试
muyun28002 天前
Docker 下部署 Elasticsearch 8 并集成 Kibana 和 IK 分词器
elasticsearch·docker·容器
麦兜*2 天前
MongoDB Atlas 云数据库实战:从零搭建全球多节点集群
java·数据库·spring boot·mongodb·spring·spring cloud
Slaughter信仰2 天前
深入理解Java虚拟机:JVM高级特性与最佳实践(第3版)第十章知识点问答(10题)
java·jvm·数据库
麦兜*2 天前
MongoDB 在物联网(IoT)中的应用:海量时序数据处理方案
java·数据库·spring boot·物联网·mongodb·spring