
Flink实战 | PostgresCDC整库同步Kafka最佳实践

1. 环境准备
本篇内容不涉及组件的安装(Flink,Kafka,Dinky)
使用的组件版本如下
- Flink 1.18.1
- kafka2.8.2(如果你的flink也是flink1.18.X建议使用 kafka2.8.X以上版本,详见本文1.5.2)
- Dinky 1.1.0
- PostgreSql12.5
1.1 Docker中部署Dinky
1.2 安装Flink环境
1.3 安装PostgreSql环境
1.3.1 创建pg容器
- 拉取镜像
docker pull postgres:12.5
- 创建并启动 PostgreSQL 容器设置密码和端口
docker run -d -p 6432:5432 --name postgres-12.5 -e POSTGRES_PASSWORD=postgres postgres:12.5
- 查看容器是否创建成功:
docker ps | grep postgres-12.5
- 进入容器:
docker exec -it postgres-12.5 bash
1.3.2 安装安装decoderbufs插件
否则会报错如下,详见本文3.1:
Caused by: org.postgresql.util.PSQLException: ERROR: could not access file “decoderbufs”: No such file or directory
可以参考debezium/postgres-decoderbufs的README.md进行安装,不过也有一些坑,详细如下。
1.3.2.1 docker更换apt镜像源和PG镜像源
- 更换apt镜像源
建议中科大的源(试了其他源都有些许问题)
tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.ustc.edu.cn/debian buster main non-free
deb http://mirrors.ustc.edu.cn/debian buster-updates main non-free
deb http://mirrors.ustc.edu.cn/debian-security/ buster/updates main non-free
EOF
- 更换PG的apt源
- 安装 lsb-release
apt-get install -y lsb-release
- 添加[华为PG镜像站](https://mirrors.huaweicloud.com/mirrorDetail/5ee08ea8cdd8d3491d77c4af?mirrorName=postgresql&catalog=tool)地址配置: shell
s

最低0.47元/天 解锁文章
3369

被折叠的 条评论
为什么被折叠?



