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

相关推荐
Mr.Entropy1 小时前
请求超过Spring线程池的最大线程(处理逻辑)
数据库·sql·spring
GBASE1 小时前
“G”术时刻:南大通用GBase 8c数据库权限管理场景实践(二)
数据库
wearegogog1232 小时前
MySQL中实施排序(sorting)及分组(grouping)操作
数据库·mysql
2301_803554522 小时前
MySQL 主从读写分离架构
数据库·mysql·架构
正在走向自律2 小时前
Ubuntu系统下Python连接国产KingbaseES数据库实现增删改查
开发语言·数据库·python·ubuntu·kingbasees·ksycopg2
没有bug.的程序员3 小时前
Redis 内存管理机制:深度解析与性能优化实践
java·数据库·redis·性能优化·内存管理机制
Dxy12393102163 小时前
Dockerfile文件常用配置详解
开发语言·docker
小蒜学长3 小时前
基于SpringBoot+Vue的健身房管理系统的设计与实现(代码+数据库+LW)
java·数据库·vue.js·spring boot·后端
失散133 小时前
分布式专题——2 深入理解Redis线程模型
java·数据库·redis·分布式·架构
DemonAvenger3 小时前
数据库迁移实战:最小化停机时间的方法与经验分享
数据库·sql·性能优化