环境准备
机器pg 数据库地址修改为haproxy 的ip地址,端口是haproxy的tcp 端口,配置比较简单
- hasura graphql-engine docker-compose
version: '3.6'
services:
graphql-engine:
image: hasura/graphql-engine:v1.0.0-alpha30
ports:
- "8080:8080"
environment:
- "POSTGRES_PASSWORD:dalong"
command: >
/bin/sh -c "
graphql-engine --database-url postgres://postgres:dalong@10.6.219.243:5000/postgres serve --enable-console;
"
- patroni pg 数据库ha 配置
比较简单,使用的github 项目的demo 配置,可以参考 https://www.cnblogs.com/rongfengliang/p/10057355.html https://github.com/zalando/patroni
说明
patroni 是一个很不错的pg ha 模版,结合hasura graphql-engine ,我们可以快速的搭建出一套可靠,稳定的pg 数据库系统
同时也有一套基于容器的解决方案:https://github.com/zalando/spilo
参考资料
https://github.com/zalando/patroni
https://www.cnblogs.com/rongfengliang/p/10057355.html
https://github.com/zalando/spilo