Install pghero on Ubuntu – A performance dashboard for Postgres
In this tutorial I will show you how to install pghero on Ubuntu & Debian.
A performance dashboard for Postgres – health checks, suggested indexes, and more. PgHero 2.0 provides, even more, insight into your database performance with two additional features: query details and space stats.
PgHero makes it easy to see the most time-consuming queries during a given time period, but it’s hard to follow an individual query’s performance over time. When you run into issues, it’s not always easy to uncover what happened. Are the top queries during an incident consistently the most time-consuming, or are they new? Did the number of calls increase or was it the average time?
Source: pghero
Prerequisites
- Ubuntu 16.04 or Debian 8 must be installed
- Postgres Server must be installed
You might also like: How to install postgres 9.6 on Ubuntu 16.04
Install pghero for Ubuntu 16.04
In this step we will create pghero repo file and add pghero repo url.
# wget -qO- https://dl.packager.io/srv/pghero/pghero/key | sudo apt-key add -
# sudo wget -O /etc/apt/sources.list.d/pghero.list \
https://dl.packager.io/srv/pghero/pghero/master/installer/ubuntu/16.04.repo
# sudo apt-get update
# sudo apt-get -y install pghero
Install pghero on Debian 8
# sudo apt-get -y install apt-transport-https
# wget -qO- https://dl.packager.io/srv/pghero/pghero/key | sudo apt-key add -
# sudo wget -O /etc/apt/sources.list.d/pghero.list \
# https://dl.packager.io/srv/pghero/pghero/master/installer/debian/8.repo
# sudo apt-get update
# sudo apt-get -y install pghero
Setup pghero
We have installed pghero now its time to set it up and get it running.
Add database
In this step we will add database that we want to view the performance. I am adding my local postgres database in pghero. You need to replace the user, password, port, hostname and database name with yours.
# pghero config:set DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
Now we have added our database let’s start the pghero.
Start the pghero server
Now we will start our pghero server.
# pghero config:set PORT=3001
# pghero config:set RAILS_LOG_TO_STDOUT=disabled
# pghero scale web=1
View the dashboard
Now we have start the pghero server lets check the dashboard. Go to ipaddress of your server and port 3001.
ip-address:3001
Management of pghero
Use the following commands to manage the pghero.
Check status of pghero
# service pghero status or systemctl status pghero
Start pghero
# service pghero start or systemctl start pghero
Stop pghero
# service pghero stop or systemctl stop pghero
Restart pghero
# service pghero restart or systemctl restart pghero
View pghero logs
You can use the following command to view the logs of pghero.
# pghero logs
Yay! we have set up pghero on Ubuntu.
Reference: https://github.com/ankane/pghero/blob/master/guides/Linux.md#centos–rhel-7
Read Next: Install pghero on mac with docker – performance dashboard for Postgres
If you have any issue installing pghero on Ubuntu or Debian please feel free to comment below.
Leave a Reply