guides/Linux.md in pghero-2.0.2 vs guides/Linux.md in pghero-2.0.3
- old
+ new
@@ -1,84 +1,75 @@
# PgHero for Linux
-Packaged for:
+Distributions
-- Ubuntu 16.04 (Xenial)
-- Ubuntu 14.04 (Trusty)
-- Ubuntu 12.04 (Precise)
-- Debian 7 (Wheezy)
-- Debian 8 (Jesse)
-- CentOS / RHEL 7
-- SUSE Linux Enterprise Server 12
+- [Ubuntu 16.04 (Xenial)](#ubuntu-1604-xenial)
+- [Ubuntu 14.04 (Trusty)](#ubuntu-1404-trusty)
+- [Debian 8 (Jesse)](#debian-8-jesse)
+- [Debian 7 (Wheezy)](#debian-7-wheezy)
+- [CentOS / RHEL 7](#centos--rhel-7)
+- [SUSE Linux Enterprise Server 12](#suse-linux-enterprise-server-12)
64-bit only
## Installation
-Ubuntu 16.04 (Xenial)
+### Ubuntu 16.04 (Xenial)
```sh
-wget -qO - https://deb.packager.io/key | sudo apt-key add -
-echo "deb https://deb.packager.io/gh/pghero/pghero xenial master" | sudo tee /etc/apt/sources.list.d/pghero.list
+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
```
-Ubuntu 14.04 (Trusty)
+### Ubuntu 14.04 (Trusty)
```sh
-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
+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/14.04.repo
sudo apt-get update
sudo apt-get -y install pghero
```
-Ubuntu 12.04 (Precise)
+### Debian 8 (Jesse)
```sh
-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 -y install pghero
-```
-
-Debian 7 (Wheezy)
-
-```sh
sudo apt-get -y install apt-transport-https
-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
+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
```
-Debian 8 (Jesse)
+### Debian 7 (Wheezy)
```sh
sudo apt-get -y install apt-transport-https
-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
+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/7.repo
sudo apt-get update
sudo apt-get -y install pghero
```
-CentOS / RHEL 7
+### CentOS / RHEL 7
```sh
-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 wget -O /etc/yum.repos.d/pghero.repo \
+ https://dl.packager.io/srv/pghero/pghero/master/installer/el/7.repo
sudo yum -y install pghero
```
-SUSE Linux Enterprise Server 12
+### SUSE Linux Enterprise Server 12
```sh
-sudo rpm --import https://rpm.packager.io/key
-sudo zypper addrepo "https://rpm.packager.io/gh/pghero/pghero/sles12/master" "pghero"
+sudo wget -O /etc/zypp/repos.d/pghero.repo \
+ https://dl.packager.io/srv/pghero/pghero/master/installer/sles/12.repo
sudo zypper install pghero
```
## Setup
@@ -156,12 +147,12 @@
"query" text,
"query_hash" bigint,
"total_time" float,
"calls" bigint,
"captured_at" timestamp
-)
-CREATE INDEX ON "pghero_query_stats" ("database", "captured_at")
+);
+CREATE INDEX ON "pghero_query_stats" ("database", "captured_at");
```
This table can be in the current database or another database. If another database, run:
```sh
@@ -186,12 +177,12 @@
"database" text,
"schema" text,
"relation" text,
"size" bigint,
"captured_at" timestamp
-)
-CREATE INDEX ON "pghero_space_stats" ("database", "captured_at")
+);
+CREATE INDEX ON "pghero_space_stats" ("database", "captured_at");
```
Schedule the task below to run once a day.
```sh
@@ -210,16 +201,15 @@
## Multiple Databases
Create a `pghero.yml` with:
```yml
-production:
- databases:
- primary:
- url: postgres://...
- replica:
- url: postgres://...
+databases:
+ primary:
+ url: postgres://...
+ replica:
+ url: postgres://...
```
And run:
```sh
@@ -258,22 +248,25 @@
Ubuntu and Debian
```sh
sudo apt-get update
sudo apt-get install --only-upgrade pghero
+sudo service pghero restart
```
CentOS and RHEL
```sh
sudo yum update
sudo yum install pghero
+sudo service pghero restart
```
SUSE
```sh
sudo zypper update pghero
+sudo service pghero restart
```
## Credits
:heart: Made possible by [Packager](https://packager.io/)