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

相关推荐
NewBee_Lxx1 分钟前
docker nginx
运维·docker·容器
翔云12345611 分钟前
在MySQL中,使用物理备份工具 xtrabackup备份扩容从库,从库上的gtid_executed和gtid_purged变化过程
数据库·mysql
liulilittle1 小时前
Linux shell 搜索指定后缀名文件,并复制到指定目录。
linux·服务器·数据库
必胜刻1 小时前
Redis哨兵模式(Linux)
linux·数据库·redis
dualven_in_csdn1 小时前
【数据库损坏】关于一次现场数据库损坏
数据库·mysql
乌云下的风1 小时前
Doker 学习 小册
docker
锦衣夜行?2 小时前
oracle 未知长度从左到右截取某个字符串
数据库·oracle
han_hanker2 小时前
@JsonIgnore,@JsonProperty, @JsonInclude,@JsonFormat
数据库·oracle
hanyi_qwe2 小时前
MySQL事务基础
数据库·mysql
l1t2 小时前
三种用SQL解决Advent of Code 2022第8题 树顶木屋 的比较和分析
数据库·sql·oracle·duckdb·advent of code