postgresql.md (804B)
1 ``` 2 psql -U user db 3 \l # list databases 4 \c db # connect to database 5 \dt # list tables 6 ``` 7 8 ## mastodon 9 * change user password (doesn't have one by default) 10 ``` 11 psql -p 5432 -U mastodon mastodon_production -w 12 alter user mastodon with password '<password>'; 13 ``` 14 update `.env.production` 15 16 ### setting up nagios monitoring 17 * download check_postgres plugin 18 ``` 19 cd /opt/nagios/custom_plugins 20 wget "https://bucardo.org/downloads/check_postgres.tar.gz" 21 tar xf check_postgres.tar.gz 22 cd check_postgres... 23 ./check_postgres.pl --symlinks 24 ``` 25 * open port on mastodon server 26 ``` 27 iptables -A INPUT -p tcp -s laundry.tilde.gdn --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT 28 ``` 29 https://www.digitalocean.com/community/tutorials/how-to-monitor-your-managed-postgresql-database-using-nagios-core-on-ubuntu-18-04 30 31