(Typos and grammar errors fixed. Thanks Lacey)

Part II: Slony-I basics and Slony-I configuration - slon.conf

Slony-I basics

slon is the deamon that is responsible for replication. It needs to be installed for each node, as described in the first part of the article.
Configuration of slon daemon

In the first part of the article, I wrote about pre-installation and installation phases of Slony-I 2.0.X to RHEL/CentOS. Now I will go over the details of the configuration files.

As I mentioned in the first post, there are 2 conf files: slon.conf and slon_tools.conf . First we will talk about slon.conf

slon.conf is used for slon daemon itself. RPMs put the slon.conf file in the /etc directory. Here are some of the configuration parameters that you may want to play with (with default parameters included):

# log_timestamp_format='%Y-%m-%d %H:%M:%S %Z'

This is the setting that changes log filename suffix. An example log file name is below:


The first part of the filename is the name of the replication cluster, as defined in the cluster_name parameter in slon.conf, and/or $CLUSTER_NAME in the slon_tools.conf. The second part, which is the timestamp, is defined by the log_timestamp parameter. Some people tend to change this parameter to:


and setup appropriate log rotation in order to rotate logs. Please note that it is possible to use rotatelogs binary of Apache in order to rotate logs, too. This will be mentioned in slon_tools.conf. However, Apache may not be installed on the server, so using logrotate daemon will probably be a better choice from system administrators's point of view.

#cleanup_interval="10 minutes"

The slon daemon performs cleanup cycles while it is working, and trims data from sl_log_1 to sl_log_2. This parameter sets the interval for cleanup cycles. Depending on your work load, you may want to decrease or increase this. Please note that under high load, decreasing this parameter will cause load on server.


This parameter sets the number of cleanup cycles which will trigger a VACUUM. Unless you are using pg_autovacuum, you will want to set this to a value other than 0. Default value is 3. Max value is 100.


This parameter defines the logging verbosity. The default value is 4. A value of 0 does not disable logging. 0 displays the following 5 log levels:


1 to 4 is Debug 1 to Debug 4. Slony-I 2.0 users are encouraged to use 0 as log_level, since some messages were incorporated into the log levels above.


This parameter defines the interval that slon checks SYNC requests. As this value decreases, slon performs updates more frequently. The update interval for slon is also affected by sync_interval_timeout parameter, so please check this, too. The default value is 2000ms. Min value for this parameter is 10ms, and max value is 60000ms. I tend to decrease this to 200 (ms), for performance under heavy load.


This parameter defines the time period that slon performs SYNC events between origin and slave(s). The default value is 10 seconds. Decreasing this parameter will lead to less replication lag, but it also means that both origin and slave will be more busy with replication. The max value for this parameter is 120000ms (120 seconds).


There may be times when replication lag gets bigger, which mostly depends on work load, or network connection issues. This parameter the number of batched SYNCs, and they will be applied together to close the replication gap. There may be times when, due to the work load, or network connection issues, that there is a large amount of replication lag. This parameter controls the number of batched SYNCs that will be applied together to close the replication gap.. As soon as the lag closes to 0, each SYNC event is applied seperately. Default value is 6. Values may change between 0 and 100. Please also see desired_sync_time parameter below.


Similar to sync_group_maxsize -- this parameter defines the maximum time for the SYNC operations that are already grouped. Per definition in conf file: "If replication is behind, slon will try to increase numbers of syncs done targetting that they should take this quantity of time to process. in ms" Default value is 60000 (ms). Range is between 10000 and 600000 . Decreasing this value will increase performance under heavy load.


This is the name of your cluster. This is also the name of the schema with a _ prefix that has replication info. i.e., _sloncluster in this case. You can use slon_tools.conf to define this parameter, too (which is a preferred way in this article)

#conn_info='host=/tmp port=5432 user=slony'

This parameter defines connection info of slon daemon. You can use slon_tools.conf to define this parameter, too (which is a preferred way in this article)

There are several more options. All of the remaining ones and their default values are :

#cleanup_interval="10 minutes"
#log_timestamp_format='%Y-%m-%d %H:%M:%S %Z'
#conn_info='host=/tmp port=5432 user=slony'
#sql_on_connection="SET log_min_duration_statement TO '1000';"
#lag_interval="8 minutes"



  • YinYin  

    I read your web pages are really helpful.

    But I have confusion between slony-I and slony-II.

    Is there any info or document that slony-1 vs slony-II ?

    And what are the advantages or technical dependencies of using slony-II instead of slony-I ?

    Thanks & Regards,

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.