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

相关推荐
q***T5831 天前
MySQL爬虫
数据库·爬虫·mysql
袖手蹲1 天前
树莓派 5 Trixie 镜像 + Docker 架设 Eclipse Mosquitto 与 ESP32 双向 MQTT 交互
运维·docker·容器
q***72561 天前
【JOIN】关键字在MySql中的详细使用
数据库·mysql
萤火夜1 天前
MYSQL之事务
数据库·mysql
q***R3081 天前
MySQL并发
数据库·mysql
星辰_mya1 天前
浅谈redis中的hash
数据库·redis·哈希算法
人工智能训练1 天前
在Windows系统Docker中使用wsl2、容器、windows文件路径三种不同挂载方式的区别和性能差异
运维·服务器·人工智能·windows·docker·容器·wsl2
正在走向自律1 天前
金仓KingbaseES助力央企数字化转型
数据库·国产数据库·kingbasees·电科金仓·央企数字化
YFLICKERH1 天前
【数据包】Sql Server 数据库TDS协议抓包
数据库·协议
云边有个稻草人1 天前
【MySQL】第二节—库的操作 | 详解
数据库·mysql·库的操作