Sample Exam Questions

From the objective of OSS-DB Exam Silver
S2.3 Configuration files (postgresql.conf)

Sample Question

2.23

"A PostgreSQL server running on a host with IP address 192.168.1.11 wants to accept connections from clients with IP address 192.168.1.51.
Choose two appropriate lines to write in postgresql.conf."

 
  1. listen_addresses = ''

  2. listen_addresses = '*'

  3. isten_addresses = 'localhost'

  4. listen_addresses = '192.168.1.11'

  5. isten_addresses = '192.168.1.51'

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/07

Answer and Explanation

To allow PostgreSQL to accept connections over a TCP/IP network, you need to configure postgresql.conf. The important parameters are listen_addresses and port.

The PostgreSQL server listens for connections to the port number specified by port on the network interface specified by listen_addresses. For the network interface, you are supposed to specify the host name or IP address of the local host, but you can usually specify listen_addresses = '*' because * monitors all available interfaces.
If you have multiple network interfaces and you want to allow connections on only one of them, specify the name or IP address of the interface.

If listen_addresses is not specified or is localhost, only connections from clients within the local host are accepted. If you specify the IP address of another host, a socket creation error will probably occur and the database server will not start.

listen_addresses cannot be set to constrain the source client, such that connections can be made from 192.168.1.51 but not from 192.168.1.101. This is accomplished by configuring pg_hba.conf appropriately.

So the correct answers are B and D.