NOTE: You might see an output like above, this is because the demo setup was on a sandbox, so both master and segment nodes are on the same sandbox. We need to look at the path which says "master", in this case "/data/hawq/master.
Change directory to master data folder and make a copy of the file called pg_hba.conf
[root@sandbox ~]# cd /data/hawq/master
[root@sandbox master]# cp pg_hba.conf pg_hba.conf.orig
File "pg_hba.conf" will already have entries like the following
local all gpadmin ident
host all gpadmin 127.0.0.1/28 trust
host all gpadmin 172.16.105.183/32 trust
Here "host" or "local" specifies if the client entry point is local (on same host) or "host" from a different node (either within the same cluster or on the LAN)
"all" basically allows access to all the databases, this can be specific, for instance, "hdw" provided that is the name of your database
"gpadmin" is the default superuser for HAWQ cluster, this user has access to the cluster (within specified IP ranges)
IP address is either the 32-bit absolute IP address or could be opened to a subnet
"trust" is the method
Now to understand the last entry in the above example, we are providing access for from any "host", provided "all"/any database only when the user is "gpadmin" trying to connect from client which has the IP address "172.16.105.183" and method is "trust", so there is no password required. To understand pg_hba.conf better, here is the link: https://www.postgresql.org/docs/8.3/static/auth-pg-hba-conf.html
Now assuming that your edge node has an IP address of "172.26.78.183", database name is "test", username is "myuser", and you want to use securely use minimally secure login method "md5" then the entry would look something like this.
host test myuser 172.26.78.183/32 md5
Once the entry is made, we need to ensure that HAWQ is infact open to listening to remote hosts. A "*" signifies that HAWQ can listen to all remote hosts.
[gpadmin@sandbox ~]$ egrep -i --color listen_address /data/hawq/master/postgresql.conf
#listen_addresses = '*' # what IP address(es) to listen on;
Now ensure that our entry in pg_hba.conf file is cached by HAWQ process, hence, HAWQ will be able to restrict the creation new processes. (We need to be gpadmin user)
[gpadmin@sandbox ~]$ /usr/local/hawq/bin/pg_ctl reload -D /data/hawq/master
You should be able to connect using the psql now
[gpadmin@sandbox ~]$ psql -U myuser -h 172.16.105.183 -d test
Password for user myuser:
Type "help" for help.