Display Node Start Times

The pg_postmaster_start_time() function returns the start time of the server where you execute it.

Example:

But your YugabyteDB database is most likely a cluster of more than one node.

To get the start time of each of your nodes, you can do something like this in YSQL: 

				
					
yugabyte=# SELECT host FROM yb_servers() ORDER BY host; -- IP address for each cluster node
      host
----------------
 192.168.56.110
 192.168.56.111
 192.168.56.112
(3 rows)

yugabyte=# \! ysqlsh -h 192.168.56.110 -Atc "SELECT '\! ysqlsh -h ' || host || ' -Atc \"SELECT ''Host: ' || host || ' Start time: '' || pg_postmaster_start_time();\"' FROM yb_servers() ORDER BY host;" | ysqlsh -h 192.168.56.110
Host: 192.168.56.110 Start time: 2022-04-13 14:10:09.411879+00
Host: 192.168.56.111 Start time: 2022-04-13 14:10:48.193883+00
Host: 192.168.56.112 Start time: 2022-04-13 14:11:04.496599+0
				
			
				
					
yugabyte=# SELECT inet_server_addr(); -- IP address of current node
 inet_server_addr
------------------
 192.168.56.110
(1 row)

yugabyte=# SELECT pg_postmaster_start_time() node_start_time;
        node_start_time
-------------------------------
 2022-04-13 14:10:09.411879+00
(1 row)
				
			

Have Fun!