我正在尝试使用3台计算机设置Postgres集群,以通过自动故障转移获得高可用性。
postgres-01 --> master
postgres-02 --> sync replica
postgres-03 --> async replica
当我试图在synchronous_standby_names='postgres-02'
中使用postgresql.conf
时,它无法重启postgres,并出现以下错误
LOG: invalid value for parameter "synchronous_standby_names": "postgres-02"
DETAIL: syntax error at or near "-"
FATAL: configuration file "/pgsql/postgresql.conf" contains errors
postgresql-10.service: main process exited, code=exited, status=1/FAILURE
Failed to start PostgreSQL 10 database server.
-- Subject: Unit postgresql-10.service has failed
-- Defined-By: systemd
从主机名中删除' - '可以解决问题,但这确实是必需的。
你必须引用这个名字:
synchronous_standby_names = '"postgres-02"'
您应该至少有两个同步备用服务器,否则如果单个同步备用服务器出现故障,系统将停止运行。