記錄一次postgresql升級和pg_pathman的安裝

初始環境

centos7 postgresql9.4linux

psql升級

根據官網:https://www.postgresql.org/download/linux/redhat/git

  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_cofiggithub

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分表數量
相關文章
相關標籤/搜索