查看OceanBase集群资源分配及使用情况

发布时间 2023-05-08 10:48:34作者: 高&玉

使用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         |
+--------------------+------------------+---------+---------+----------------+---------+-------+-------------------+-----------+-------------+