PostgreSQL Monitor pg_activity
PostgreSQL Monitor pg_activity
Command line tool for PostgreSQL server activity monitoring.
https://github.com/julmon/pg_activity/
依赖的包
- python ≥ 2.6
- psycopg2 ≥ 2.2.1
- psutil ≥ 0.5.1
软件包
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
安装pg_activity
[root@node3 soft_bak]# unzip pg_activity-master.zip
[root@node3 soft_bak]# cd pg_activity-master
[root@node3 pg_activity-master]# python setup.py install
在python2.7安装目录下会产生如下pg_activity命令
[root@node3 pg_activity-master]# cd /usr/local/python2.7/bin/
[root@node3 bin]# ls
2to3 easy_install easy_install-2.7 idle pg_activity pydoc python python2.7 python2.7-config python-config smtpd.py
启动PostgreSQL
[postgres@node3 bin]$ ./pg_ctl -D ../data/ start
server starting
监控PostgreSQL数据库状态
[postgres@node3 ~]$ cd /usr/local/python2.7/bin/
[postgres@node3 bin]$ ./pg_activity
生成少量数据
[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 -d postgres -c 10 -j 10 -r -T 600



PostgreSQL Monitor pg_activity的更多相关文章
- PostgreSQL Monitor pg_view
PostgreSQL Monitor pg_view https://github.com/zalando/pg_view Requirements Linux 2.6, python 2.6, ps ...
- PostgreSQL Insight Monitor pgstat
PostgreSQL Insight Monitor pgstat pgstat 是一个连接到数据库并获取数据库的活动状态的命令行工具. PostgreSQL有许多状态: archiver for ...
- Streaming replication slots in PostgreSQL 9.4
Streaming replication slots are a pending feature in PostgreSQL 9.4, as part of the logical changese ...
- Measuring PostgreSQL Checkpoint Statistics
Checkpoints can be a major drag on write-heavy PostgreSQL installations. The first step toward ident ...
- PostgreSQL相关的软件,库,工具和资源集合
PostgreSQL相关的软件,库,工具和资源集合. 备份 wal-e - Simple Continuous Archiving for Postgres to S3, Azure, or Swif ...
- ubuntu14.04, Cloudera Manager 5.11.1, cdh5.11.1 postgresql离线部署
最近一段时间团队接到的项目需要处理的数据量非常大,之前的处理方式难以满足现有需求.最近两周前前后后折腾了不少,在搭建了hadoop+hbase+hive+spark的一个集群后,由于感觉管理和监控太麻 ...
- centos7 pgpool+postgresql
安装postgresql CentOS7安装并配置PostgreSQL 安装pgpool rpm -ivh http://www.pgpool.net/yum/rpms/3.7/redhat/rhel ...
- PostgreSQL导出一张表到MySQL
1. 查看PostgreSQL表结构,数据量,是否有特殊字段值 region_il=# select count(*) from result_basic; count --------- ( row ...
- Top PG Clustering HA Solutions for PostgreSQL
转自:https://severalnines.com/blog/top-pg-clustering-ha-solutions-postgresql If your system relies on ...
随机推荐
- 坑人的七牛CDN
最近七牛CDN不知道咋啦的,一下子就不行了,提示错误信息如下 "upload image source key fail: unexpected EOF" 找客服提交工单都没有解决 ...
- 【Android测试】【随笔】模拟双指点击
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/5258660.html 手势 看到这个标题,很多人会想一想 ...
- C++省略参数(va_list va_start va_arg va_end)的简单应用
原文参考自:http://www.cnblogs.com/hanyonglu/archive/2011/05/07/2039916.html #include <iostream> #in ...
- php--tp中页面之间的跳转
- webView、scrollView、TableView,为了防止滚动时出现偏移,底部黑框问题等
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {self.automaticallyAd ...
- block 反向传值回调
/** * block 反向传值回调 */ //在第二个控制器中 // (1)声明block,在基类中已写好 // (2)写好传值方法 //(1) typedef void (^Return ...
- mysql开发中使用存储过程
在mysql开发中使用存储过程的理由: 当希望在不同的应用程序或平台上执行相同的函数,或者封装特定功能时,存储过程是非常有用的 mysql 执行语句是要先编译,然后再执行的.这样如果查询并发大的时候. ...
- APICloud请你看英特尔智能硬件大赛决赛直播
英特尔智能硬件大赛由英特尔硬享公社(CCE)发起,联合了全国各地50余家产业链优秀合作伙伴,旨在集合全国硬创资源,携手寻找中国最具代表性的硬件创业项目,并通过技术支持.资源对接.产品推广等方式助力项目 ...
- Ubuntu 上安装 Freemind 并支持中文
Ubuntu 上安装 Freemind 并支持中文 JAVA 运行时 Freemind 是一个使用 Java 编写的思维导图工具,在安装时,需要到 Java 运行时(使用 OpenJRE 或 Orac ...
- window.open被浏览器拦截的解决方案
现象 最近在做项目的时候碰到了使用window.open被浏览器拦截的情况,搞得人无比郁闷啊,虽然在自己的环境可以对页面进行放行,但是对用户来说,不能要求用户都来通过拦截.何况当出现拦截时,很多小白根 ...