PostgreSQL Performance Monitoring Tools

https://github.com/CloudServer/postgresql-perf-tools

This package includes three useful scripts aimed to help to pinpoint performance issues on systems with PostgreSQL as database backend.

All scritps are written in Python. Requirements:

All scripts require a connect to PostgreSQL database. They take traditional set of DB credentials: host address, port (5432 by default), database name, database user and password.

Note: you may need to modify pg_hba.conf file to allow the scripts to connect to the server. Please refer to official documentaion:http://www.postgresql.org/docs/9.3/static/auth-pg-hba-conf.html

For detailed list of command line options use --help / -h option.

软件包

Python-2.7.tar.bz2   psycopg2-2.6.1.tar.gz   psutil-3.2.2.tar.gz

安装 python2.7

[root@node3 soft_bak]# tar jxvf Python-2.7.tar.bz2

[root@node3 soft_bak]# cd Python-2.7

[root@node3 Python-2.7]# ./configure --prefix=/usr/local/python2.7/

[root@node3 Python-2.7]# make

[root@node3 Python-2.7]# make install

添加/usr/local/python2.7/bin/到Linux的环境变量中

[root@node3 bin]# echo $PATH

/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root@node3 bin]# PATH="$PATH":/usr/local/python2.7/bin/

[root@node3 bin]# echo $PATH

/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/python2.7/bin/

删除/usr/bin中的python文件,为python2.7创建连接

[root@node3 bin]# cd /usr/bin/

[root@node3 bin]# rm -rf python

[root@node3 bin]# ln -s /usr/local/python2.7/bin/python ./python

[root@node3 bin]# python

Python 2.7 (r27:82500, Jan 14 2016, 16:13:36)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>

解决Python升级后yum不能用的问题

#修改yum文件

vi /usr/bin/yum

将文件头部的

#!/usr/bin/python

改为如下内容

#!/usr/bin/python2.6

安装psutil

[root@node3 soft_bak]# tar zxvf psutil-3.2.2.tar.gz

[root@node3 PGMonitor]# cd psutil-3.2.2

[root@node3 psutil-3.2.2]# python setup.py install

安装psycopg2

[root@node3 soft_bak]# tar zxvf psycopg2-2.6.1.tar.gz

[root@node3 PGMonitor]# cd psycopg2-2.6.1

[root@node3 psycopg2-2.6.1]# python setup.py build_ext --pg-config /usr/local/pg945/bin/pg_config  build

[root@node3 psycopg2-2.6.1]# python setup.py build_ext --pg-config /usr/local/pg945/bin/pg_config  install

安装setuptools

[root@node3 soft_bak]# tar zxvf setuptools-19.2.tar.gz

[root@node3 setuptools-19.2]# cd setuptools-19.2

[root@node3 setuptools-19.2]# python setup.py install

安装postgresql-perf-tools

[root@node3 opt]# git clone https://github.com/CloudServer/postgresql-perf-tools

Initialized empty Git repository in /opt/postgresql-perf-tools/.git/

remote: Counting objects: 22, done.

remote: Total 22 (delta 0), reused 0 (delta 0), pack-reused 22

Unpacking objects: 100% (22/22), done.

[root@node3 opt]# cd postgresql-perf-tools/

启动PostgreSQL

[postgres@node3 bin]$ ./pg_ctl -D ../data/ start

server starting

生成少量数据

[postgres@node3 bin]$ ./pgbench -i -F 100 -s 142 -h localhost -p 5432 -U postgres postgres

进程pgbench测试

[postgres@node3 bin]$ ./pgbench -h localhost -p 5432 -c 10 -T 600

[root@node3 postgresql-perf-tools]# ./pg-top.py  --db-host=localhost

PostgreSQL Performance Monitoring Tools的更多相关文章

  1. Java Performance Optimization Tools and Techniques for Turbocharged Apps--reference

    Java Performance Optimization by: Pierre-Hugues Charbonneau reference:http://refcardz.dzone.com/refc ...

  2. Linux System and Performance Monitoring

    写在前面:本文是对OSCon09的<Linux System and Performance Monitoring>一文的学习笔记,主要内容是总结了其中的要点,以及加上了笔者自己的一些理解 ...

  3. ITU-T G.1081 IPTV性能监测点 (Performance monitoring points for IPTV)

    ITU-T 建议书 G.1081 IPTV性能监测点 Performance monitoring points for IPTV Summary Successful deployment of I ...

  4. 4. Traffic monitoring tools (流量监控工具 10个)

    4. Traffic monitoring tools (流量监控工具 10个)EttercapNtop SolarWinds已经创建并销售了针对系统管理员的数十种专用工具. 安全相关工具包括许多网络 ...

  5. Monitoring tools that everyone's currently using

    Although a lot of new tools have arrived since 2011, it's clear that older open source tools like Na ...

  6. Top 10 Free Wireless Network hacking/monitoring tools for ethical hackers and businesses

    There are lots of free tools available online to get easy access to the WiFi networks intended to he ...

  7. always NetWork Performance measure Tools

    1,iperf key feature:Measuring TCP and UDP BandWidth Performance Iperf features; *TCP .Measure bandwi ...

  8. Windows Performance Monitoring with perfmon

    直接引用 - https://technet.microsoft.com/en-us/magazine/2008.08.pulse.aspx

  9. Top 12 Best Free Network Monitoring Tools (12种免费网络监控工具)

    1) Fiddler Fiddler(几乎)是适用于任何平台和任何操作系统的最好的免费网络工具,并提供了一些广受欢迎的关键特性.如:性能测试.捕捉记录HTTP/HTTPs请求响应.进行web调试等很多 ...

随机推荐

  1. Bootstrap页面布局3 - BS布局以及流动布局

    1. <h1 class='page-header'>布局<small> 使用bootstrap网格系统布局网页</small></h1> 得到如图所示 ...

  2. 动态加载js,css

    今天项目中需要用到动态加载 CSS 文件,经过一番折腾终于搞定,回家整理了一下,顺便融合了动态加载 JS 的功能写成了一个对象,先上代码: var dynamicLoading = { css: fu ...

  3. T-SQL笔记

    主要是查询: select *|Cols_Name|聚合函数 from Table_Name;#这是基本的语法 聚合函数: count(*|Cols_Name)   计算表的数量 max(*|Cols ...

  4. Lazarus如何变成XE的界面

    先设置: 进入“配置安装的包”,选中 EasyDockMgr 和 easyDockMgrDsgn 这两项,重新编译 Lazarus 吧 修改以后,界面就变成了XE的了:

  5. java 客户端获取真实ip地址

    在开发工作中,我们常常需要获取客户端的IP.一般获取客户端的IP地址的方法是:request.getRemoteAddr();但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实 ...

  6. css中IE6fix问题

    .g-popup-mask, .g-popup-box { position:fixed; top:0; left:0; z-index:10000; _position:absolute; _top ...

  7. ZooKeeper Recipes and Solutions 翻译

    ZooKeeper 秘诀 与解决方案 A Guide to Creating Higher-level Constructs with ZooKeeper Out of the Box Applica ...

  8. Qt的学习资料比起其它C/C++的GUI组件来说已经算很全的了

    Qt的学习资料比起其它C/C++的GUI组件来说已经算很全的了.Google的话能解决很多问题,如果没搜到资料的话,如果不是问题太过具体或者奇葩,那就是搜索方法的问题.中文教程中,Qt学习之路系列很不 ...

  9. 转载:C++线程池的一个实现

    原文转自:http://www.cnblogs.com/lidabo/p/3328646.html 略有修改 Cthread类参见:http://www.cnblogs.com/tangxin-blo ...

  10. 行高不设单位的好处 line-height:1.8

    今天无意间看了到了line-height:1.8 感觉挺有意思的,然后翻了下行高的知识,发现还挺有文章的,不妨温故而知新. 先回顾下:顶线.中线.基线.底线 vertical-align是元素的垂直对 ...