- Lab
- A Cloud Guru
Configuring PostgreSQL on CentOS
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.
Path Info
Table of Contents
-
Challenge
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
-
Challenge
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
-
Challenge
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
-
Challenge
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
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.