ERROR: cannot execute CREATE TABLE in a read-only transaction
If you're getting the following on your patroni cluster:
Jun 24 23:30:50 psql02 etcd: failed to send out heartbeat on time (exceeded the 250ms timeout for 1.229927109s)
Jun 24 23:30:50 psql02 etcd: server is likely overloaded
Jun 24 23:30:50 psql02 etcd: failed to send out heartbeat on time (exceeded the 250ms timeout for 1.22987947s)
Jun 24 23:30:50 psql02 etcd: server is likely overloaded
ERROR: cannot execute CREATE TABLE in a read-only transaction
Then you likely commented out these:
[root@psql03 ~]# cat /etc/haproxy/haproxy.cfg
global
log 127.0.0.1 local0
stats socket /var/run/haproxy.sock mode 0600 level admin
user haproxy
group haproxy
daemon
debug
maxconn 1024
defaults
mode tcp
log global
option dontlognull
option redispatch
retries 2
timeout client 30m
timeout connect 4s
timeout server 30m
timeout check 5s
frontend psql-in
mode tcp
bind psql-c01:5432
option tcplog
default_backend psql-back
backend psql-back
mode tcp
option tcplog
# option httpchk
# http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-se
server psql01.nix.mds.xyz psql01.nix.mds.xyz:5432 maxconn 1024 check port 8008
server psql02.nix.mds.xyz psql02.nix.mds.xyz:5432 maxconn 1024 check port 8008
server psql03.nix.mds.xyz psql03.nix.mds.xyz:5432 maxconn 1024 check port 8008
listen stats
bind :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /haproxy-stats
stats auth admin:nopassword
[root@psql03 ~]#
Uncomment the two lines above to resolve the issue.
Thx,
TK