在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:postgres-checkup开源软件地址:https://gitee.com/mirrors/postgres-checkup开源软件介绍:Please support the project giving a GitLab star (it's on the main page,at the upper right corner): Demo: an example of postgres-checkup report (based on CI, multi node).Disclaimer: Conclusions, Recommendations – work in progress.To treat the data correctly, you need deep Postgres knowledge. Each reportconsists of 3 sections: Observations, Conclusions, and Recommendations.Observations are filled automatically. As for Conclusions and Recommendationssections, not all reports are auto-generated. AboutPostgres Checkup (postgres-checkup) is a new kind of diagnostics tool for a deep analysis of a Postgres database health. It detects current and potential issues with database performance, scalability and security. It also produces recommendations on how to resolve or prevent them. A monitoring system will only show current, urgent problems. And postgres-checkup will show sneaking up, deeper problems, that may hit you in the future. It helps to solve many known database administration problems and common pitfalls. It aims to detect issues at a very early stage and to suggest the best ways to prevent them.We recommend to run these on a regular basis — weekly, monthly, and quarterly. And also to run these right before and after applying any major change to a database server. Whether it’s a schema or configuration parameter or cluster settings change. Why do you need postgres-checkup and why it's safe and easy to use:
Reports StructurePostgres-checkup produces two kinds of reports for every check:
Markdown reports can be converted to different formats such as HTML or PDF. Each report consists of three sections:
Both "Conclusions" and "Recommendations" are to be consumed by engineers whowill make decisions what, how and when to optimize. Installation and UsageRequirementsFor the operator machine (from where the tool will be executed), the followingOS are supported:
There are known cases when postgres-checkup was successfully used on Windows,although with some limitations. The following programs must be installed on the operator machine:
pandoc and wkhtmltopdf are optional, they are needed for generating HTML andPDF versions of report (options Nothing special has to be installed on the observed machines. However, they mustrun Linux (again: modern RHEL/CentOS or Debian/Ubuntu; others should work aswell, but are not yet tested). Only Postgres version 9.6 and higher are currently officially supported. How to Install1. Install required programsUbuntu/Debian: sudo apt-get update -ysudo apt-get install -y git postgresql coreutils jq golang# Optional (to generate PDF/HTML reports)sudo apt-get install -y pandocwget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xztar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xzsudo mv wkhtmltox/bin/wkhtmlto* /usr/local/binsudo apt-get install -y openssl libssl-dev libxrender-dev libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig CentOS/RHEL: sudo yum install -y git postgresql coreutils jq golang# Optional (to generate PDF/HTML reports)sudo yum install -y pandocwget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xztar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xzsudo mv wkhtmltox/bin/wkhtmlto* /usr/local/binsudo yum install -y libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi MacOS (assuming that Homebrew is installed): brew install postgresql coreutils jq golang git# Optional (to generate PDF/HTML reports)brew install pandoc Caskroom/cask/wkhtmltopdf 2. Clone this repogit clone https://gitlab.com/postgres-ai/postgres-checkup.git# Use --branch to use specific release version. For example, to use version 1.1:# git clone --branch 1.1 https://gitlab.com/postgres-ai/postgres-checkup.gitcd postgres-checkup 3. Build pghrepcd ./pghrepmake maincd .. Example of UseLet's make a report for a project named Postgres-checkup automatically detects which one is the master: ./checkup -h db1.vpn.local -p 5432 --username postgres --dbname postgres --project prod1 -e 1 ./checkup -h db2.vpn.local -p 5432 --username postgres --dbname postgres --project prod1 -e 1 Which literally means: connect to the server with given credentials, save data into
Also, you can define a specific way to connect: SSH or
In case when For comprehensive analysis, it is recommended to run the tool on the master andall its replicas – postgres-checkup is able to combine all the information frommultiple nodes to a single report. Some reports (such as K003) require two snapshots, to calculate "deltas" ofmetrics. So, for better results, use the following example, executing it during peak workinghours, with $DISTANCE="1800" # 30 minutes# Assuming that db2 is the master, db3 and db4 are its replicasfor host in db2.vpn.local db3.vpn.local db4.vpn.local; do ./checkup \ -h "$host" \ -p 5432 \ --username postgres \ --dbname postgres \ --project prod1 \ -e 1 \ --file resources/checks/K000_query_analysis.sh # the first snapshot is needed only for reports K***donesleep "$DISTANCE"for host in db2.vpn.local db3.vpn.local db4.vpn.local; do ./checkup \ -h "$host" \ -p 5432 \ --username postgres \ --dbname postgres \ --project prod1 \ -e 1done As a result of execution, two directories containing .json and .md files willbe created: ./artifacts/prod1/json_reports/1_2018_12_06T14_12_36_+0300/./artifacts/prod1/md_reports/1_2018_12_06T14_12_36_+0300/ Each of generated files contains information about "what we check" and collected data forall instances of the postgres cluster A human-readable report can be found at: ./artifacts/prod1/md_reports/1_2018_12_06T14_12_36_+0300/Full_report.md Open it with your favorite Markdown files viewer or just upload to a service such as gist.github.com. You can collect and process data separately by specifying working mode name in CLI option Docker |
请发表评论