GBase 8a 查看服务运行时间和启动时间

GBase 8a数据库集群启动后,记录了运行的秒数uptime,根据该时间,可以反推开机时间。

运行时间uptime

单位是秒

gbase> show status like 'uptime';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Uptime        | 312886 |
+---------------+--------+
1 row in set (Elapsed: 00:00:00.00)

开机时间

根据当前时间和运行时间,反算开机时间。 获得当前的时间戳(单位秒),减去运行时间,再转换成时间即可。

gbase> select from_unixtime(unix_timestamp(now())-312886);
+---------------------------------------------+
| from_unixtime(unix_timestamp(now())-312886) |
+---------------------------------------------+
| 2021-11-25 17:47:36                         |
+---------------------------------------------+
1 row in set (Elapsed: 00:00:00.00)

说明

记录和对比各个节点服务的运行时间,gclusterd和gnode,可以查看是节点服务是否重启。