-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/zero config pg autoctl #576
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with this a bit. Some issues:
- The
--monitor
argument doesn't actually seem to work (settingPG_AUTOCTL_MONITOR
does work):
pg_autoctl show state --monitor 'postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=prefer'
- When using
--pgdata
you still see this error in the output:
12:02:39 14800 ERROR Failed to get value for environment variable 'PG_AUTOCTL_MONITOR', which is unset
- When not specifying either
--pgdata
or--monitor
the final fatal log should include something about--monitor
andPG_AUTOCTL_MONITOR
too:
11:55:49 4723 ERROR Failed to get value for environment variable 'PG_AUTOCTL_MONITOR', which is unset
11:55:49 4723 ERROR Failed to get value for environment variable 'PGDATA', which is unset
11:55:49 4723 FATAL Failed to set PGDATA either from the environment or from --pgdata
8fe3f61
to
1cd9bd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more issues:
1.
PG_AUTOCTL_MONITOR='postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=require' pg_autoctl create formation --formation 'test' --kind pgsql
13:48:11 24106 ERROR BUG: keeper_config_set_pathnames_from_pgdata: empty pgdata
pg_autoctl create formation --formation 'test' --kind pgsql
13:51:00 30894 ERROR BUG: keeper_config_set_pathnames_from_pgdata: empty pgdata
pg_autoctl create formation --formation 'test' --kind pgsql --monitor 'postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=require'
13:51:37 32484 ERROR Failed to get value for environment variable 'PGDATA', which is unset
13:51:37 32484 FATAL Failed to set PGDATA either from the environment or from --pgdata
- drop formation doesn't say it can use
--monitor
in the error message if you supply neither --monitor or --pgdata.
PG_AUTOCTL_MONITOR='postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=require' pg_autoctl drop formation --formation 'test'
13:53:27 3635 ERROR Failed to get value for environment variable 'PGDATA', which is unset
13:53:27 3635 FATAL Failed to set PGDATA either from the environment or from --pgdata
show standby-names --group 5
does not error when there's no group 5 (might be the case on master too)
else if (streq(key, "sslcert")) | ||
{ | ||
strlcpy(ssl->serverCert, val, sizeof(ssl->serverCert)); | ||
} | ||
else if (streq(key, "sslkey")) | ||
{ | ||
strlcpy(ssl->serverKey, val, sizeof(ssl->serverKey)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ones are not necessary. These are postgresql.conf
options, not connection options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. But in case we would reuse the function parse_pguri_ssl_settings
ini other parts of the code I think it makes sense to still correctly parse those connection string parameters. After all those parameters are listed in https://www.postgresql.org/docs/current/libpq-connect.html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you are totally right. My mistake, I forgot these are used for TLS user certs.
I have changed the way the
Yeah, so the server-side function was returning NULL, which we didn't test against in |
This allows creating a formation from a node that's not been created yet.
pg_autoctl get|set formation settings pg_autoctl get|set formation number-sync-standbys pg_autoctl get|set node replication-quorum pg_autoctl get|set node candidate-priority pg_autoctl show uri pg_autoctl show events pg_autoctl show state pg_autoctl show settings pg_autoctl show standby-names pg_autoctl perform failover pg_autoctl perform switchover pg_autoctl perform promotion
In particular, export PG_AUTOCT_MONITOR in the tmux session, and use pg_autoctl show uri --formation monitor now.
The new command is pg_autoctl show uri --formation monitor.
0e41b9b
to
c3a7a2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well now
Implement support for
--monitor
option and PG_AUTOCTL_MONITOR environment variable in many commands that don't need to have a local node already created. Those commands are:The
make cluster
is also changed to use the PG_AUTOCTL_MONITOR environment variable rather than the monitor's PGDATA in the interactive terminal/session.Fixes #437.