csync2 Installation and Setup

Csync2 is a cluster synchronization tool. It can be used to keep files on multiple hosts in a cluster in sync. Csync2 can handle complex setups with much more than just 2 hosts, handle file deletions and can detect conflicts. Installation Build and Install csycn2 by running the below script - build-csync2.sh #!/bin/sh # build-csync2.sh # Make directory to store csync2 related mkdir -p /data/build/ mkdir -p /data/sync-db/ mkdir -p /data/logs/csync2 mkdir -p /data/sync-conflicts/ cd /data/build/ # Get the files from our own file repository wget http://downloads.sourceforge.net/librsync/librsync-0.9.7.tar.gz wget http://oss.linbit.com/csync2/csync2-2.0.tar.gz # Install the packages required to compile csync2 yum install xinetd byacc flex gcc-c++ gnutls gnutls-devel openssl-devel openssl-static sqlite-devel -y # Untar the files tar -xzf librsync-0.9.7.tar.gz tar -xzf csync2-2.0.tar.gz # Build csync2 cd /data/build/csync2-2.0 ./configure \ --prefix=/usr \ --with-librsync-source=/data/build/librsync-0.9.7.tar.gz \ --localstatedir=/var \ --sysconfdir=/etc \ --disable-gnutls make && make install # Remove the directories that we no longer need cd .. rm -rf librsync-0.9.7 rm -rf csync2-2.0 # Add the csync2 port number to /etc/services echo "csync2 30865/tcp" >> /etc/services CSYNCLOC=`which csync2` # Create a xinted definition file for csync2 echo -e "# default: on\n# description: csync2 xinetd server\n\nservice csync2\n{\n disable = no\n flags = REUSE\n socket_type = stream\n wait = no\n user = root\n group = root\n server = $CSYNCLOC\n server_args = -i -D /data/sync-db/\n port = 30865\n type = UNLISTED\n log_type = FILE /data/logs/csync2/csync2-xinetd.log\n log_on_failure += USERID\n}\n" > /etc/xinetd.d/csync2 # Restart the service to include the newly created definition service xinetd restart Setup First, generate ONE self-signed SSL certificate that would be used by your cluster. ...

<span title='2016-03-14 12:00:00 +0800 +0800'>March 14, 2016</span>
CentOS

Running FTP on CentOS

Here’s how you can easily setup FTP on CentOS yum install vsftpd Added these to the security group if you are running AWS EC2 Add port range 20-21 Add port range 1024-1048 vi /etc/vsftpd/vsftpd.conf Set anonymous_enable=NO Set chroot_local_user=YES Add these pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048 pasv_address=<Public IP of your instance> sudo service vsftpd restart To make sure that the service is started on reboot chkconfig --level 345 vsftpd on Create new FTP User useradd -d /path/to/new/home/dir -G apache userNameHere chown userNameHere:apache /path/to/new/home/dir passwd userNameHere The log file can be found in /var/log/xferlog ...

<span title='2016-03-11 20:00:00 +0800 +0800'>March 11, 2016</span>
SVN

SVN Users and Repositories

We have setup our SVN to be accessed through http with the help of Apache. Here’s a sample configuration that we have used. vi /etc/httpd/conf.d/vhosts.conf Add the below into subversion.conf <VirtualHost *:443> ServerName svn.mydomain.com DocumentRoot /var/www/svn.mydomain.com <Directory /var/www/svn.mydomain.com> AllowOverride All Order Allow,Deny Allow from all Options -Indexes Require all granted </Directory> <Location /repos/newrepository> DAV svn SVNPath /var/svn/repos/newrepository AuthName "Subversion repository" AuthType Digest AuthUserFile /var/svn/svn-auth.htdigest AuthzSVNAccessFile /var/svn/svn-acl.conf Require valid-user </Location> SSLEngine on SSLProtocol all SSLCertificateFile /etc/pki/tls/certs/ca.svn.mydomain.com.crt SSLCertificateKeyFile /etc/pki/tls/private/ca.svn.mydomain.com.key ErrorLog /var/log/httpd/svn.mydomain.com-error_log CustomLog /var/log/httpd/svn.mydomain.com-access_log combined </VirtualHost> You can create a new SVN user by using the command below. This would store the encrypted password into svn-auth.htdigest ...

<span title='2016-03-07 12:00:00 +0800 +0800'>March 7, 2016</span>
Yii

Testing Yii with Codeception

We have an application written in Yii. Up til this point, it has been manually tested. Since it’s more efficient to automate the testing of this application, we have decided to set up Codeception to assist us with this task. Set up was easy and straight forward - this said after spending countless hours understanding the correct way to set it up. To illustrate the set up process, we’ll create a skeleton Yii app. ...

<span title='2016-02-02 18:19:00.001 +0800 +0800'>February 2, 2016</span>
WordPress

What I've Learnt Migrating a Blog from Wordpress to Blogger

As per the subject, migrating a blog from Wordpress to Blogger isn’t as hard as most would have imagined, On the down side, it’s a bit tedious if you have stored your images with your Wordpress blog. For my case, I have always stored my images on Picasa Web, so, I need not go through the process of copying the images out from the Wordpress blog. Here’s the straight forward process of exporting your Wordpress blog into Blogger. ...

<span title='2016-01-21 18:52:00.001 +0800 +0800'>January 21, 2016</span>

Share Your Knowledge and Pass It Along

Knowledge gained through hard work or experience are meant to be shared. You might think that holding on to this knowledge would make you indispensable, or by sharing, it would jeopardize your position since someone else can do it. Yet, have you considered the possibility that you have limited yourself to the scope of this work? You’ll end up being the person doing it all the time, and losing the chance to gain new knowledge and experience. ...

<span title='2016-01-08 18:57:00 +0800 +0800'>January 8, 2016</span>