deeejay

Bash - PostgreSQL Admin Commands

Feb 19th, 2016
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.95 KB | None | 0 0
  1. Check if postgresql is running
  2. ===
  3. /etc/rc.d/init.d/postgresql status
  4. /etc/rc.d/init.d/postgresql-9.3 status
  5.  
  6. Find all processes running under postgres user
  7. ===
  8. ps -f -u postgres
  9. ps auxw | grep post
  10.  
  11. Show the TCP/IP addresses and ports PostgreSQL is listening on
  12. ===
  13. lsof -n -u posgres | grep LISTEN
  14. netstat -ltnp | grep postgres
  15.  
  16. A failure message suggesting that another postmaster is already running should be checked carefully, for example by using the command
  17. ===
  18. ps ax | grep postmaster
  19. ps -ef | grep postmaster
  20.  
  21. Grand sudo access
  22. ===
  23. visudo
  24.  
  25. Secure access by disabling root and giving your Linux user account an ssh key
  26. ===
  27. On remote terminal:
  28. cd (homedir)
  29. mkdir .ssh
  30. touch .ssh/authorized_keys
  31. on remote machine:
  32. cat .ssh/id_rsa.pub
  33. copy
  34. On remote terminal:
  35. paste key into .ssh/authorized_keys
  36. Logon as root:
  37. sudo su -
  38. mv .ssh/authorized_keys .ssh/authorized_keys_OLD
  39.  
  40. Edit pg_hba.conf
  41. ===
  42. vi /etc/postgresql/9.3/pg_hba.conf
Advertisement
Add Comment
Please, Sign In to add comment