oceanbase单机容器简单命令测试

server/2024/11/9 16:58:05/

本文记录了命令行登录oceanbase-ce单机容器并进行简单的规格、资源池、租户信息查看和建、删命令测试。

 1、登录数据库(以容器映射端口为3306为例 )
[root@localhost dockerfile]# mysql -h127.0.0.1 -uroot -p -P3306 -A
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3221487652
Server version: 5.7.25 OceanBase_CE 4.3.0.1 (r100000242024032211-0193a343bc60b4699ec47792c3fc4ce166a182f9) (Built Mar 22 2024 13:19:48)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.mysql>

2、切换到oceanbase库并查看已有的资源规格
mysql> use  oceanbase;
Database changedmysql> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS;
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
| UNIT_CONFIG_ID | NAME            | CREATE_TIME                | MODIFY_TIME                | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS            | MIN_IOPS            | IOPS_WEIGHT |
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
|              1 | sys_unit_config | 2024-03-30 15:43:11.919152 | 2024-03-30 15:43:11.919152 |       3 |       3 |  2147483648 |    2147483648 | 9223372036854775807 | 9223372036854775807 |           3 |
|           1001 | test_unit       | 2024-03-30 15:43:19.749714 | 2024-03-30 15:43:19.749714 |       7 |       7 |  3221225472 |    3221225472 | 9223372036854775807 | 9223372036854775807 |           7 |
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
2 rows in set (0.00 sec)mysql> 
3、创建一个名为ipam_unit的规格,查询验证
mysql> CREATE RESOURCE UNIT ipam_unit   MEMORY_SIZE = '2G', MAX_CPU = 3,  MIN_CPU = 1, LOG_DISK_SIZE = '6G' ; 
Query OK, 0 rows affected (0.08 sec)mysql>  SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS WHERE NAME = 'ipam_unit';
+----------------+-----------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
| UNIT_CONFIG_ID | NAME      | CREATE_TIME                | MODIFY_TIME                | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS            | MIN_IOPS            | IOPS_WEIGHT |
+----------------+-----------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
|           1003 | ipam_unit | 2024-04-12 17:23:15.686527 | 2024-04-12 17:23:15.686527 |       3 |       1 |  2147483648 |    6442450944 | 9223372036854775807 | 9223372036854775807 |           1 |
+----------------+-----------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
1 row in set (0.01 sec)

后续如需删除ipam_unit该规格

mysql> drop resource unit ipam_unit;
Query OK, 0 rows affected (0.07 sec)

 

4、查询已有的资源池
mysql>  SELECT * FROM DBA_OB_RESOURCE_POOLS ;+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| RESOURCE_POOL_ID | NAME      | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
|                1 | sys_pool  |         1 | 2024-03-30 15:43:11.922047 | 2024-03-30 15:43:11.926778 |          1 |              1 | zone1     | FULL         |
|             1001 | test_pool |      1002 | 2024-03-30 15:43:19.756685 | 2024-03-30 15:43:19.794582 |          1 |           1001 | zone1     | FULL         |
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
2 rows in set (15.55 sec)mysql> 
5、查询已有的租户信息
mysql> SELECT * FROM oceanbase.DBA_OB_TENANTS;+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
|         1 | sys         | SYS         | 2024-03-30 15:43:11.938501 | 2024-03-30 15:43:11.938501 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.3.0.1    |         1 |
|      1001 | META$1002   | META        | 2024-03-30 15:43:19.789417 | 2024-03-30 15:43:36.491571 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.3.0.1    |         1 |
|      1002 | test        | USER        | 2024-03-30 15:43:19.793521 | 2024-03-30 15:43:36.524407 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1712914026043184341 | 1712914026043184341 | 1712914026043184340 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        1 | 4.3.0.1    |      1001 |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
3 rows in set (0.09 sec)mysql> 
6、将test租户进行改名,改名为ipam,验证信息,然后删除ipam租户
mysql>  ALTER TENANT test RENAME GLOBAL_NAME TO ipam;
Query OK, 0 rows affected (0.21 sec)mysql> SELECT * FROM oceanbase.DBA_OB_TENANTS where TENANT_NAME='ipam' ; 
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
|      1002 | ipam        | USER        | 2024-03-30 15:43:19.793521 | 2024-04-12 17:45:24.581302 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1712915167970934382 | 1712915167970934382 | 1712915167970934382 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        1 | 4.3.0.1    |      1001 |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
1 row in set (0.06 sec)mysql> drop TENANT ipam;
Query OK, 0 rows affected (1 min 30.71 sec)
mysql>  SELECT * FROM oceanbase.DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN | REPLAYABLE_SCN | READABLE_SCN | RECOVERY_UNTIL_SCN | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
|         1 | sys         | SYS         | 2024-03-30 15:43:11.938501 | 2024-03-30 15:43:11.938501 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |     NULL |           NULL |         NULL |               NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.3.0.1    |         1 |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
1 row in set (0.02 sec)mysql> 
7、删除test_pool资源池信息
mysql> DROP RESOURCE POOL test_pool;
Query OK, 0 rows affected (0.03 sec)mysql> SELECT * FROM DBA_OB_RESOURCE_POOLS ;
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| RESOURCE_POOL_ID | NAME     | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
|                1 | sys_pool |         1 | 2024-03-30 15:43:11.922047 | 2024-03-30 15:43:11.926778 |          1 |              1 | zone1     | FULL         |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
1 row in set (0.00 sec)
8、使用ipam_unit规格创建ipam_pool资源池
mysql> CREATE RESOURCE POOL ipam_pool    UNIT='ipam_unit', UNIT_NUM=1, ZONE_LIST=('zone1');
Query OK, 0 rows affected (0.03 sec)
mysql> SELECT * FROM DBA_OB_RESOURCE_POOLS ;
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| RESOURCE_POOL_ID | NAME      | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
|                1 | sys_pool  |         1 | 2024-03-30 15:43:11.922047 | 2024-03-30 15:43:11.926778 |          1 |              1 | zone1     | FULL         |
|             1005 | ipam_pool |      NULL | 2024-04-13 00:51:20.111474 | 2024-04-13 00:51:20.111474 |          1 |           1003 | zone1     | FULL         |
+------------------+-----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
2 rows in set (16.62 sec)
9、在 ipam_pool资源池上创建ipam租户
mysql> CREATE TENANT IF NOT EXISTS ipam PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('ipam_pool'),
CHARSET='utf8mb4' SET ob_tcp_invited_nodes TO '%';
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql>  SELECT * FROM oceanbase.DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+----------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS   | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN | REPLAYABLE_SCN | READABLE_SCN | RECOVERY_UNTIL_SCN | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+----------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
|         1 | sys         | SYS         | 2024-03-30 15:43:11.938501 | 2024-03-30 15:43:11.938501 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL   | NO            | NO     | PRIMARY     | NORMAL            |                0 |     NULL |           NULL |         NULL |               NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.3.0.1    |         1 |
|      1003 | META$1004   | META        | 2024-04-13 01:02:53.903813 | 2024-04-13 01:02:53.903813 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | CREATING | NO            | NO     | PRIMARY     | NORMAL            |                0 |     NULL |           NULL |         NULL |               NULL | NOARCHIVELOG | DISABLED                   |        1 | NULL       |         1 |
|      1004 | ipam        | USER        | 2024-04-13 01:02:53.910250 | 2024-04-13 01:02:53.910250 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | CREATING | NO            | NO     | NULL        | NULL              |             NULL |     NULL |           NULL |         NULL |               NULL | NULL         | DISABLED                   |        1 | NULL       |      NULL |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+----------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
3 rows in set (0.04 sec)mysql> 


http://www.ppmy.cn/server/2190.html

相关文章

Python 基于 OpenCV 视觉图像处理实战 之 OpenCV 简单视频处理实战案例 之十 简单视频浮雕画效果

Python 基于 OpenCV 视觉图像处理实战 之 OpenCV 简单视频处理实战案例 之十 简单视频浮雕画效果 目录 Python 基于 OpenCV 视觉图像处理实战 之 OpenCV 简单视频处理实战案例 之十 简单视频浮雕画效果 一、简单介绍 二、简单视频浮雕画效果实现原理 三、简单视频浮雕画效果…

【爬虫开发】爬虫从0到1全知识md笔记第5篇:Selenium课程概要,selenium的其它使用方法【附代码文档】

爬虫开发从0到1全知识教程完整教程(附代码资料)主要内容讲述:爬虫课程概要,爬虫基础爬虫概述,,http协议复习。requests模块,requests模块1. requests模块介绍,2. response响应对象,3. requests模块发送请求,4. request…

GAMS104 现代游戏引擎 2

渲染的难点可以分为一下三部分:如何计算入射光线、如何考虑材质以及如何实现全局光照。 渲染的难点之一在于阴影,或者说是光的可见性。如何做出合适的阴影效果远比想象中要难得多,在实践中往往需要通过大量的技巧才能实现符合人认知的阴影效…

【团体程序设计天梯赛 往年关键真题 详细分析完整AC代码】L2-003 月饼(贪心) L2-004 这是二叉搜索树吗? (数据结构)

【团体程序设计天梯赛 往年关键真题 详细分析&完整AC代码】搞懂了赛场上拿下就稳 【团体程序设计天梯赛 往年关键真题 25分题合集 详细分析&完整AC代码】(L2-001 - L2-024)搞懂了赛场上拿下就稳了 【团体程序设计天梯赛 往年关键真题 25分题合…

网络安全(黑客)—2024自学

前言 一、什么是网络安全 网络安全可以基于攻击和防御视角来分类,我们经常听到的 “红队”、“渗透测试” 等就是研究攻击技术,而“蓝队”、“安全运营”、“安全运维”则研究防御技术。 无论网络、Web、移动、桌面、云等哪个领域,都有攻与防…

基于双向长短期神经网络BILSTM的线损率预测,基于gru的线损率预测

目录 背影 摘要 LSTM的基本定义 LSTM实现的步骤 BILSTM神经网络 基于双向长短期神经网络BILSTM的线损率预测,基于gru的线损率预测 完整代码:基于双向长短期神经网络BILSTM的线损率预测,基于gru的线损率预测(代码完整,数据齐全)资源-CSDN文库 https://download.csdn.net/d…

07.QT信号和槽-2

一、自定义信号和槽 在Qt中,允许⾃定义信号的发送⽅以及接收⽅,即可以⾃定义信号函数和槽函数。但是对于⾃定义的信号函数和槽函数有⼀定的书写规范。 1.基本语法 1.1 自定义信号 (1)⾃定义信号函数必须写到"signals"…

前端面试问题汇总 - Vue篇

1. Vue 的生命周期有哪些,每个阶段分别做什么操作? beforeCreate: 在实例初始化之后、数据观测和事件配置之前被调用。此时数据对象 data 和事件(methods)都还未初始化。一般不在此阶段进行数据初始化和 DOM 操作。cre…