使用root用户连接sys租户
[admin]# obclient -h127.0.0.1 -P2881 -D oceanbase -uroot@sys -p -A
查看各节点资源分配及使用情况
obclient [oceanbase]> select zone,svr_ip,sql_port,svr_port,cpu_capacity cpu_total,cpu_assigned cpu_used,(cpu_capacity - cpu_assigned) cpu_free,truncate(mem_capacity/1024/1024/1024,2) mem_total_gb,truncate(mem_assigned/1024/1024/1024,2) as mem_used_gb,truncate((mem_capacity - mem_assigned)/1024/1024/1024,2),mem_free_gb,truncate(memory_limit/1024/1024/1024,2) memory_limit_gb from __all_virtual_server;
+-------+--------------+----------+----------+-----------+----------+----------+--------------+-------------+-------------+
| zone | svr_ip | sql_port | svr_port | cpu_total | cpu_used | cpu_free | mem_total_gb | mem_used_gb | mem_free_gb |
+-------+--------------+----------+----------+-----------+----------+----------+--------------+-------------+-------------+
| zone1 | 192.168.1.71 | 2881 | 2882 | 4 | 1 | 3 | 5.00 | 5.00 | 0.00 |
| zone3 | 192.168.1.73 | 2881 | 2882 | 4 | 1 | 3 | 5.00 | 5.00 | 0.00 |
| zone2 | 192.168.1.72 | 2881 | 2882 | 4 | 1 | 3 | 5.00 | 5.00 | 0.00 |
+-------+--------------+----------+----------+-----------+----------+----------+--------------+-------------+-------------+
查看资源池资源分配情况
obclient [oceanbase]> select t1.name resource_pool_name,t2.name unit_config_name,t2.max_cpu,t2.min_cpu,truncate(t2.memory_size/1024/1024/1024,2) memory_size_gb,t3.unit_id,t3.zone,concat(t3.svr_ip,':',t3.svr_port) observer,t4.tenant_id,t4.tenant_name from __all_resource_pool t1 join __all_unit_config t2 on (t1.unit_config_id=t2.unit_config_id) join __all_unit t3 on (t1.resource_pool_id = t3.resource_pool_id) left join __all_tenant t4 on (t1.tenant_id=t4.tenant_id)order by t1.resource_pool_id, t2.unit_config_id, t3.unit_id;
+--------------------+------------------+---------+---------+----------------+---------+-------+-------------------+-----------+-------------+
| resource_pool_name | unit_config_name | max_cpu | min_cpu | memory_size_gb | unit_id | zone | observer | tenant_id | tenant_name |
+--------------------+------------------+---------+---------+----------------+---------+-------+-------------------+-----------+-------------+
| sys_pool | sys_unit_config | 1 | 1 | 5.00 | 1 | zone1 | 192.168.1.71:2882 | 1 | sys |
| sys_pool | sys_unit_config | 1 | 1 | 5.00 | 2 | zone2 | 192.168.1.72:2882 | 1 | sys |
| sys_pool | sys_unit_config | 1 | 1 | 5.00 | 3 | zone3 | 192.168.1.73:2882 | 1 | sys |
+--------------------+------------------+---------+---------+----------------+---------+-------+-------------------+-----------+-------------+
查看所有资源规格信息
mysql> select * from 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 | 2023-04-24 18:33:06.566391 | 2023-04-24 18:33:06.566391 | 1 | 1 | 5368709120 | 5368709120 | 10000 | 10000 | 1 |
| 1003 | s1 | 2023-04-25 15:18:41.373470 | 2023-04-27 14:18:36.650272 | 2 | 1 | 5368709120 | 16106127360 | 10000 | 10000 | 1 |
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------+----------+-------------+
查看所有的资源池信息
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 | 2023-04-24 18:33:06.599543 | 2023-05-09 09:41:36.796368 | 1 | 1 | zone1;zone2 | FULL |
| 1007 | my_pool | 1004 | 2023-04-25 15:43:45.381999 | 2023-05-09 09:41:43.783302 | 1 | 1003 | zone1;zone2 | FULL |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+
查看所有租户信息
mysql> select * from DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+------------------------------+-------------------+--------------------+--------+---------------+--------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME | MODIFY_TIME | PRIMARY_ZONE | LOCALITY | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+------------------------------+-------------------+--------------------+--------+---------------+--------+
| 1 | sys | SYS | 2023-04-24 18:33:06.821930 | 2023-05-09 09:28:07.989177 | RANDOM | FULL{1}@zone1, FULL{1}@zone2 | NULL | MYSQL | NORMAL | NO | NO |
| 1003 | META$1004 | META | 2023-04-25 16:54:07.990306 | 2023-05-09 09:28:31.056441 | RANDOM | FULL{1}@zone1, FULL{1}@zone2 | NULL | MYSQL | NORMAL | NO | NO |
| 1004 | my_tenant | USER | 2023-04-25 16:54:07.991849 | 2023-05-09 09:28:31.056441 | RANDOM | FULL{1}@zone1, FULL{1}@zone2 | NULL | MYSQL | NORMAL | NO | NO |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+------------------------------+-------------------+--------------------+--------+---------------+--------+
查看租户资源配置信息
mysql> SELECT c.TENANT_ID, e.TENANT_NAME, concat(c.NAME, ': ', d.NAME) `pool:conf`,concat(c.UNIT_COUNT, ' unit: ', d.min_cpu, 'C/', ROUND(d.MEMORY_SIZE/1024/1024/1024,0), "G") unit_info FROM DBA_OB_RESOURCE_POOLS c, DBA_OB_UNIT_CONFIGS d, DBA_OB_TENANTS e WHERE c.UNIT_CONFIG_ID=d.UNIT_CONFIG_ID AND c.TENANT_ID=e.TENANT_ID AND c.TENANT_ID>1000 ORDER BY c.TENANT_ID;
+-----------+-------------+-------------+---------------+
| TENANT_ID | TENANT_NAME | pool:conf | unit_info |
+-----------+-------------+-------------+---------------+
| 1004 | my_tenant | my_pool: s1 | 1 unit: 1C/5G |
+-----------+-------------+-------------+---------------+
查看租户的资源单元部署位置
mysql> SELECT a.TENANT_NAME,a.TENANT_ID,b.SVR_IP FROM DBA_OB_TENANTS a,GV$OB_UNITS b WHERE a.TENANT_ID=b.TENANT_ID;
+-------------+-----------+--------------+
| TENANT_NAME | TENANT_ID | SVR_IP |
+-------------+-----------+--------------+
| sys | 1 | 192.168.1.71 |
| META$1004 | 1003 | 192.168.1.71 |
| my_tenant | 1004 | 192.168.1.71 |
| sys | 1 | 192.168.1.72 |
| META$1004 | 1003 | 192.168.1.72 |
| my_tenant | 1004 | 192.168.1.72 |
+-------------+-----------+--------------+
查看节点的unit信息
mysql> SELECT * FROM GV$OB_UNITS;
+--------------+----------+---------+-----------+-------+---------+---------+-------------+----------+----------+-------------+---------------+-----------------+------------------+--------+----------------------------+
| SVR_IP | SVR_PORT | UNIT_ID | TENANT_ID | ZONE | MAX_CPU | MIN_CPU | MEMORY_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT | LOG_DISK_SIZE | LOG_DISK_IN_USE | DATA_DISK_IN_USE | STATUS | CREATE_TIME |
+--------------+----------+---------+-----------+-------+---------+---------+-------------+----------+----------+-------------+---------------+-----------------+------------------+--------+----------------------------+
| 192.168.1.72 | 2882 | 2 | 1 | zone2 | 1 | 1 | 5368709120 | 10000 | 10000 | 1 | 5368709120 | 4257171732 | 2323644416 | NORMAL | 2023-04-24 18:32:12.404943 |
| 192.168.1.72 | 2882 | 1002 | 1003 | zone2 | NULL | NULL | 1073741824 | NULL | NULL | NULL | 1610612736 | 1279632555 | 2747269120 | NORMAL | 2023-04-25 16:54:08.085771 |
| 192.168.1.72 | 2882 | 1002 | 1004 | zone2 | 2 | 1 | 4294967296 | 10000 | 10000 | 1 | 14495514624 | 4223397954 | 442499072 | NORMAL | 2023-04-25 16:54:08.085771 |
| 192.168.1.71 | 2882 | 1 | 1 | zone1 | 1 | 1 | 5368709120 | 10000 | 10000 | 1 | 5368709120 | 3854566140 | 2386558976 | NORMAL | 2023-04-24 18:32:12.357749 |
| 192.168.1.71 | 2882 | 1001 | 1003 | zone1 | NULL | NULL | 1073741824 | NULL | NULL | NULL | 1610612736 | 1279752365 | 2740977664 | NORMAL | 2023-04-25 16:54:08.087807 |
| 192.168.1.71 | 2882 | 1001 | 1004 | zone1 | 2 | 1 | 4294967296 | 10000 | 10000 | 1 | 14495514624 | 1337758777 | 442499072 | NORMAL | 2023-04-25 16:54:08.087807 |
+--------------+----------+---------+-----------+-------+---------+---------+-------------+----------+----------+-------------+---------------+-----------------+------------------+--------+----------------------------+
查看节点的资源分配情况
mysql> select * from GV$OB_SERVERS;
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
| SVR_IP | SVR_PORT | ZONE | SQL_PORT | CPU_CAPACITY | CPU_CAPACITY_MAX | CPU_ASSIGNED | CPU_ASSIGNED_MAX | MEM_CAPACITY | MEM_ASSIGNED | LOG_DISK_CAPACITY | LOG_DISK_ASSIGNED | LOG_DISK_IN_USE | DATA_DISK_CAPACITY | DATA_DISK_IN_USE | DATA_DISK_HEALTH_STATUS | MEMORY_LIMIT | DATA_DISK_ABNORMAL_TIME | SSL_CERT_EXPIRED_TIME |
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
| 192.168.1.72 | 2882 | zone2 | 2881 | 4 | 4 | 2 | 3 | 10737418240 | 10737418240 | 96569655296 | 21474836480 | 9999220736 | 53687091200 | 5513412608 | NORMAL | 11811160064 | NULL | NULL |
| 192.168.1.71 | 2882 | zone1 | 2881 | 4 | 4 | 2 | 3 | 10737418240 | 10737418240 | 96569655296 | 21474836480 | 6710886400 | 53687091200 | 5570035712 | NORMAL | 11811160064 | NULL | NULL |
+--------------+----------+-------+----------+--------------+------------------+--------------+------------------+--------------+--------------+-------------------+-------------------+-----------------+--------------------+------------------+-------------------------+--------------+-------------------------+-----------------------+
参考:https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001687943