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.
标签:社区,oceanbase,OceanBase,obd,cluster,tenant,Docker,root,obcluster 来源: https://www.cnblogs.com/chinaops/p/16670225.html