guides/Linux.md in pghero-1.5.2 vs guides/Linux.md in pghero-1.5.3

- old
+ new

@@ -1,22 +1,30 @@ # PgHero for Linux Packaged for: +- Ubuntu 16.04 (Xenial) - 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 +- SUSE Linux Enterprise Server 12 64-bit only ## Installation +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 +sudo apt-get update +sudo apt-get -y install pghero +``` + 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 @@ -34,10 +42,11 @@ ``` 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 sudo apt-get update sudo apt-get -y install pghero ``` @@ -50,47 +59,25 @@ 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 -y install pghero ``` -CentOS / RHEL 6 - -```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/centos6/master -enabled=1" | sudo tee /etc/yum.repos.d/pghero.repo -sudo yum install pghero -``` - 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 yum install pghero +sudo yum -y install pghero ``` -Fedora 20 +SUSE Linux Enterprise Server 12 ```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/fedora20/master -enabled=1" | sudo tee /etc/yum.repos.d/pghero.repo -sudo yum install pghero -``` - -SUSE Linux Enterprise Server - -```sh -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 ``` ## Setup @@ -106,20 +93,22 @@ ```sh sudo pghero config:set PGHERO_USERNAME=link sudo pghero config:set PGHERO_PASSWORD=hyrule ``` -Start the server - defaults to port `6000`. +Start the server ```sh +sudo pghero config:set PORT=3001 +sudo pghero config:set RAILS_LOG_TO_STDOUT=disabled sudo pghero scale web=1 ``` Confirm it’s running with: ```sh -curl -v http://localhost:6000/ +curl -v http://localhost:3001/ ``` To open to the outside world, add a proxy. Here’s how to do it with Nginx on Ubuntu. ```sh @@ -127,11 +116,11 @@ cat | sudo tee /etc/nginx/sites-available/default <<EOF server { listen 80; server_name ""; location / { - proxy_pass http://localhost:6000; + proxy_pass http://localhost:3001; } } EOF sudo service nginx restart ``` @@ -143,21 +132,36 @@ sudo service pghero start sudo service pghero stop sudo service pghero restart ``` +View logs + +```sh +sudo pghero logs +``` + ## Query Stats Query stats can be enabled from the dashboard. If you run into issues, [view the guide](Query-Stats.md). ## Historical Query Stats To track query stats over time, create a table to store them. ```sql -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") +CREATE TABLE "pghero_query_stats" ( + "id" serial primary key, + "database" text, + "user" text, + "query" text, + "query_hash" bigint, + "total_time" float, + "calls" bigint, + "captured_at" timestamp +) +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 @@ -182,16 +186,10 @@ sudo pghero config:set PGHERO_DB_INSTANCE_IDENTIFIER=epona ``` ## Customize -Change the port - you cannot use a privileged port like `80` or `443` - -```sh -sudo pghero config:set PORT=6000 # default -``` - Minimum time for long running queries ```sh sudo pghero config:set PGHERO_LONG_RUNNING_QUERY_SEC=60 # default ``` @@ -221,10 +219,10 @@ ```sh sudo apt-get update sudo apt-get install --only-upgrade pghero ``` -CentOS, RHEL, and Fedora +CentOS and RHEL ```sh sudo yum update sudo yum install pghero ```