Packaged for:
- Ubuntu 14.04 (Trusty)
- Ubuntu 12.04 (Precise)
- Debian 7 (Wheezy)
- Debian 8 (Jesse)
- CentOS / RHEL 6
- CentOS / RHEL 7
- Fedora 20
- SUSE Linux Enterprise Server
64-bit only
Ubuntu 14.04 (Trusty)
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/pghero/pghero trusty master" | sudo tee /etc/apt/sources.list.d/pghero.list
sudo apt-get update
sudo apt-get install pghero
Ubuntu 12.04 (Precise)
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/pghero/pghero precise master" | sudo tee /etc/apt/sources.list.d/pghero.list
sudo apt-get update
sudo apt-get install pghero
Debian 7 (Wheezy)
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/pghero/pghero wheezy master" | sudo tee /etc/apt/sources.list.d/pghero.list
sudo apt-get update
sudo apt-get install pghero
Debian 8 (Jesse)
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/pghero/pghero jessie master" | sudo tee /etc/apt/sources.list.d/pghero.list
sudo apt-get update
sudo apt-get install pghero
CentOS / RHEL 6
sudo rpm --import https://rpm.packager.io/key
echo "[pghero]
name=Repository for pghero/pghero application.
baseurl=https://rpm.packager.io/gh/pghero/pghero/centos6/master
enabled=1" | sudo tee /etc/yum.repos.d/pghero.repo
sudo yum install pghero
CentOS / RHEL 7
sudo rpm --import https://rpm.packager.io/key
echo "[pghero]
name=Repository for pghero/pghero application.
baseurl=https://rpm.packager.io/gh/pghero/pghero/centos7/master
enabled=1" | sudo tee /etc/yum.repos.d/pghero.repo
sudo yum install pghero
Fedora 20
sudo rpm --import https://rpm.packager.io/key
echo "[pghero]
name=Repository for pghero/pghero application.
baseurl=https://rpm.packager.io/gh/pghero/pghero/fedora20/master
enabled=1" | sudo tee /etc/yum.repos.d/pghero.repo
sudo yum install pghero
SUSE Linux Enterprise Server
sudo rpm --import https://rpm.packager.io/key
sudo zypper addrepo "https://rpm.packager.io/gh/pghero/pghero/sles12/master" "pghero"
sudo zypper install pghero
Add your database.
sudo pghero config:set DATABASE_URL=postgres://user:password@hostname:5432/dbname
And optional authentication.
sudo pghero config:set PGHERO_USERNAME=link
sudo pghero config:set PGHERO_PASSWORD=hyrule
Start the server - defaults to port 6000
.
sudo pghero scale web=1
Confirm it’s running with:
curl -v http://localhost:6000/
To open to the outside world, add a proxy. Here’s how to do it with Nginx on Ubuntu.
sudo apt-get install -y nginx
cat | sudo tee /etc/nginx/sites-available/default <<EOF
server {
listen 80;
server_name "";
location / {
proxy_pass http://localhost:6000;
}
}
EOF
sudo service nginx restart
sudo service pghero status
sudo service pghero start
sudo service pghero stop
sudo service pghero restart
Query stats can be enabled from the dashboard. If you run into issues, view the guide.
To track query stats over time, create a table to store them.
CREATE TABLE "pghero_query_stats" ("id" serial primary key, "database" text, "query" text, "total_time" float, "calls" bigint, "captured_at" timestamp)
CREATE INDEX "index_pghero_query_stats_on_database_and_captured_at" ON "pghero_query_stats" ("database", "captured_at")
This table can be in the current database or another database. If another database, run:
sudo pghero config:set PGHERO_STATS_DATABASE_URL=...
Schedule the task below to run every 5 minutes.
sudo pghero run rake pghero:capture_query_stats
After this, a time range slider will appear on the Queries tab.
CPU usage is available for Amazon RDS. Add these variables to your environment:
sudo pghero config:set PGHERO_ACCESS_KEY_ID=accesskey123
sudo pghero config:set PGHERO_SECRET_ACCESS_KEY=secret123
sudo pghero config:set PGHERO_DB_INSTANCE_IDENTIFIER=epona
Change the port - you cannot use a privileged port like 80
or 443
sudo pghero config:set PORT=6000 # default
Minimum time for long running queries
sudo pghero config:set PGHERO_LONG_RUNNING_QUERY_SEC=60 # default
Minimum average time for slow queries
sudo pghero config:set PGHERO_SLOW_QUERY_MS=20 # default
Minimum calls for slow queries
sudo pghero config:set PGHERO_SLOW_QUERY_CALLS=100 # default
Minimum connections for high connections warning
sudo pghero config:set PGHERO_TOTAL_CONNECTIONS_THRESHOLD=100 # default
Ubuntu and Debian
sudo apt-get update
sudo apt-get install --only-upgrade pghero
CentOS, RHEL, and Fedora
sudo yum update
sudo yum install pghero
SUSE
sudo zypper update pghero
❤️ Made possible by Packager