postgresql plugin install

1. pg 安装本地插件库(all)

1
2
3
[root@localhost app]# tar xzf postgresql-9.6.1.tar.gz
[root@localhost app]# cd postgresql-9.6.1/contrib/
[root@localhost contrib]# make install

2. pg_pathman download(https://pgxn.org/dist/pg_pathman/)

  1. pg_pathman download

    1
    2
    3
    [root@localhost ~]# git clone https://github.com/postgrespro/pg_pathman /mnt/ops/app/postgresql-9.6.1/contrib/pg_pathman

    说明: 我将pg_pathman下载到postgresql源码的插件目录contrib目录下
  2. pg_pathman install

    1
    2
    3
    [root@localhost ~]# cd /mnt/ops/app/postgresql-9.6.1/contrib/pg_pathman
    [root@localhost pg_pathman]# make
    [root@localhost pg_pathman]# make install
  3. 在配置文件中添加pg_pathman参数

    1
    2
    3
    4
    [root@localhost pg_pathman]# su - wisdom
    [wisdom@localhost ~]$ vim /mnt/data/pgsql/postgresql.conf
    shared_preload_libraries = 'pg_pathman,pg_stat_statements'
    [wisdom@localhost ~]$ /mnt/app/pgsql/bin/pg_ctl -D /mnt/data/pgsql/ -l /mnt/log/pgsql/pgsql.log restart
  4. pg_pathman use

    1
    2
    3
    4
    [root@localhost pg_pathman]# su - wisdom
    [wisdom@localhost ~]$ /mnt/app/pgsql/bin/psql -d postgres
    postgres=# create extension pg_pathman;
    CREATE EXTENSION