linuxpostgresqlambarihdp

postgresql + how to print all hosts


we have ambari cluster with postgresql

we try to print all hosts in the cluster as the following , but seems my select command not right

psql -U ambari ambari
Password for user ambari:
psql (9.2.24)
Type "help" for help.

ambari=>
ambari-> select host_id from hosts;
ERROR:  syntax error at or near "select"
LINE 2: select host_id from hosts;
        ^
ambari=>

where I am wrong?


Solution

  • the command is ( with details of mem )

    ambari=>
    select host_name, ipv4, public_host_name, total_mem from hosts;
    

    or

    ambari=> select host_name,  public_host_name  from hosts;