Docker 部署OceanBase社区版
#download images
docker pull oceanbase/oceanbase-ce
#start containerd
docker run -p 2881:2881 --name oceanbase-ce -d -e OB_HOME_PATH="/root/obce" -e OB_TENANT_NAME="obmysql" oceanbase/oceanbase-ce
#into containerd
docker exec -it oceanbase-ce bash
#list OBD deployment config
obd cluster list
####start use oceanbase cluster
ob-mysql mysql
ob-mysql root
ob-mysql test
[root@be5b79ccd2d9 ~]# obd cluster list
+------------------------------------------------------------+
| Cluster List |
+-----------+------------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+-----------+------------------------------+-----------------+
| obcluster | /root/.obd/cluster/obcluster | running |
+-----------+------------------------------+-----------------+
[root@be5b79ccd2d9 ~]# obd cluster display obcluster
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Wait for observer init ok
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.3 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
MySQL [oceanbase]> select tenant_id,tenant_name,primary_zone from __all_tenant;
+-----------+-------------+--------------+
| tenant_id | tenant_name | primary_zone |
+-----------+-------------+--------------+
| 1 | sys | zone1 |
| 1001 | obmysql | RANDOM |
+-----------+-------------+--------------+
2 rows in set (0.003 sec)
[root@be5b79ccd2d9 ~]# obd cluster obcluster status
Usage: obd cluster <command> [options]
Available commands:
autodeploy Deploy a cluster automatically by using a simple configuration file.
change-repo Change repository for a deployed component
check4ocp Check Whether OCP Can Take Over Configurations in Use
chst Change Deployment Configuration Style
deploy Deploy a cluster by using the current deploy configuration or a deploy yaml file.
destroy Destroy a deployed cluster.
display Display the information for a cluster.
edit-config Edit the configuration file for a specific deployment.
list List all the deployments.
redeploy Redeploy a started cluster.
reload Reload a started cluster.
restart Restart a started cluster.
start Start a deployed cluster.
stop Stop a started cluster.
tenant Create or drop a tenant.
upgrade Upgrade a cluster.
Options:
-h, --help Show help and exit.
-v, --verbose Activate verbose output.
[root@be5b79ccd2d9 ~]# obd cluster list
+------------------------------------------------------------+
| Cluster List |
+-----------+------------------------------+-----------------+
| Name | Configuration Path | Status (Cached) |
+-----------+------------------------------+-----------------+
| obcluster | /root/.obd/cluster/obcluster | running |
+-----------+------------------------------+-----------------+
[root@be5b79ccd2d9 ~]# obd cluster start obcluster
Get local repositories and plugins ok
Open ssh connection ok
Load cluster param plugin ok
Cluster status check ok
Deploy "obcluster" is running
###集群配置文件
#[admin@49356c1421d1 ~]$ cat /home/admin/.obd/cluster/obdemo/config.yaml
root@dbabackup:~# mysql -h10.20.70.216 -uroot -P2883 -pXXX -c -A oceanbase
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示