PostgreSQL is the world’s most advanced open source database. Its stability, functionality, and extensibility make it a primary choice for an RDBMS solution. In this hands-on lab scenario you are the DBA for Awesome Company. You have been tasked with building a PostgreSQL database backend to facilitate the development of a new web application. You have already installed the database software and are now ready to configure it to your company’s standards. Performing the configuration tasks of this lab will help you become acquainted with administering permissions via roles, enabling remote connections, and setting server-level options.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Administer Permissions via Roles
- Change to the
postgres
user and launchpsql
. - Give the
postgres
role a password (enter and confirm). - Create a database for the web application.
- Connect to the new database.
- Create a role for the web application.
- Give the
acwebapp
role a password (enter and confirm).
- Change to the
- Enable Remote Connections
- Exit back to
cloud_user
, and editpostgresql.conf
to listen on any address. - Search for listen_addresses, uncomment it, and set it to
*
. Save and quit. - Edit
pg_hba.conf
file. - Append a line to the bottom of the file that will enable remote connections.
- Save and exit.
- Restart the PostgreSQL service.
- Exit back to
- Set Server-Level Options
- Edit the
postgresql.conf
file. - Find the
port
setting underCONNECTIONS AND AUTHENTICATION
, uncomment it, and change the value to1433
. - Below that, change max_connections to
500
. - Find the
shared_buffers
setting under- Memory -
and change the value to256MB
. - Save and exit, then restart the PostgreSQL service.
- Edit the
- Test Changes
- Using an external client of your choosing, connect to the
acweb
database asacwebapp
. (For the purposes of this example we will use pgAdmin, found at https://www.pgadmin.org.) - Right-click Servers, go to Create, and click on Server.
- Provide a name for the server connection.
- On the Connection tab, enter the following information:
- Hostname/address: The public IP address of your lab server
- Port: 1433
- Username: acwebapp
- Password: The password you set for
acwebapp
earlier
- Click Save.
- If it connects, you have successfully enabled remote connections and provisioned a role for the web application.
- Right-click on a database and click Query Tool. Verify values for all the settings that were changed.
- Using an external client of your choosing, connect to the