规划
192.168.56.11 k1
192.168.56.12 k2
192.168.56.13 k3
192.168.56.21 pg11n1
192.168.56.22 pg11n2
主机 pg11n1 、pg11n2上安装好 postgresql 11 后,需要安装 postgres-decoderbufs
debezium 需要插件 decoderbufs 或者 wal2json ,或者 pgoutput。
postgres-decoderbufs 有如下依赖
1)PostgreSQL 9.6+
2)Protobuf-c 1.2+
3)PostGIS 2.1+
安装 postgis
# yum install postgis25_11*
# yum list installed |grep -i postgis
postgis25_11.x86_64 2.5.5-5.rhel7 @pgdg11
postgis25_11-client.x86_64 2.5.5-5.rhel7 @pgdg11
postgis25_11-devel.x86_64 2.5.5-5.rhel7 @pgdg11
postgis25_11-docs.x86_64 2.5.5-5.rhel7 @pgdg11
postgis25_11-gui.x86_64 2.5.5-5.rhel7 @pgdg11
postgis25_11-utils.x86_64 2.5.5-5.rhel7 @pgdg11
安装 protobuf
# cd /opt
# wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
# tar -zxvf ./protobuf-2.6.1.tar.gz
# cd protobuf-2.6.1
# ./configure
# make
# make check
# make install
安装 protobuf-c
# cd /opt
# wget https://github.com/protobuf-c/protobuf-c/releases/download/v1.2.1/protobuf-c-1.2.1.tar.gz
# tar -zxvf protobuf-c-1.2.1.tar.gz
# cd protobuf-c-1.2.1
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig // 指定protobuf.pc文件所在
# ./configure
# make
# make install
安装 decoderbufs
# cd /opt
# wget https://github.com/debezium/postgres-decoderbufs/archive/refs/tags/v1.7.0.Final.tar.gz
# tar -zxvf ./v1.7.0.Final.tar.gz
# cd postgres-decoderbufs-1.7.0.Final/
# export PGHOME=/usr/pgsql-11
export PGDATA=/var/lib/pgsql/11/data
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PGHOME}/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export PATH=${PGHOME}/bin:$PATH
export MANPATH=${PGHOME}/share/man:$MANPATH
export TMP=/tmp
export TEMP=/tmp
export TMPDIR=/tmp
# make
# make install
修改 shared_preload_libraries
修改postgresql配置文件
shared_preload_libraries = 'decoderbufs'
参考:
https://github.com/debezium/postgres-decoderbufs