Skip to content

Latest commit

 

History

History
88 lines (64 loc) · 1.96 KB

File metadata and controls

88 lines (64 loc) · 1.96 KB

🛠️ Troubleshooting Guide - Lab 09: Job Registry with PostgreSQL

This file captures the issues and recovery steps documented during the lab workflow.

Connection refused error

(venv) toor@ip-172-31-10-184:~$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: enabled)
     Active: active (exited) since Sun 2026-04-12 17:39:58 UTC; 2min 14s ago
   Main PID: 4121 (code=exited, status=0/SUCCESS)
        CPU: 2ms

Apr 12 17:39:58 ip-172-31-10-184 systemd[1]: Starting postgresql.service - PostgreSQL RDBMS...
Apr 12 17:39:58 ip-172-31-10-184 systemd[1]: Finished postgresql.service - PostgreSQL RDBMS.
(venv) toor@ip-172-31-10-184:~$ sudo systemctl restart postgresql

Authentication failed

(venv) toor@ip-172-31-10-184:~$ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'labpassword';"
ALTER ROLE

Module not found (psycopg2)

If using virtual environment:

toor@ip-172-31-10-184:~$ source venv/bin/activate
(venv) toor@ip-172-31-10-184:~$ pip install psycopg2-binary
Requirement already satisfied: psycopg2-binary in ./venv/lib/python3.12/site-packages (2.9.10)

If not using a virtual environment:

toor@ip-172-31-10-184:~$ pip3 install --user psycopg2-binary
Collecting psycopg2-binary
  Using cached psycopg2_binary-2.9.10-cp312-cp312-manylinux_2_17_x86_64.whl
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.9.10

Permission denied on database

(venv) toor@ip-172-31-10-184:~$ sudo -u postgres psql -d job_registry -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;"
GRANT

Check existing jobs

(venv) toor@ip-172-31-10-184:~$ sudo -u postgres psql -d job_registry -c "SELECT COUNT(*) FROM jobs;"
 count
-------
     2
(1 row)