Add PoWA for Postgres, small notes

master
Jeff Moe 6 years ago
parent 7809673eff
commit e24f32edf5

@ -10,12 +10,13 @@ mv /home/jebba/borg /root/
cd /root/borg cd /root/borg
# Note, get real string with correct host/user/pass: # Note, get real string with correct host/user/pass:
sed -i -e 's/user@host/1234@host.com/g' forksand-borg-* sed -i -e 's/user@host/1234@host.com/g' forksand-borg-*
# If repo is moved, run:
sed -i -e 's/BORG_RELOCATED_REPO_ACCESS_IS_OK=no/BORG_RELOCATED_REPO_ACCESS_IS_OK=yes/g' forksand-borg-* sed -i -e 's/BORG_RELOCATED_REPO_ACCESS_IS_OK=no/BORG_RELOCATED_REPO_ACCESS_IS_OK=yes/g' forksand-borg-*
# No password: # No password:
ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname` ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname`
# meh, remove exit 0 and run: # Create borg key:
./forksand-borg-add-key ./forksand-borg-add-key
# Initalize new repo, no passphrase: # Initalize new repo, no passphrase:

@ -6,7 +6,6 @@
# ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1] [-N new_passphrase] [-C comment] [-f output_keyfile] # ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1] [-N new_passphrase] [-C comment] [-f output_keyfile]
# ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname` # ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname`
exit 0
set -x set -x
export BORG_SERVER="user@host" export BORG_SERVER="user@host"

@ -11,3 +11,7 @@ ssh -N -C -L 5050:localhost:80 pgadmin
# On workstation, in browser: # On workstation, in browser:
http://localhost:5050/pgadmin4 http://localhost:5050/pgadmin4
# On postgres servers, add permissions for pgadmin node
# In browser, add servers...

@ -9,14 +9,18 @@ pg_top
# pg-activity # pg-activity
# pgtop # pgtop
# #
# Analysis, separate server: # Analysis, separate server. See powa/ dir.
# PoWa: # PoWa:
# postgresql-10-powa -- Workload analyzer # postgresql-10-powa -- Workload analyzer
# postgresql-10-pg-qualstats # postgresql-10-pg-qualstats
# postgresql-10-pgaudit # postgresql-10-pg-stat-kcache
# postgresql-10-hypopg - PostgreSQL extension adding support for hypothetical indexes. # postgresql-10-hypopg - PostgreSQL extension adding support for hypothetical indexes.
#
# pgbadger - Fast PostgreSQL log analysis report # pgbadger - Fast PostgreSQL log analysis report
# pgcluu - PostgreSQL performance monitoring and auditing tool # pgcluu - PostgreSQL performance monitoring and auditing tool
#
# postgresql-10-pgaudit
#
# Administration, separate server: # Administration, separate server:
# pgadmin -- web admin # pgadmin -- web admin

@ -0,0 +1,62 @@
# PoWA for PostgreSQL
# https://powa.readthedocs.io
##############################################################################
# Install on PostgreSQL Servers
# Using upstream postresql's repos, not Debian's repos.
apt install postgresql-10-powa postgresql-10-pg-qualstats postgresql-10-pg-stat-kcache postgresql-10-hypopg
# Add permissions for PoWA node
# Configure postgres:
vim /etc/postgresql/10/main/postgresql.conf
# Change:
# shared_preload_libraries to (keeping citus):
shared_preload_libraries='citus,pg_stat_statements,powa,pg_stat_kcache,pg_qualstats'
# Create databases, run on each pg1 pg2 pg3 pg4 server:
psql
CREATE DATABASE powa ;
\c powa
CREATE EXTENSION pg_stat_statements;
CREATE EXTENSION btree_gist;
CREATE EXTENSION powa;
CREATE EXTENSION pg_qualstats;
CREATE EXTENSION pg_stat_kcache;
CREATE EXTENSION hypopg;
CREATE ROLE powa SUPERUSER LOGIN PASSWORD 'password' ;
##############################################################################
# Install on Web Node
# Set up Debian Stretch node
# Install postgres repos:
echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt update
apt dist-upgrade
apt install postgresql-client-10
# There isn't a package of powa-web for Debian.
# Install dependencies:
apt install python python-psycopg2 python-sqlalchemy python-tornado
wget -O powa-web-3.1.4.tar.gz https://github.com/powa-team/powa-web/archive/3.1.4.tar.gz
tar -zxvf powa-web-3.1.4.tar.gz
cd powa-web-3.1.4
cp ./powa-web.conf-dist ./powa-web.conf
./powa-web
# XXX setup user, startup scripts, etc.
##############################################################################
# Admin Web Client
# On workstation create tunnel:
ssh -N -C -L 58888:localhost:8888 powa
# On workstation, in browser:
http://localhost:58888/
##############################################################################

@ -1,4 +1,7 @@
apt update ##############################################################################
# Prometheus Server
# To Install Server
#
# Stretch: # Stretch:
apt install -t stretch-backports prometheus apt install -t stretch-backports prometheus
# Buster: # Buster:
@ -14,7 +17,10 @@ apt install prometheus-alertmanager prometheus prometheus-node-exporter
-A INPUT -p tcp --dport 9094 -j ACCEPT -A INPUT -p tcp --dport 9094 -j ACCEPT
-A INPUT -p tcp --dport 9100 -j ACCEPT -A INPUT -p tcp --dport 9100 -j ACCEPT
##############################################################################
# Prometheus Clients
# Install exporter on all nodes # Install exporter on all nodes
#
# Stretch: # Stretch:
apt install -t stretch-backports prometheus-node-exporter apt install -t stretch-backports prometheus-node-exporter
# Buster: # Buster:
@ -41,6 +47,9 @@ vim /etc/default/prometheus-node-exporter
# Start on boot: # Start on boot:
systemctl enable prometheus-node-exporter systemctl enable prometheus-node-exporter
# Firewall open port for prometheus-node-exporter
-A INPUT -p tcp --dport 9100 -j ACCEPT
############################################################################## ##############################################################################
# For MySQL servers, on all servers: # For MySQL servers, on all servers:
apt install prometheus-mysqld-exporter apt install prometheus-mysqld-exporter

Loading…
Cancel
Save