CentOS7.9安装postgresql-decoderbufs
安装环境
[root@cenots7 ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
准备工作
yum -y install epel-release yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm yum search postgis -y
安装PostgreSQL 10.22
yum install -y gcc gcc-c++ unzip lrzsz yum install -y postgis25_10.x86_64 yum install -y postgresql10-devel --skip-broken
配置postgresql环境变量
vi /etc/profile #添加以下内容 export PGHOME=/usr/pgsql-10 export PGDATA=$PGHOME/data export LD_LIBRARY_PATH=$PGHOME/lib export PATH=$PATH:$HOME/bin:$PGHOME/bin #修改后生效 source /etc/profile
验证一下,看是否生效
[root@cenots7 ~]# psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? [root@cenots7 ~]#
安装protobuf
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 #不指定--prefix,会生成到/usr/local/lib和/usr/local/bin下面 make -j 8 make install
安装protobuf-c
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 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig #指定protobuf.pc文件所在 ./configure # 不指定--prefix
make -j 8
make install
修改ld.so.conf,添加如下内容
vi /etc/ld.so.conf
#添加以下内容
/usr/local/lib
#执行
ldconfig -v
安装decoderbufs
wget https://github.com/debezium/postgres-decoderbufsunzip postgres-decoderbufs-main.zip
cd
make postgres-decoderbufs-main make install
配置pg
修改目录属组属主
chown -R postgres:postgres /usr/pgsql-10
初始化
su - postgres cd /usr/pgsql-10/bin ./initdb -D/usr/pgsql-10/data -X/usr/pgsql-10/pgwal
编辑pg_hba.conf文件,在ipv4的连接配置处,修改配置
vi /usr/pgsql-10/data/pg_hba.conf
host all all 0.0.0.0/0 md5
编辑postgresql.conf,修改如下参数:
listen_addresses = '*' shared_preload_libraries = 'decoderbufs' wal_level = logical max_wal_senders = 10 wal_keep_segments = 4 max_replication_slots = 4
启动
su - postgres cd /usr/pgsql-10/bin
#./pg_ctl -D /usr/pgsql-10/data -l /usr/pgsql-10/data/logfile stop
./pg_ctl -D /usr/pgsql-10/data -l /usr/pgsql-10/data/logfile start
修改postgres密码
1 2 | postgres= # ALTER USER postgres with password '123456'; ALTER ROLE |
验证远程连接
#注:test库需要新建
./psql -h 192.168.30.230 -p 5432 -U postgres -d test
验证decoderbufs
有以下结果无报错则成功
postgres=# select * from pg_create_logical_replication_slot('decoderbufs_demo', 'decoderbufs'); INFO: Exiting startup callback slot_name | lsn ------------------+----------- decoderbufs_demo | 0/168E1B8 (1 row) postgres=#
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)