PostgreSQL统计数据监控工具 - pgcenter

jopen 8年前

简介

    pgcenter是针对PostgreSQL数据库的一款监控工具,详细地址:https://github.com/lesovsky/pgcenter

    pgcenter目前开发和测试主要面向PG9.4(对9.x其他版本也有测试),目前还是bata版本在一些情况下会有错误。pgcenter和PG服务器最好在同一主机,因为对于远程服务器,pgcenter有些功能不可用。运行pgcenter要使用PG的superuser账号,否则PG的某些信息会因为权限不够而无法获取。

配置、安装与试用

环境:

centos 32bit

1. 安装postgresql9.4

    由于pgcenter目前对远程PG的监控有一些功能无法使用,所以我们在本地安装PG来试用。

    编译安装或者安装包图形化安装均可。可参考:PostgreSQL在Linux下的源码编译安装

    安装目录:/opt/pg944

    系统用户:postgres

    端口号:5432

2. 安装pgcenter(通过下载源码安装的方法)

    2.1安装git

su - root  yum install git

    2.2用git下载pgcenter源码安装包

git clone https://github.com/lesovsky/pgcenter

    2.3安装ncurese

yum install ncurses

    2.4安装pgcenter

cd pgcenter  make

        报错:找不到pg_config

        解决:export PATH=$PATH:/opt/pg944/bin/

sudo make install

3. 使用pgcenter

su - postgres  pgcenter

        报错:pgcenter: error while loading shared libraries: libpq.so.5:cannot open shared object file: No such file or directory

        解决: export LD_LIBRARY_PATH=/opt/pg944/lib/

[postgres@localhost bin]$ pgcenter --help  pgcenter is the adminitrative console for PostgreSQL.  Usage:     pgcenter [OPTION]... [DBNAME [USERNAME]]  General options:     -?, --help                show this help, then exit.     -V, --version             print version, then exit.  Options:     -h, --host=HOSTNAME       database server host or socket directory     -p, --port=PORT           database server port (default: "5432")     -U, --username=USERNAME   database user name (default: "current user")     -d, --dbname=DBNAME       database name (default: "current user")     -f, --file=FILENAME       conninfo file (default: "~/.pgcenterrc")     -w, --no-password         never prompt for password     -W, --password            force password prompt (should happen automatically)  Report bugs to <lesovsky@gmail.com>.  [postgres@localhost bin]$ pgcenter -V  pgcenter 0.2.0  [postgres@localhost bin]$ pgcenter  [postgres@localhost bin]$

   备注:本文仅限于测试试用,需要结合其他工具过着应用进一步测试。不适用于生产环境。