记录一次postgresql升级和pg_pathman的安装

初始环境

centos7 postgresql9.4

psql升级

根据官网:https://www.postgresql.org/download/linux/redhat/

  1. Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
  1. Install the client packages
yum install postgresql96
  1. Optionally install the server packages:
yum install postgresql96-server

pg_pathman安装

  1. 获取源代码
git clone https://github.com/postgrespro/pg_pathman
  1. root下编译
make USE_PGXS=1
make USE_PGXS

如果报错pg_config不存在,则安装pg_cofig

yum install postgresql96-devel
  1. make成功后修改postgresql.conf
打开postgresql.conf:将shared_preload_libraries配置改为如下
shared_preload_libraries = 'pg_pathman'
  1. 重启psql

附:

  1. 增加用户
create user xxx
  1. 修改用户密码
alter user xxx with password 'xxx';
  1. 执行分表
CREATE EXTENSION pg_pathman;
SELECT create_hash_partitions('bbs_reply', 'thread_id', 128); #bbs_reply表名,thread_id字段名,128分表数量

猜你喜欢

转载自my.oschina.net/u/2299936/blog/1634200