集群创建完毕后如何连接集群
OceanBase部署完成并创建完租户后。OceanBase支持2种客户端工具,用于连接数据库,对数据库进行日常的管 理。
一种是黑屏工具,包括MySQL客户端和OceanBase专有的客户端。OceanBase专有的客户端工具可以同时访问MySQL租户和Oracle租户,是比较推荐的黑屏客户端工具。MySQL客户端只支持访问MySQL租户。
第二种是白屏工具,包括OceanBase云平台OCP,OceanBase开发者中心ODC,通过这些图形化的工具,DBA和开发者可以更好的访问、使用OceanBase数据库。
OCP服务器上面访问2883端口(proxy端口)
mysql -h<ip>. -u<用户名>@<租户名>#<集群名> -P2883 -p<密码> -c
obclient -h<ip>. -u<用户名>@<租户名>#<集群名> -P2883 -p<密码> -c
部署obproxy集群
选择其中的两台台observer作为proxy部署,proxy的ip绑定为observer1的IP,也可以单独指定机器部署或和应用服务器部署到一起
点击提交任务
查看任务详情已经部署完毕。部署完毕后每台observer会启动2883端口用于proxy的连接。
通过obproxy连接obcluster01的sys租户
[root@ocp obclient]# mysql -h1xxxxxx.11 -P2883 -uroot@sys#obcluster01 -pOxxxxxxx -Doceanbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MySQL connection id is 1019
Server version: 5.6.25 OceanBase 3.1.2 (r20211230114204-432323fdc2f09d06250bef6ea90e4217fd555d3c) (Built Dec 30 2021 12:27:18)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MySQL [oceanbase]>
MySQL [oceanbase]> quit
Bye
[root@ocp obclient]# mysql -h1xxxxxxx.12 -P2883 -uroot@sys#obcluster01 -pxxxxxxx -Doceanbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MySQL connection id is 1041
Server version: 5.6.25 OceanBase 3.1.2 (r20211230114204-432323fdc2f09d06250bef6ea90e4217fd555d3c) (Built Dec 30 2021 12:27:18)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MySQL [oceanbase]> quit
Bye
[root@ocp obclient]# mysql -h1xxxxxx.13 -P2883 -uroot@sys#obcluster01 -pxxxxxx -Doceanbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MySQL connection id is 532712
Server version: 5.6.25 OceanBase 3.1.2 (r20211230114204-432323fdc2f09d06250bef6ea90e4217fd555d3c) (Built Dec 30 2021 12:27:18)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MySQL [oceanbase]>
通过observer2881端口连接
[root@observer1 home]# mysql -h127.0.0.1 -P2881 -uroot@sys -pxxxxxxx -Doceanbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MySQL connection id is 3221702962
Server version: 5.7.25 OceanBase 3.1.2 (r20211230114204-432323fdc2f09d06250bef6ea90e4217fd555d3c) (Built Dec 30 2021 12:27:18)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MySQL [oceanbase]>
通过obclient连接
OceanBase 客户端(OBClient) 是 OceanBase 数据库专用的命令行客户端工具,通过
OBClient 可以连接 OceanBase 数据库的 MySQL 和 Oracle 租户。
安装obclient
[root@ocp obclient]# rpm -ivh obclient-1.2.8-20210918193105.el7.alios7.aarch64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:obclient-1.2.8-20210918193105.el7################################# [100%]
通过obclient连接obproxy管理集群
[root@ocp obclient]# obclient -h1xxxxxx.1 -P2883 -uroot@sys#obcluster01 -pdxxxxxxx2 -Doceanbase -c --prompt "u [d]> "
obclient: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to OceanBase. Commands end with ; or g.
Your OceanBase connection id is 1475
Server version: OceanBase 3.1.2 (r20211230114204-432323fdc2f09d06250bef6ea90e4217fd555d3c) (Built Dec 30 2021 12:27:18)
Copyright (c) 2000, 2020, OceanBase and/or its affiliates. All rights reserved.
Cannot read termcap database;
using dumb terminal settings.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
root [oceanbase]> quit
Bye
通过obclient连接observer管理集群
[root@ocp obclient]# obclient -h1xxxxx.11 -P2881 -uroot@sys -pxxxxx22 -Doceanbase -c --prompt "u [d]> "
obclient: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to OceanBase. Commands end with ; or g.
Your OceanBase connection id is 3221708451
Server version: OceanBase 3.1.2 (r20211230114204-432323fdc2f09d06250bef6ea90e4217fd555d3c) (Built Dec 30 2021 12:27:18)
Copyright (c) 2000, 2020, OceanBase and/or its affiliates. All rights reserved.
Cannot read termcap database;
using dumb terminal settings.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
root [oceanbase]>