docker 快速創(chuàng)建oceanbase數(shù)據(jù)庫(kù)
##docker拉取oceanbase鏡像
docker pull obpilot/oceanbase-ce
##docker啟動(dòng)oceanbase容器
docker run -itd -m 10G -p 2881:2881 -p 2883:2883 --name oceanbase-ce obpilot/oceanbase-ce
##進(jìn)入oceanbase容器
docker exec -it oceanbase-ce bash
##obclient客戶(hù)端使用租戶(hù)集群密碼連接proxy 2883 數(shù)據(jù)庫(kù) oceanbase
obclient -h127.1 -P2883 -uroot@sys#obdemo -prootPWD123 -c -A oceanbase
##創(chuàng)建資源單元(Resource Unit, RU)
drop resource unit unit_1c2g;
create resource unit unit_1c2g max_cpu=1, min_cpu=1, memory_size='2G';
##調(diào)整資源單元(Resource Unit, RU)的日志磁盤(pán)大小
ALTER RESOURCE unit unit_1c2g log_disk_size='2G';
##創(chuàng)建資源池(Resource Pool)
create resource pool pool_1 unit='unit_1c2g', unit_num=1;
##創(chuàng)建租戶(hù)
create tenant tenant_1 resource_pool_list=('pool_1'), charset='utf8' set ob_tcp_invited_nodes='%', ob_compatibility_mode='mysql';
##使用tenant_1租戶(hù)連接oceanbase庫(kù)
obclient -h127.1 -uroot@tenant_1 -P2883 -Doceanbase -c -A
##創(chuàng)建數(shù)據(jù)庫(kù)testdb
create database testdb;
##創(chuàng)建表
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客戶(hù)端連接testdb
mysql -h192.168.3.160 -uroot@tenant_1 -P2883 -Dtestdb -c -A
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-821093.html
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-821093.html
到了這里,關(guān)于docker 創(chuàng)建oceanbase數(shù)據(jù)庫(kù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!