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; +-----------+-------------+-------------+----------------------------------------+------------------------------------------------------------------+ | TENANT_ID | TENANT_NAME | TENANT_TYPE | PRIMARY_ZONE | LOCALITY | +-----------+-------------+-------------+----------------------------------------+------------------------------------------------------------------+ | 1 | sys | SYS | sa128_obv4_2;sa128_obv4_1,sa128_obv4_3 | FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2, FULL{1}@sa128_obv4_3 | | 1001 | META$1002 | META | sa128_obv4_2;sa128_obv4_1,sa128_obv4_3 | FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2, FULL{1}@sa128_obv4_3 | | 1002 | midas0_3790 | USER | sa128_obv4_2;sa128_obv4_1,sa128_obv4_3 | FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2, FULL{1}@sa128_obv4_3 | | 1003 | META$1004 | META | sa128_obv4_1,sa128_obv4_2 | FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2 | | 1004 | mq_t1 | USER | sa128_obv4_1,sa128_obv4_2 | FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2 | +-----------+-------------+-------------+----------------------------------------+------------------------------------------------------------------+ 5 rows in setNote
The locality
FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2is merely an example. In practice, the majority principle must be met after you add zones.
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 tenants and the distribution of replicas across zones in the cluster.
For example, the locality for the mq_t1 tenant is 'FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2', which indicates that the tenant has a full-featured replica in both of zones sa128_obv4_1 and sa128_obv4_2.