Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 78867f2

Browse files
committed
Simplify and improve README
1 parent d7025bd commit 78867f2

File tree

1 file changed

+76
-136
lines changed

1 file changed

+76
-136
lines changed

README.md

+76-136
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,40 @@
1-
# Demo
1+
### Demo: [an example of postgres-checkup report](https://gitlab.com/postgres-ai/postgres-checkup-tests/blob/master/1.1/md_reports/1_2019_05_30T18_32_32_+0000/0_Full_report.md) (based on CI, single node).
22

3-
Auto-generated demonstration based on the code in the master
4-
branch (only single node analyzed): https://gitlab.com/postgres-ai-team/postgres-checkup-tests/tree/master/master.
5-
Go to `md_reports/TIMESTAMP` and then open `0_Full_report.md`.
3+
***Disclaimer: Conclusions, Recommendations – work in progress.**
4+
To treat the data correctly, you need deep Postgres knowledge. Each report
5+
consists of 3 sections: Observations, Conclusions, and Recommendations.
6+
Observations are filled automatically. As for Conclusions and Recommendations
7+
sections, as of June 2019, only several reports have autogeneration for them.*
68

7-
# Disclaimer: This Tool is Designed for DBA Experts
8-
9-
Each report consists of 3 sections: Observations, Conclusions, and Recommendations.
10-
As of March 2019, only Observations are filled automatically. To treat the data
11-
correctly, you need deep Postgres knowledge.
12-
13-
You can get Conclusions, and Recommendations from the Postgres.ai team for free,
14-
send us your .json and .md with filled Observations sections: [email protected].
15-
Limited time only. We're a small team, so "restrictions apply".
169

1710
# About
1811

1912
Postgres Checkup ([postgres-checkup](https://gitlab.com/postgres-ai-team/postgres-checkup))
20-
is a new-generation diagnostics tool that allows users to collect deep analysis
21-
of the health of a Postgres database. It aims to detect and describe all current
22-
and potential issues in the fields of database performance, scalability, and
23-
security, providing advices how to resolve or prevent them.
24-
25-
Compared to a monitoring system, postgres-checkup goes deeper into the analysis
26-
of the database system and environment. It combines numerous internal
27-
characteristics of the database with data about resources and OS, producing
28-
multiple comprehensive reports. These reports use formats which are easily
29-
readable both by humans and machines and which are extremely oriented to DBA
30-
problem-solving. Monitoring systems constantly collect telemetry, help to react
31-
to issues more quickly, and are useful for post-mortem analyses. At the same
32-
time, checkups are needed for a different purpose: detect issues at a very early
33-
stage, advising on how to prevent them. This procedure is to be done on a
34-
regular basis — weekly, monthly, or quarterly. Additionally, it is recommended
35-
to run it immediately before and after any major change in the database server.
13+
is a new-generation diagnostics tool that allows users to do a deep analysis
14+
of the health of Postgres databases. It helps to detect, predict and prevent
15+
technical issues.
3616

3717
The three key principles behind postgres-checkup:
3818

3919
- *Unobtrusiveness*: postgres-checkup’s impact on the observing system is
4020
close to zero. It does not use any heavy queries, keeping resource usage
41-
very low, and avoiding having the [“observer effect.”](https://en.wikipedia.org/wiki/Observer_effect_(information_technology))
21+
very low, and avoiding having the [“observer effect”](https://en.wikipedia.org/wiki/Observer_effect_(information_technology)).
22+
postgres-checkup reports were successfully tested on real-world databases
23+
containing 500,000+ tables and 1,000,000+ indexes.
4224

4325
- *Zero install* (on observed machines): it is able to analyze any Linux
44-
machine (including virtual machines), as well as Cloud Postgres instances
26+
machine (including virtual machines), as well as cloud Postgres instances
4527
(such as Amazon RDs or Google Cloud SQL), not requiring any additional setup
46-
or any changes. It does, hovewer, require a privileged access (a DBA usually
47-
has it anyway).
28+
or any changes. It does, hovewer, require a privileged access that a DBA usually
29+
has anyway.
4830

49-
- *Complex analysis*: unlike most monitoring tools, which provide raw data,
31+
- *Complex analysis*: unlike most monitoring tools, which provide just raw data,
5032
postgres-checkup combines data from various parts of the system (e.g.,
5133
internal Postgres stats are combined with knowledge about system resources
52-
in autovacuum setting and behavior analysis). Also, it analyzes the master
53-
database server together with all its replicas (e.g. to build the list of
54-
unused indexes).
34+
in autovacuum setting and behavior analysis) joining the data into well-formatted
35+
reports aimed to solve particular DBA problems. Also, it analyzes the master
36+
database server together with all its replicas, which is neccessary in such
37+
cases as index analysis or search for settings deviations.
5538

5639
# Reports Structure
5740

@@ -71,25 +54,28 @@ Each report consists of three sections:
7154

7255
1. "Observations": automatically collected data. This is to be consumed by
7356
an expert DBA.
74-
1. "Conclusions": what we conclude from the Observations—what is good, what
75-
is bad (right now, it is to be manually filled for most checks).
57+
1. "Conclusions": what we conclude from the Observations, stated in plain English
58+
in the form that is convenient for engineers who are not DBA experts.
7659
1. "Recommendations": action items, what to do to fix the discovered issues.
60+
7761
Both "Conclusions" and "Recommendations" are to be consumed by engineers who
78-
will make decisions what, how and when to optimize, and how to react to the
79-
findings.
62+
will make decisions what, how and when to optimize.
8063

8164
# Installation and Usage
8265

8366
## Requirements
8467

85-
The supported OS of the observer machine (those from which the tool is to be
86-
executed):
68+
For the operator machine (from where the tool will be executed), the following
69+
OS are supported:
8770

8871
* Linux (modern RHEL/CentOS or Debian/Ubuntu; others should work as well, but
8972
are not yet tested);
9073
* MacOS.
9174

92-
The following programs must be installed on the observer machine:
75+
There are known cases when postgres-checkup was successfully used on Windows,
76+
althought with some limitations.
77+
78+
The following programs must be installed on the operator machine:
9379

9480
* bash
9581
* psql
@@ -101,53 +87,66 @@ The following programs must be installed on the observer machine:
10187
* pandoc *
10288
* wkhtmltopdf >= 0.12.4 *
10389

104-
Pandoc and wkhtmltopdf optional, they need for generating HTML and PDF versions
105-
of report (see `--pdf` and `--html`).
90+
pandoc and wkhtmltopdf are optional, they are neededed for generating HTML and
91+
PDF versions of report (options `--html`, `--pdf`).
10692

107-
Nothing special has to be installed on the observed machines. However, these
108-
machines must run Linux (again: modern RHEL/CentOS or Debian/Ubuntu; others
109-
should work as well, but are not yet tested).
93+
Nothing special has to be installed on the observed machines. However, they must
94+
run Linux (again: modern RHEL/CentOS or Debian/Ubuntu; others should work as
95+
well, but are not yet tested).
11096

111-
:warning: Only Postgres version 9.6 and higher are currently supported.
97+
:warning: Only Postgres version 9.6 and higher are currently officially supported.
11298

11399
## How to Install
114100

115101
#### 1. Install required programs
116102

117103
Ubuntu/Debian:
118-
```
119-
sudo apt-get update
120-
sudo apt-get install git postgresql coreutils jq golang
121-
# Optional (if you need PDF/HTML)
122-
# Pandoc (needed for both HTML and PDF generation)
123-
sudo apt install pandoc
124-
# wkhtmltopdf (needed for PDF generation)
104+
```bash
105+
sudo apt-get update -y
106+
sudo apt-get install -y git postgresql coreutils jq golang
107+
108+
# Optional (to generate PDF/HTML reports)
109+
sudo apt-get install -y pandoc
125110
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
126111
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
127112
sudo mv wkhtmltox/bin/wkhtmlto* /usr/local/bin
128113
sudo apt-get install -y openssl libssl-dev libxrender-dev libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
129114
```
130115

131-
MacOS (assuming that [Homebrew](https://brew.sh/) is installed):
116+
CentOS/RHEL:
117+
```bash
118+
sudo yum install -y git postgresql coreutils jq golang
119+
120+
# Optional (to generate PDF/HTML reports)
121+
sudo yum install -y pandoc
122+
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
123+
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
124+
sudo mv wkhtmltox/bin/wkhtmlto* /usr/local/bin
125+
sudo yum install -y libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
132126
```
133-
brew install postgresql
134-
brew install coreutils
135-
brew install jq
136-
brew install golang
137-
brew install git
138-
# Optional
139-
brew install pandoc
140-
brew install Caskroom/cask/wkhtmltopdf
127+
128+
MacOS (assuming that [Homebrew](https://brew.sh/) is installed):
129+
```bash
130+
brew install postgresql coreutils jq golang git
131+
132+
# Optional (to generate PDF/HTML reports)
133+
brew install pandoc Caskroom/cask/wkhtmltopdf
141134
```
142135

143136
#### 2. Clone this repo
144137

145-
Use `git clone`. This is the only method of installation currently supported.
138+
```bash
139+
git clone https://gitlab.com/postgres-ai/postgres-checkup.git
140+
# Use --branch to use specific release version. For example, to use version 1.1:
141+
# git clone --branch 1.1 https://gitlab.com/postgres-ai/postgres-checkup.git
142+
cd postgres-checkup
143+
```
146144

147145
## Example of Use
148146

149-
Let's make a report for a project named `prod1`:
150-
Cluster `slony` contains two servers - `db1.vpn.local` and `db1.vpn.local`.
147+
Let's make a report for a project named `prod1`. Assume that we have two servers,
148+
`db1.vpn.local` and `db1.vpn.local`.
149+
151150
Postgres-checkup automatically detects which one is a master:
152151

153152
```bash
@@ -229,37 +228,14 @@ The check result can be found inside the `artifacts` folder in current directory
229228

230229
### Usage with `docker run`
231230

232-
First of all we need a postgres. You can use any local or remote running instance.
233-
For this example we run postgres in a separate docker container:
234-
235-
```bash
236-
docker run \
237-
--name postgres \
238-
-e POSTGRES_PASSWORD=postgres \
239-
-d postgres
240-
```
241-
242-
We need to know a hostname or an ip address of target database to be used with `-h` parameter:
243-
244-
```bash
245-
PG_HOST=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' postgres)
246-
```
247-
248-
You can use official images or build an image yourself. Run this command to build an image:
249-
250-
```bash
251-
docker build -t postgres-checkup .
252-
```
253-
254-
Then run a container with `postgres-checkup`. This command run the tool using
255-
Postgres connection only (without SSH):
231+
There is an option to run postgres-checkup in a Docker container:
256232

257233
```bash
258234
docker run --rm \
259235
--name postgres-checkup \
260236
-e PGPASSWORD="postgres" \
261237
-v `pwd`/artifacts:/artifacts \
262-
postgres-checkup \
238+
registry.gitlab.com/postgres-ai/postgres-checkup:latest \
263239
./checkup \
264240
-h hostname \
265241
-p 5432 \
@@ -276,14 +252,16 @@ target machine with Postgres database.
276252

277253
If SSH connection to the Postgres server is available, it is possible to pass
278254
SSH keys to the docker container, so postgres-checkup will switch to working via
279-
remote SSH calls, generating all reports:
255+
remote SSH calls, generating all reports (this approach is known to have issues
256+
on Windows, but should work well on Linux and MacOS machines):
280257

281258
```bash
282259
docker run --rm \
283260
--name postgres-checkup \
284261
-v "$(pwd)/artifacts:/artifacts" \
285262
-v "$(echo ~)/.ssh/id_rsa:/root/.ssh/id_rsa:ro" \
286-
postgres-checkup ./checkup \
263+
registry.gitlab.com/postgres-ai/postgres-checkup:latest \
264+
./checkup \
287265
-h sshusername@hostname \
288266
--username my_postgres_user \
289267
--dbname my_postgres_database \
@@ -296,19 +274,6 @@ you cannot use `localhost` in `-h` parameter. You have to use a bridge between
296274
host OS and Docker Engine. By default, host IP is `172.17.0.1` in `docker0`
297275
network, but it vary depending on configuration. More information [here](https://nickjanetakis.com/blog/docker-tip-65-get-your-docker-hosts-ip-address-from-in-a-container).
298276

299-
### Usage with `docker-compose`
300-
301-
It will run an empty `postgres` database and `postgres-checkup` application
302-
that will stop once it's done. The local folder named `artifacts` will contain
303-
the `docker` subfolder with checkup reports.
304-
305-
```bash
306-
docker-compose build
307-
docker-compose up -d
308-
309-
docker-compose down
310-
```
311-
312277
## Credits
313278

314279
Some reports are based on or inspired by useful queries created and improved by
@@ -351,6 +316,7 @@ Docker support implemented by [Ivan Muratov](https://gitlab.com/binakot).
351316
- [ ] C004 Failover #32
352317
- [ ] C005 Switchover #33
353318
- [ ] C006 Delayed replica (replay of 1 day of WALs) - #34
319+
- [ ] C007 Replication slots. Lags. Standby feedbacks
354320

355321
## D. Monitoring / Troubleshooting
356322

@@ -407,30 +373,4 @@ Docker support implemented by [Ivan Muratov](https://gitlab.com/binakot).
407373
- [x] L001 (was: H003) Current sizes of DB objects (tables, indexes, mat. views) #163
408374
- [ ] L002 (was: H004) Data types being used #53
409375
- [x] L003 Integer (int2, int4) out-of-range risks in PKs // calculate capacity remained; optional: predict when capacity will be fully used) https://gitlab.com/postgres-ai-team/postgres-checkup/issues/237
410-
411-
## TODO:
412-
413-
- [ ] DB schema, DDL, DB schema migrations
414-
415-
---
416-
417-
# Ideas :bulb: :bulb: :bulb: :thinking\_face:
418-
419-
- analyze all FKs and check if data types of referencing column and referenced one match (same thing for multi-column FKs)
420-
- tables w/o PKs? tables not having even unique index?
421-
422-
## PostgreSQL:
423-
424-
- ready to archive WAL files (count) (need FS access) on master
425-
- standby lag in seconds
426-
427-
## OS:
428-
429-
- FS settings (mount command parsing)
430-
- meltdown/spectre patches
431-
- swap settings
432-
- memory pressure settings
433-
- overcommit settings
434-
- NUMA enabled?
435-
- Huge pages?
436-
- Transparent huge pages?
376+
- [ ] L004 Tables without PK/UK

0 commit comments

Comments
 (0)