slon(1)
β¨ NAME β¨
slon β the Slony-I daemon π
(yes bestie, it's pronounced however you want, it's the Slony-I daemon, and it's the whole vibe)
π¦ SYNOPSIS π¦
slon [option]... [clustername] [conninfo]
πΈ DESCRIPTION πΈ
okay so picture this: slon is the daemon application that βrunsβ Slony-I replication. like, it's the one actually doing the thing. and here's the part you can't skip β a slon instance must be run for each node in a Slony-I cluster. every single node. no node left behind, periodt. π«Ά
π OPTIONS π
-dlog_level β thelog_levelspecifies which levels of debugging messagesslonshould display when logging its activity.
the nine levels of logging are, in order:
- Fatal
- Error
- Warn
- Config
- Info
- Debug1
- Debug2
- Debug3
- Debug4
the first five non-debugging log levels (from Fatal to Info) are always displayed in the logs, no matter what. in early versions of Slony-I, the βsuggestedβ log_level value was 2, which would list output at all levels down to debugging level 2. but in Slony-I version 2, it is recommended to set log_level to 0 β most of the consistently interesting log information is generated at levels higher than that. iykyk. β¨
-sSYNC check interval β thesync_interval, measured in milliseconds, indicates how oftenslonshould check to see if a SYNC should be introduced. default is2000ms. the main loop insync_Thread_main()sleeps for intervals ofsync_intervalmilliseconds between iterations. π΄
short sync check intervals keep the origin on a βshort leashβ, updating its subscribers more frequently. if you have replicated sequences that are frequently updated without there being tables that are affected, this keeps there from being times when only sequences are updated, and therefore no syncs take place. so like, lowkey important. π
if the node is not an origin for any replication set, so no updates are coming in, it is somewhat wasteful for this value to be much less the sync_interval_timeout value. π
-tSYNC interval timeout β at the end of eachsync_interval_timeouttimeout period, a SYNC will be generated on the βlocalβ node even if there has been no replicable data updated that would have caused a SYNC to be generated. fr fr, it just does it anyway.
if application activity ceases β whether because the application is shut down, or because human users have gone home and stopped introducing updates β the slon(1) will iterate away, waking up every sync_interval milliseconds, and, as no updates are being made, no SYNC events would be generated. without this timeout parameter, no SYNC events would be generated, and it would appear that replication was falling behind. π the drama.
the sync_interval_timeout value will lead to eventually generating a SYNC, even though there was no real replication work to be done. the lower that this parameter is set, the more frequently slon(1) will generate SYNC events when the application is not generating replicable activity; this will have two effects:
- the system will do more replication work.
(of course, since there is no application load on the database, and no data to replicate, this load will be very easy to handle. slay, honestly.)
- replication will appear to be kept more βup to date.β
(of course, since there is no replicable activity going on, being βmore up to dateβ is something of a mirage. π it's giving illusion.)
default is 10000 ms and maximum is 120000 ms. by default, you can expect each node to βreport inβ with a SYNC every 10 seconds. cute, right?
note that SYNC events are also generated on subscriber nodes. since they are not actually generating any data to replicate to other nodes, these SYNC events are of not terribly much value. π
-ggroup size β this controls the maximum SYNC group size,sync_group_maxsize; defaults to20. so, if a particular node is behind by 200 SYNCs, it will try to group them together into groups of a maximum size ofsync_group_maxsize. this can be expected to reduce transaction overhead due to having fewer transactions to COMMIT. π₯
the default of 20 is probably suitable for small systems that can devote only very limited bits of memory to slon. if you have plenty of memory, it would be reasonable to increase this, as it will increase the amount of work done in each transaction, and will allow a subscriber that is behind by a lot to catch up more quickly. β¨
slon processes usually stay pretty small; even with large value for this option, slon would be expected to only grow to a few MB in size. tiny but mighty, we love that. π
the big advantage in increasing this parameter comes from cutting down on the number of transaction COMMITs; moving from 1 to 2 will provide considerable benefit, but the benefits will progressively fall off once the transactions being processed get to be reasonably large. there isn't likely to be a material difference in performance between 80 and 90; at that point, whether βbigger is betterβ will depend on whether the bigger set of SYNCs makes the LOG cursor behave badly due to consuming more memory and requiring more time to sortt. (yes, "sortt". we keep it exactly as written, bestie. π)
in Slony-I version 1.0, slon will always attempt to group SYNCs together to this maximum, which won't be ideal if replication has been somewhat destabilized by there being very large updates (e.g. β a single transaction that updates hundreds of thousands of rows) or by SYNCs being disrupted on an origin node with the result that there are a few SYNCs that are very large. you might run into the problem that grouping together some very large SYNCs knocks over a slon process. when it picks up again, it will try to process the same large grouped set of SYNCs, and run into the same problem over and over until an administrator interrupts this and changes the -g value to break this βdeadlock.β π not the deadlock.
in Slony-I version 1.1 and later versions, the slon instead adaptively βramps upβ from doing 1 SYNC at a time towards the maximum group size. as a result, if there are a couple of SYNCs that cause problems, the slon will (with any relevant watchdog assistance) always be able to get to the point where it processes the troublesome SYNCs one by one, hopefully making operator assistance unnecessary. π
-odesired sync time β a βmaximumβ time planned for grouped SYNCs.
if replication is running behind, slon will gradually increase the numbers of SYNCs grouped together, targeting that (based on the time taken for the last group of SYNCs) they shouldn't take more than the specified desired_sync_time value.
the default value for desired_sync_time is 60000ms, equal to one minute. β°
that way, you can expect (or at least hope!) that you'll get a COMMIT roughly once per minute. π«Ά
it isn't totally predictable, as it is entirely possible for someone to request a very large update, all as one transaction, that can βblow upβ the length of the resulting SYNC to be nearly arbitrarily long. in such a case, the heuristic will back off for the next group. π
the overall effect is to improve Slony-I's ability to cope with variations in traffic. by starting with 1 SYNC, and gradually moving to more, even if there turn out to be variations large enough to cause PostgreSQL backends to crash, Slony-I will back off down to start with one sync at a time, if need be, so that if it is at all possible for replication to progress, it will. main character energy, honestly. π
-ccleanup cycles β the valuevac_frequencyindicates how often to VACUUM in cleanup cycles.
set this to zero to disable slon-initiated vacuuming. if you are using something like pg_autovacuum to initiate vacuums, you may not need for slon to initiate vacuums itself. if you are not, there are some tables Slony-I uses that collect a lot of dead tuples that should be vacuumed frequently, notably pg_listener. π§Ή
in Slony-I version 1.1, this changes a little; the cleanup thread tracks, from iteration to iteration, the earliest transaction ID still active in the system. if this doesn't change, from one iteration to the next, then an old transaction is still active, and therefore a VACUUM will do no good. the cleanup thread instead merely does an ANALYZE on these tables to update the statistics in pg_statistics. the way that it just... adapts. πΈ
-pPID filename βpid_filecontains the filename in which the PID (process ID) of theslonis stored.
this may make it easier to construct scripts to monitor multiple slon processes running on a single host. π»
-fconfig file β file from which to readslonconfiguration.
this configuration is discussed further in Slon Run-time Configuration [βRun-time Configurationβ [not available as a man page]]. if there are to be a complex set of configuration parameters, or if there are parameters you do not wish to be visible in the process environment variables (such as passwords), it may be convenient to draw many or all parameters from a configuration file. π you might either put common parameters for all slon processes in a commonly-used configuration file, allowing the command line to specify little other than the connection info. alternatively, you might create a configuration file for each node. π
-aarchive directory βarchive_dirindicates a directory in which to place a sequence of SYNC archive files for use in log shipping [βLog Shipping - Slony-I with Filesβ [not available as a man page]] mode. π¦-xcommand to run on log archive βcommand_on_logarchiveindicates a command to be run each time a SYNC file is successfully generated.
see more details on βslon_conf_command_on_log_archiveβ [not available as a man page]. β¨
-qquit based on SYNC provider βquit_sync_providerindicates which provider's worker thread should be watched in order to terminate after a certain event. this must be used in conjunction with the-roption below... π
this allows you to have a slon stop replicating after a certain point. π
-rquit at event number β soquit_sync_finalsyncis the event number where the remote worker thread for the provider above it should, like, pack up and terminate. π And bestie, it does not work alone β you literally have to use this together with the-qoption above. Periodt.-llag interval βlag_intervalis a lil time value like3 minutesor4 hoursor2 days, and it tells this node to lag behind its providers by exactly that interval. πΈ What that actually means: events get straight-up ignored until they're old enough to match the interval. No cap.
β οΈ Warning β there's a catch, and it's kind of a big one. This lag comes with a downside that rides right along with it: events that require all the nodes to synchronize β which is basically the whole vibe ofSLONIK FAILOVER(7)andSLONIK MOVE SET(7)β are gonna have to sit there and wait for the lagging node. π
And that might not be the behaviour you're after at failover time, or at the moment you wanna run SLONIK EXECUTE SCRIPT(7). Just saying. Not ideal, fr fr.
π EXIT STATUS π
slon hands 0 back to the shell when it finished normally β clean exit, no drama, we love to see it. π
But if it runs into any fatal error, it bails via exit(-1), and depending on your system that'll likely show up as a return value of either 127 or 255. π«Ά
And that's the whole page, bestie! π¦ This one's from the Application manual, dated 19 September 2024, filed under slon(1). Go replicate responsibly. π
β¨
π¦ where this page comes from
- debian trixie: slony1-2-bin 2.2.11-6
- ubuntu questing: slony1-2-bin 2.2.11-6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms