hba table related commands
The hba table is used to manage the configuration items in the pg_hba.conf file that holds all coordiantor nodes in the AntDB cluster. When a configuration item is added, it is recorded in this table and used to identify it. For the added configuration items, you can display them by list hba command.
add hba
Command function: Add new hba configuration to coordinator. Obtain help information by \h add hba.
Command format:
Syntax:
ADD HBA GTMCOORD { ALL | nodename } ( "hba_value" )
ADD HBA COORDINATOR { ALL | nodename } ( "hba_value" )
ADD HBA DATANODE { ALL | nodename } ( "hba_value" )
where hba_value must be the following:
host database user IP-address IP-mask auth-method
Command example:
-- Add the configuration for all users on the 10.0.0.0 IP side to access all databases via md5 authentication to the coordinator's hba:
add hba coordinator all ("host all all 10.0.0.0 8 md5");
list hba
Command function:
Display the configuration items added by add hba.
Command format:
LIST HBA [ coord_name [, ...] ]
Command example:
postgres=# list hba;
nodename | hbavalue
----------+-----------------------------
coord1 | host all all 10.0.0.0 8 md5
coord2 | host all all 10.0.0.0 8 md5
coord3 | host all all 10.0.0.0 8 md5
coord4 | host all all 10.0.0.0 8 md5
(4 rows)
drop hba
Command function:
Delete the configuration items added by add hba.
Command format:
Syntax:
DROP HBA GTMCOORD { ALL | nodename } ( "hba_value" )
DROP HBA COORDINATOR { ALL | nodename } ( "hba_value" )
DROP HBA DATANODE { ALL | nodename } ( "hba_value" )
where hba_value must be the following:
host database user IP-address IP-mask auth-method
Command example:
-- Remove the configuration for all users on the 10.0.0.0 IP side to access all databases via md5 authentication from the coordinator's hba:
drop coordinator hba all ("host all all 10.0.0.0 8 trust");
show hba
Command function:
Display the hba information that is in the node pg_hba.conf.
Command format:
Description: show the content of the pg_hba.conf file
Syntax:
SHOW HBA { ALL | node_name }
Command example:
-- Display hba information for node cn1
show hba cn1;
nodetype | nodename | hbavalue
-------------+----------+------------------------------------------
coordinator | cn1 | local all all trust +
| | host all all 127.0.0.1 32 trust +
| | host all all ::1 128 trust +
| | local replication all trust +
| | host replication all 127.0.0.1 32 trust +
| | host replication all ::1 128 trust +
| | host all all 10.21.20.175 32 trust +
| | host all all 10.21.20.176 32 trust +
| | host all all 10.0.0.0 8 trust +
Unlike list hba, list only displays the hba information added by add hba, but show hba displays the contents of pg_hba.conf files in specific nodes.