5

I was unable to find any articles to answer this question, so my best bet was to post this here:

Scenario We have 2x application servers in production hosting a PHP website and I would like some folders to be syncronized between the 2, the same was setup for the development environment with no issues, I've followed all instructions from the URL "http://www.cloudedify.com/synchronising-files-in-cloud-with-csync2/", I still seem to have the same result, firewall has been disabled on both boxes for troubeshooting purposes:

Config Files: cysnc2.cfg

nossl * *;

group production {
   host server1;
   host server2;

   key /etc/csync-production-group.key;

 include /etc/httpd/sites-available;
 include /xxxxxx/public_html/files

 include /xxxxxxx/magento/media/catalog/product
 include /xxxxxxx/magento/media/brands

   exclude *.log;
   exclude /xxxx/public_html/file/cache;
   exclude /xxxxx/public_html/magento/var/cache;
   exclude /xxxx/public_html/logs;
   exclude /xxxxx/public_html/magento/var/log;

   backup-directory /data/sync-conflicts/;
   backup-generations 2;

   auto younger;
}

/etc/xinetd.d/csync2 csync2.cfg

service csync2
{
   disable         = no
   flags           = REUSE
   socket_type     = stream
   wait            = no
   user            = root
   group           = root
   server          = /usr/sbin/csync2
   server_args     = -i -D /data/sync-db/
   port            = 30865
   type            = UNLISTED
   log_type        = FILE /data/logs/csync2/csync2-xinetd.log
   log_on_failure  += USERID
}

I've made sure that the daemon is listening on both server on port 30865 and the keys matched on both servers

I've run a tcpdump on each server, output as follows:

12:20:31.366771 IP server1.49919 > server2.csync2: Flags [S], seq 445156159, win 14600, options [mss 1460,sackOK,TS val 794864936 ecr 0,nop,wscale 7], length 0
12:20:31.366810 IP server2.csync2 > server1.49919: Flags [S.], seq 450593575, ack 445156160, win 14480, options [mss 1460,sackOK,TS val 794798911 ecr 794864936,nop,wscale 7], length 0
12:20:31.367101 IP server1.49919 > server2.csync2: Flags [.], ack 1, win 115, options [nop,nop,TS val 794864937 ecr 794798911], length 0
12:20:31.367138 IP server1.49919 > server2.csync2: Flags [P.], seq 1:9, ack 1, win 115, options [nop,nop,TS val 794864937 ecr 794798911], length 8
12:20:31.367147 IP server2.csync2 > server1.49919: Flags [.], ack 9, win 114, options [nop,nop,TS val 794798912 ecr 794864937], length 0
12:20:31.368625 IP server2.csync2 > server1.49919: Flags [R.], seq 1, ack 9, win 114, options [nop,nop,TS val 794798913 ecr 794864937], length 0

Is there anything else i'm missing or should be doing?

Emil Salama
  • 51
  • 1
  • 3
  • Make sure your includes in csync2.cfg end with semi-colons, easily overlooked but EOL is usually important. –  Sep 23 '12 at 22:56
  • If you're still having troubles with this one can you please provide the contents of your "/data/logs/csync2/csync2-xinetd.log" on your receiving server and any errors that are outputted to on the server "sending" the files by running "csync2 -xv" from the command line? – David Aug 12 '13 at 02:50

1 Answers1

1

I had to remove my 127.0.0.1 entry for the -N host I provided to csync2. The 127.0.0.1 entry for "app1" was causing the csync2 client to want to bind to 127.0.0.1 instead of using the internal network.

Conversely, with the daemon, I am using a wrapper instead of calling csync2 directly to enforce my -N hostname preference.

#!/bin/sh
# cluster-csync2.sh
CSYNC2_SYSTEM_DIR=/etc /opt/cluster/bin/csync2 -i -D /var/lib/csync2 -N `hostname -s`

My /etc/inetd.conf entry (the port is defined in /etc/services):

csync2      stream  tcp nowait  root    /opt/cluster/bin/cluster-csync2.sh  cluster-csync2.sh