This topic describes how to view the replica types and distribution of tenants through the DBA_OB_TENANTS view.
For more information about the DBA_OB_TENANTS view, see DBA_OB_TENANTS.
Procedure
Log in to the sys tenant of the cluster as the root user.
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_2in the preceding example is for illustration only. In practice, ensure that the number of zones added can satisfy the majority principle.
The LOCALITY column in the DBA_OB_TENANTS view indicates the replica types and distribution of a tenant. Locality describes the replica types of a tenant and their distribution across zones in the cluster.
For example, for tenant mq_t1, LOCALITY = 'FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2' indicates that there is one full-featured replica in each of sa128_obv4_1 and sa128_obv4_2.