怎么查全局授时服务在哪台机器上?

【 使用环境 】测试环境
【 OB 】
【 使用版本 】4.0.0.0
【问题描述】怎么查全局授时服务(Global Timestamp Service,简称 GTS)在哪台机器上?

● GTS 是集群的核心,根据租户的级别不同采用不同的方式实现高可用

○ 用户租户

■ OceanBase 数据库使用租户级别内部表 __all_dummy的 leader 作为 GTS 服务提供者,时间来源于该 leader 的本地时钟。GTS 默认是三副本的,其高可用能力跟普通表的能力一样。

○ 系统租户

使用 __all_core_table 的 leader 作为 GTS 服务的提供者,高可用能力与普通表一样。时间戳正确性保证。

不好意思羊了,躺了几天。
__all_dummy和__all_core_table 表的leader 在哪个节点,怎么查呢老师?


4.0版本说是租户级别 1 号

是用以下语句查吗?

obclient [oceanbase]> select svr_ip,count(1) from __all_virtual_ls_meta_table where tenant_id=1 and role=1;
±-------±---------+
| svr_ip | count(1) |
±-------±---------+
| NULL | 0 |
±-------±---------+
1 row in set (0.018 sec)

obclient [oceanbase]> select svr_ip,count(1) from __all_virtual_ls_meta_table where tenant_id=1001 and role=1;
±--------------±---------+
| svr_ip | count(1) |
±--------------±---------+
| 172.16.11.134 | 1 |
±--------------±---------+
1 row in set (0.048 sec)

GTS Service 启动在租户内部表 __all_dummy 的主副本上,没有外部的查看方法,只能通过 table_id 的偏移量来算,假设业务租户 ID 是 1003:

select svr_ip, role from __all_root_table where role=1 and table_id= (1003 << 40) + 135;

select svr_ip, role from __all_root_table where role=1 and table_id= (1002 << 40) + 135;
ERROR 1146 (42S02): Table ‘oceanbase.__all_root_table’ doesn’t exist

要在sys租户执行

obclient -h172.16.11.134 -P2883 -uroot@sys -Doceanbase

这样不是在系统租户执行的吗?