Skip to content

Installing, configuring, running and administrating Slony-I 2.0 on Red Hat / CentOS using RPMs - Part II

(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:

pagila-2009-07-07_15:26:59.log


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:

log_timestamp_format='%Y-%m-%d'


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.

#vac_frequency=3

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.

#log_level=4

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:

Fatal
Error
Warn
Config
Info

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.

#sync_interval=2000

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.

#sync_interval_timeout=10000

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).

#sync_group_maxsize=6

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.

#desired_sync_time=60000

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.

#cluster_name='sloncluster'

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 :

#vac_frequency=3
#cleanup_interval="10 minutes"
#log_level=4
#sync_interval=2000
#sync_interval_timeout=10000
#sync_group_maxsize=6
#sync_max_rowsize=8192
#sync_max_largemem=5242880
#remote_listen_timeout=300
#syslog=0
#log_pid=false
#log_timestamp=true
#log_timestamp_format='%Y-%m-%d %H:%M:%S %Z'
#pid_file='/path/to/your/pidfile'
#syslog_facility=LOCAL0
#syslog_ident=slon
#cluster_name='sloncluster'
#conn_info='host=/tmp port=5432 user=slony'
#desired_sync_time=60000
#sql_on_connection="SET log_min_duration_statement TO '1000';"
#command_on_logarchive="/usr/local/bin/movearchivetoarchive"
#lag_interval="8 minutes"
#archive_dir="/tmp/somewhere"
#quit_sync_provider=1
#quit_sync_finalsync=21341
#cleanup_deletelogs=false

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

YinYin on :

Hi

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,
YinYin

Sharell Pasqual on :

F*ckin’ tremendous things here. I’m very glad to see your post. Thanks a lot and i am looking forward to contact you. Will you kindly drop me a e-mail?

Conception Cabrena on :

I wanted to write you that very little remark just to thank you very much over again over the pleasant knowledge you've featured above. It is simply surprisingly generous of you to make freely exactly what a lot of people might have supplied as an ebook to generate some dough on their own, especially since you might well have tried it if you considered necessary. These advice additionally served like a fantastic way to comprehend most people have the same dream like my personal own to grasp somewhat more in regard to this issue. I believe there are a lot more pleasurable situations in the future for individuals who browse through your blog.

Graham Ahrens on :

you are really a good webmaster. The web site loading speed is incredible. It seems that you're doing any unique trick. Furthermore, The contents are masterwork. you have done a wonderful job on this topic!

Clemente Pafundi on :

I like the helpful information you supply to your articles. I will bookmark your blog and take a look at once more here frequently. I'm reasonably sure I will learn lots of new stuff right right here! Good luck for the following!

Alden Priebe on :

Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a bit, but instead of that, this is magnificent blog. An excellent read. I will definitely be back.

Nelda Behrend on :

In my opinion, this is an interesting question, I will take part in the discussion. Together we can come to the right answer. I'm sure.

Shon Grenway on :

I wish to express some thanks to this writer just for rescuing me from this dilemma. After looking through the world wide web and getting solutions that were not pleasant, I thought my life was gone. Being alive devoid of the strategies to the difficulties you have resolved through your good article is a critical case, and the kind that might have adversely affected my entire career if I hadn't come across the blog. Your own skills and kindness in taking care of a lot of things was precious. I am not sure what I would've done if I hadn't come upon such a thing like this. I can now look ahead to my future. Thanks for your time very much for your skilled and sensible guide. I will not be reluctant to recommend the blog to anyone who wants and needs guidance about this subject matter.

Kori Szitar on :

Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is great, let alone the content!

Jenni Burlando on :

F*ckin’ tremendous things here. I’m very glad to see your post. Thanks a lot and i am looking forward to contact you. Will you kindly drop me a mail? I pay 3 bucks for hosting and it's great. Here it is: https://bit.ly/3DollarHost

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.
CAPTCHA

Form options