I finally setup csync2 on debian - its nice! Its a simple sort of configuration tool that I need for now.
I followed this guide for setting up csync2 on redhat, and then read the debian readme, which included instructions for creating keys:
csync2 for Debian
-----------------
You need to create an SSL certificate for the local Csync2 server.
You can create a certificate using the following commands:
openssl genrsa -out /etc/csync2_ssl_key.pem 1024
openssl req -new -key /etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.csr
openssl x509 -req -days 600 -in /etc/csync2_ssl_cert.csr \
-signkey /etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.pem
Then I also had to use the command “csync2 -k /etc/csync2_ssl_cert.key”.
I didn’t have to do anything with openbsd.inetd other than restart it, and I’m not sure if that was even necessary. I initially typed in a peer’s hostname wrong, so I had to remove the sqlite db in /var/lib/csync2/.
I’ve only done one test but I like it so far! Hopefully I can use this to alleviate my current dependency on subversion for configuration files.
UPDATE: I do have to restart openbsd-inetd to get csync2 to work right.
More notes:
* hostnames are tricky - the names in the /etc/csync2.cfg file need to be the same as the /etc/hostname for each member of the cluster.
* I’m finding it easier to go server by server, using non-volatile files, and I’m including /etc/csync2.cfg in the list of files to sync so I can update them later
Hi, I’m also trying to install csync2 on my debian cluster, but I’m having some strange problems.
These are the steps I do:
# aptitude install csync2
# openssl genrsa -out /etc/csync2_ssl_key.pem 1024
# openssl req -batch -new -key /etc/csync2_ssl_key.pem -out
/etc/csync2_ssl_cert.csr
# openssl x509 -req -days 600 -in /etc/csync2_ssl_cert.csr -signkey
/etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.pem
# csync2 –k /etc/csync2.key.linuxCluster
# scp /etc/csync2.key.linuxCluster root@hac-c1n2:/etc
The configuration file:
group linuxCluster
{
host hac-c1n1 hac-c1n2;
key /etc/csync2.key.linuxCluster;
include /home;
include /var/www;
include /srv;
exclude /srv/mysql-cluster;
include /etc/apache2;
exclude /etc/apache2/local.conf;
action
{
pattern /etc/apache2/*;
exec “/usr/sbin/apache2ctl graceful”;
logfile “/var/log/csync2.actions.log”;
do-local;
}
auto younger;
}
# scp /etc/csync2.cfg root@hac-c1n2:/etc
# /etc/init.d/openbsd-inetd restart
# /etc/init.d/apache2 restart
And then when I try to do
#csync2 -xv
I get the message Connection to host eth1 (SSL) …
Can’t resolve peername.
ERROR: Connection to remote host failed.
Host stays in dirty state. Try again later …
Finished with 1 errors.
Why the fuck won’t it work? Besides: why does it say the host is eth1??? The host isn’t eth1, that’s the interface …
Your help would be much appreciated!
Hey dennis - what happens when you “ping eth1″ on both machines? csync2 is very picky about host names - and even after its changed. I also believe that I had to get the “hostname” command to output the same name as the one I put in the csync2.cfg file. I just checked my file and I have this at the top:
Maybe you need some hosts that are in ()? The top one without parens is the primary.
While the documentation says something else… removing the “-eth0″ string in the config file did the trick for me