This topic describes how to query the types and distribution of replicas for tenants from the DBA_OB_TENANTS view.
For more information about the DBA_OB_TENANTS view, see DBA_OB_TENANTS.
Procedure
Log in to the
systenant of the cluster as therootuser.obclient -h172.30.xxx.xxx -P2883 -uroot@sys#obdemo -pxxxx -AAccess the database named
oceanbase.obclient>use oceanbase;Query the types and distribution of replicas for tenants from the
oceanbase.DBA_OB_TENANTSview.obclient> SELECT TENANT_ID,TENANT_NAME,TENANT_TYPE,PRIMARY_ZONE,LOCALITY FROM oceanbase.DBA_OB_TENANTS;The query result is as follows:
+-----------+-------------+-------------+--------------+---------------+ | TENANT_ID | TENANT_NAME | TENANT_TYPE | PRIMARY_ZONE | LOCALITY | +-----------+-------------+-------------+--------------+---------------+ | 1 | sys | SYS | RANDOM | FULL{1}@zone1 | | 1001 | META$1002 | META | RANDOM | FULL{1}@zone1 | | 1002 | mysql123 | USER | RANDOM | FULL{1}@zone1 | +-----------+-------------+-------------+--------------+---------------+ 3 rows in set
The LOCALITY column in the DBA_OB_TENANTS view indicates the types and distribution of replicas for tenants. It describes the types of replicas for a tenant and the distribution of replicas across zones in the cluster.
For example, LOCALITY = 'FULL{1}@zone1' for the tenant mysql123 indicates that the tenant has one full-featured replica in zone1.