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

相关推荐
醇醛酸醚酮酯28 分钟前
Qt项目锻炼——TODO清单(二)
开发语言·数据库·qt
ladymorgana1 小时前
【docker】修改 MySQL 密码后 Navicat 仍能用原密码连接
mysql·adb·docker
有点小帅得平哥哥1 小时前
本地部署index-tts并且通过docker做成镜像
docker·index-tts
GreatSQL社区1 小时前
用systemd管理GreatSQL服务详解
数据库·mysql·greatsql
掘根1 小时前
【MySQL进阶】错误日志,二进制日志,mysql系统库
数据库·mysql
weixin_438335401 小时前
基础知识:mysql-connector-j依赖
数据库·mysql
小明铭同学1 小时前
MySQL 八股文【持续更新ing】
数据库·mysql
Mr_Xuhhh2 小时前
信号与槽的总结
java·开发语言·数据库·c++·qt·系统架构
Fireworkitte2 小时前
Redis 源码 tar 包安装 Redis 哨兵模式(Sentinel)
数据库·redis·sentinel