oceanbase常用资源管理命令
【摘要】 1,资源规格#DROP RESOURCE UNIT unit1;CREATE resource unit S4C1G max_cpu=4, min_cpu=4, max_memory='1G', min_memory='1G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='1024G';MySQ...
1,资源规格
#DROP RESOURCE UNIT unit1;
CREATE resource unit S4C1G max_cpu=4, min_cpu=4, max_memory='1G', min_memory='1G', max_iops=10000, min_iops=1000, max_session_num=1000000, max_disk_size='1024G';
MySQL [oceanbase]> select * from __all_unit_config;
+----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+
| gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | max_memory | min_memory | max_iops | min_iops | max_disk_size | max_session_num |
+----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+
| 2021-12-07 15:52:44.061255 | 2021-12-07 15:52:44.061255 | 1 | sys_unit_config | 5 | 2.5 | 1288490188 | 1073741824 | 10000 | 5000 | 53687091200 | 9223372036854775807 |
| 2021-12-07 17:38:07.657104 | 2021-12-07 17:38:07.657104 | 1001 | S4C1G | 4 | 4 | 1073741824 | 1073741824 | 10000 | 1000 | 1099511627776 | 1000000 |
+----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+
2 rows in set (0.001 sec)
2,资源池
#drop RESOURCE POOL pool3;
CREATE RESOURCE POOL pool3
UNIT = 'S4C1G',
UNIT_NUM = 1;
alter resource unit sys_unit_config min_cpu=5,min_memory='1G';
MySQL [oceanbase]> select * from __all_resource_pool ;
+----------------------------+----------------------------+------------------+----------+------------+----------------+-------------------------+-----------+--------------+--------------------+
| gmt_create | gmt_modified | resource_pool_id | name | unit_count | unit_config_id | zone_list | tenant_id | replica_type | is_tenant_sys_pool |
+----------------------------+----------------------------+------------------+----------+------------+----------------+-------------------------+-----------+--------------+--------------------+
| 2021-12-07 15:52:44.063479 | 2021-12-07 16:11:07.047749 | 1 | sys_pool | 1 | 1 | zone1;zone2;zone3 | 1 | 0 | 0 |
| 2021-12-08 08:37:32.810127 | 2021-12-08 08:37:56.027919 | 1001 | pool1 | 1 | 1001 | zone1;zone2;zone3 | 1001 | 0 | 0 |
| 2021-12-08 13:27:49.949034 | 2021-12-08 13:27:49.949034 | 1007 | pool3 | 1 | 1001 | zone1;zone2;zone3;zone4 | -1 | 0 | 0 |
+----------------------------+----------------------------+------------------+----------+------------+----------------+-------------------------+-----------+--------------+--------------------+
3 rows in set (0.001 sec)
3,租户
CREATE TENANT IF NOT EXISTS test_tenant01
charset='utf8mb4',
resource_pool_list=('pool1');
ALTER TENANT test_tenant SET VARIABLES ob_tcp_invited_nodes='%';
MySQL [oceanbase]> select * from __all_tenant;
+----------------------------+----------------------------+-----------+-------------+-------------+-------------------+--------------+--------+----------------+---------------+-----------+-----------------------+---------------------------------------------+---------------------+-------------------+------------------------+-----------------------------+-----------------------+--------------------+------------------+----------------------+---------------+
| gmt_create | gmt_modified | tenant_id | tenant_name | replica_num | zone_list | primary_zone | locked | collation_type | info | read_only | rewrite_merge_version | locality | logonly_replica_num | previous_locality | storage_format_version | storage_format_work_version | default_tablegroup_id | compatibility_mode | drop_tenant_time | status | in_recyclebin |
+----------------------------+----------------------------+-----------+-------------+-------------+-------------------+--------------+--------+----------------+---------------+-----------+-----------------------+---------------------------------------------+---------------------+-------------------+------------------------+-----------------------------+-----------------------+--------------------+------------------+----------------------+---------------+
| 2021-12-07 16:42:12.523525 | 2021-12-07 16:42:12.523525 | 1 | sys | -1 | zone1;zone2 | zone1;zone2 | 0 | 0 | system tenant | 0 | 0 | FULL{1}@zone1, FULL{1}@zone2 | 0 | | 0 | 0 | -1 | 0 | -1 | TENANT_STATUS_NORMAL | 0 |
| 2021-12-08 08:37:57.642716 | 2021-12-08 08:37:57.642716 | 1001 | test_tenant | -1 | zone1;zone2;zone3 | RANDOM | 0 | 0 | | 0 | 0 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | 0 | | 0 | 0 | -1 | 0 | -1 | TENANT_STATUS_NORMAL | 0 |
+----------------------------+----------------------------+-----------+-------------+-------------+-------------------+--------------+--------+----------------+---------------+-----------+-----------------------+---------------------------------------------+---------------------+-------------------+------------------------+-----------------------------+-----------------------+--------------------+------------------+----------------------+---------------+
2 rows in set (0.001 sec)
4,汇总查询:(规格,资源池,租户)
MySQL [oceanbase]> select t1.name resource_pool_name, t2.`name` unit_config_name, t2.max_cpu, t2.min_cpu, round(t2.max_memory/1024/1024/1024) max_mem_gb, round(t2.min_memory/1024/1024/1024) min_mem_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 | max_mem_gb | min_mem_gb | unit_id | zone | observer | tenant_id | tenant_name |
+--------------------+------------------+---------+---------+------------+------------+---------+-------+--------------------+-----------+-------------+
| sys_pool | sys_unit_config | 5 | 5 | 1 | 1 | 1 | zone1 | 192.168.5.200:2882 | 1 | sys |
| sys_pool | sys_unit_config | 5 | 5 | 1 | 1 | 1001 | zone2 | 192.168.5.200:3882 | 1 | sys |
| sys_pool | sys_unit_config | 5 | 5 | 1 | 1 | 1002 | zone3 | 192.168.5.200:4882 | 1 | sys |
| pool1 | S4C1G | 4 | 4 | 1 | 1 | 1003 | zone1 | 192.168.5.200:2882 | 1001 | test_tenant |
| pool1 | S4C1G | 4 | 4 | 1 | 1 | 1004 | zone2 | 192.168.5.200:3882 | 1001 | test_tenant |
| pool1 | S4C1G | 4 | 4 | 1 | 1 | 1005 | zone3 | 192.168.5.200:4882 | 1001 | test_tenant |
| pool3 | S4C1G | 4 | 4 | 1 | 1 | 1021 | zone1 | 192.168.5.200:2882 | NULL | NULL |
| pool3 | S4C1G | 4 | 4 | 1 | 1 | 1022 | zone2 | 192.168.5.200:3882 | NULL | NULL |
| pool3 | S4C1G | 4 | 4 | 1 | 1 | 1023 | zone3 | 192.168.5.200:4882 | NULL | NULL |
| pool3 | S4C1G | 4 | 4 | 1 | 1 | 1024 | zone4 | 192.168.5.200:5882 | NULL | NULL |
+--------------------+------------------+---------+---------+------------+------------+---------+-------+--------------------+-----------+-------------+
10 rows in set (0.001 sec)
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)