This topic describes how to create MetaDB and MonitorDB tenants in OceanBase Cloud Platform (OCP).
Procedure
Run the following command to log on as the SYS tenant of OceanBase Database:
mysql -hxxx.xxx.xxx.xxx -uroot@sys -P2881 -p******Run the following command to create a resource unit:
create resource unit ocp_unit_config min_cpu=3, max_cpu=3, min_memory=5368709120, max_memory=5368709120, max_iops=1000, min_iops=128, max_disk_size=1000000000, max_session_num=100;
Note
min_cpu: the minimum number of CPU cores required by the resource unit. max_cpu: the maximum number of CPU cores allowed for the resource unit. min_memory: the minimum size of memory required. The value must reach the size specified in the mini-single-example.yaml file. Otherwise, the resource unit cannot be allocated to a tenant. For more information, see Deploy OceanBase Database.
Run the following command to create a resource pool for the ocp_meta tenant that is to be created in the next step:
create resource pool ocp_pool unit='ocp_unit_config', zone_list=('zone1'), unit_num=1;Set the zone_list parameter to the names of zones specified in the mini-single-example.yaml file. For more information, see Deploy OceanBase Database.
Create the ocp_meta tenant.
create tenant ocp_meta resource_pool_list = ('ocp_pool');Create the whitelist for ocp_meta tenant.
ALTER TENANT ocp_meta SET VARIABLES ob_tcp_invited_nodes='%';Create a resource pool for the ocp_monitor tenant that is to be created in the next step.
create resource pool ocp__monitor_pool unit='ocp_unit_config', zone_list=('zone1'), unit_num=1;Set the zone_list parameter to the names of zones specified in the mini-single-example.yaml file. For more information, see Deploy OceanBase Database.
Create the ocp_monitor tenant.
create tenant ocp_monitor resource_pool_list = ('ocp__monitor_pool');Create the whitelist for ocp_monitor tenant.
ALTER TENANT ocp_monitor SET VARIABLES ob_tcp_invited_nodes='%';Log off from root@sys.
exitLog on as the root user of the ocp_meta tenant that is named root@ocp_meta.
mysql -hxxx.xxx.xxx.xxx -uroot@ocp_meta -P2881
- Create a user named ocp for the ocp_meta tenant.
set global ob_tcp_invited_nodes = '%';
create user ocp identified by 'aaAA__11';
grant all on *.* to ocp;
The specified password is also used as the logon password for ocp_metadb in the ocp.yaml file that is generated by the ocp_installer.sh script.
Log off from root@ocp_meta.
exitLog on as the root user of the ocp_monitor tenant that is named root@ocp_monitor.
mysql -hxxx.xxx.xxx.xxx -uroot@ocp_monitor -P2881Create a user named ocpfor the ocp_monitor tenant.
set global ob_tcp_invited_nodes = '%'; create user ocp identified by 'aaAA__11'; grant all on *.* to ocp;The specified password is also used as the logon password for ocp_monitor db in the ocp.yaml file that is generated by the ocp_installer.sh script.
Log off from root@ocp_monitor.