Comments (14)
Yes, I realize that Patroni already has a way to take config settings for postgres in the patroni.yml file. However, the formatting and organization of these is rather painful if you have a large number of special config settings.
from patroni.
Actually it's already possible to specify locations for config file and hba file with using standard options:
postgresql:
parameters:
hba_file: /path/to/custom/pg_hba.conf
config_file: /path/to/custom/postgresql.conf
But it wont copy these file to the data directory.
from patroni.
Hmmm. Good point! Lemme test if that actually does what I want it to.
from patroni.
@jberkus Did testing => it did what you wanted it to? Wondering what happens next here cc @feikesteenbergen
from patroni.
I can't get this way to work properly - it adds config_file
and hba_file
entries to postgresql.conf but they get ignored, as those config entries only work as startup parameters to Postgres. Not sure if that was due to the introduction of the dynamic configuration.
from patroni.
We currently have our postgresql.conf and pg_hba.conf managed outside PG_DATA
by Chef and are looking how to make it fit with Patroni.
For pg_hba.conf, it seems making hba_file
parameter be passed on the command line (like it previously did?) would do the job.
But for postgresql.conf, it seems this would fit with the dynamic configuration by being able to make Patroni skip handling of postgresql.base.conf
and specify a either custom path to a file to include on the real postgresql.conf
or to a conf.d path (maybe the discussion for that one would go on #81)
If those two make sense to you we can work on implementing those.
from patroni.
Yeah, I was thinking of just supporting conf.d. Currently you can't do that via Patroni config, because of the special quoting rules for include_directory. However, if we simply always had an include_directory in the container, then the user could drop stuff in it. Agreed about hba_file.
Since I'm big on "convention over configuration", though, maybe we should make a pattern? Assume that there's a bind mount at /etc/patroni/pgconfig/. Any files found in that directory get copied into PGCONFIG at init time.
from patroni.
I can't get this way to work properly - it adds config_file and hba_file entries to postgresql.conf but they get ignored, as those config entries only work as startup parameters to Postgres. Not sure if that was due to the introduction of the dynamic configuration.
Yaeh, before dynamic configuration Patroni was passing all parameters on the command line, what makes it not possible to change values for those parameters without restart. Now only limited amount of parameters is always passed in on the command line:
- cluster_name
- hot_standby
- listen_addresses
- max_connections
- max_locks_per_transaction
- max_prepared_transactions
- max_replication_slots
- max_worker_processes
- port
- track_commit_timestamp
- wal_keep_segments
- wal_level
- wal_log_hints
Basically these parameters either MUST be the same on the master and replicas or responsible for streaming replication or just needed for Patroni to work, everything else is written into postgresql.conf.
What we can do:
- In case if the
config_file
is specified and exists (and readable) on the file system we can "include" it instead ofpostgresql.base.conf
- If the
hba_file
is specified and exists (and readable) on the file system we can pass it on the command line instead of writing intopostgresql.conf
P.S., include_dir 'conf.d'
approach will work for you right now without any changes in Patroni, but unfortunately it doesn't cover pg_hba
case.
from patroni.
This whole area could use some better documentation and or cleanup, it's quite confusing as it stands. As of now, PostgreSQL parameters can be set in dynamic configuration in DCS, in Patroni config at postgresql.parameters, bootstrap.dcs.postgresql.parameters, and some, like listen_addresses, also in the environment. postgresql.conf is managed by Patroni, but pg_hba.conf is not, but it is initialized during startup. It's not very clear what gets updated when, and what the precedences are. For example the bootstrap section could use a sign that states in big red letters that it only gets used once and then ignored. postgresql.conf is managed by Patroni, but pg_hba.conf is not, but it is initialized during startup. Some parameters must be changed in Patroni configuration in YAML, for others the recommended way to update a parameter is to post a JSON document to Patroni API using curl. I might be turning into a grumpy old man, but that is not a nice configuration interface.
Having gotten that rant of my chest, I'll come up with some constructive patches soon. Any directions on the path to take would be very welcome.
from patroni.
Hey @CyberDem0n + @alexeyklyukin, can we draft some documentation here to address @ants' points? Happy to help out here.
from patroni.
After some testing, it seems hba_file
does indeed work in postgresql.conf
but config_file
does not.
I've implemented support for adding a custom config file on #281, that will replace the .base.conf. I have not used the config_file
Postgres parameter, though, as the behavior is not exactly the same: it includes the real config file and overrides it with any DCS/Patroni-set config instead of just replacing the whole thing.
from patroni.
BTW, my general perspective is that I'd rather see a comprehensive way to update PostgreSQL config using patroni API/DCS than ways to drop in custom files.
from patroni.
I agree, but it's a bit tricky to integrate into environments where there is already config management going on or where you just want to reuse your existing config files.
from patroni.
Solved by #281
from patroni.
Related Issues (20)
- Manual failover candidates
- Conflicting configuration between nofailover: False and failover_priority: 0. Defaulting to nofailover: False
- ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca HOT 4
- Replication is failing HOT 1
- Restarting replica failed if patroni joined running postgres
- Pyinstaller bundled patroni started with multiprocessing-fork error
- Patroni not making switchover in case of primary server's disk is full HOT 1
- Intermittent "ERROR: Can not fetch local timeline and lsn from replication connection" HOT 1
- patronictl -c /etc/patroni/~postgres-operator_cluster.yaml restart cluster is reverting the log_level configuration HOT 1
- Randomly exception on same patroni configuration HOT 2
- Consul service checks failing when TLS is enabled on Patroni Rest API HOT 5
- failover to async replica in healthy synchronous_mode cluster return 503 HOT 2
- Generated pg_basebackup command should be logged HOT 6
- strange behavior of the restore_command HOT 1
- HAProxy node in Patroni does not failing over with Zookeeper HA in Docker Swarm HOT 5
- patroni error python after Migration patroni 2.1.1 and patroni-etcd 2.1.1 to patroni-3.2.1 and patroni-etcd-3.2.1 HOT 10
- load available_parameters/0_postgres.yml failed silently when package using zipapp
- Ability to use specific postgrespro parameters in patroni HOT 1
- Demotion of primary hangs when logical replication connection is established HOT 2
- Error on first switchover with message: Invalid auth token
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patroni.