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 on 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 in the preceding example is
FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2. 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, LOCALITY = 'FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2' for the mq_t1 tenant indicates that the tenant has one full-featured replica in both sa128_obv4_1 and sa128_obv4_2.