Tag : remote-sync
Tag : remote-sync
Login on server as a “root” user.
cd /usr/local/ wget http://lsyncd.googlecode.com/files/lsyncd-2.1.5.tar.gz tar \-xvzf lsyncd-2.1.5.tar.gz cd lsyncd-2.1.5 yum install gcc-c+\+ yum install lua yum install lua-devel ./configure make make install
Now we need to create Linux daemon which call up our customized lsyncd config file. Daemon script would be like…
. /etc/rc.d/init.d/functions user=glmstudio config="<path>/lsyncd.lua" lsyncd="/usr/local/bin/lsyncd" lockfile="<lock PATH>/lsyncd" prog="lsyncd" RETVAL=0 start() { if [ -f $lockfile ]; then echo -n $"$prog is already running: " echo else echo -n $"Starting $prog: " #su - $user -c "$lsyncd $config -insist" daemon --user $user $lsyncd $config -insist RETVAL=$? echo [ $RETVAL = 0 ] && su - $user -c "touch $lockfile" return $RETVAL fi } stop() { echo -n $"Stopping $prog: " killproc -d 60 lsyncd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f $lockfile return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status lsyncd ;; *) echo "Usage: lsyncd {start|stop|restart|status}" exit 1 esac exit $? </lock></path>
Lsyncd.lua file would have your sync configuration. Something as follows.
--SETTINGS settings { logfile = "<path>/lsyncd.log", statusFile = "</path><path>/lsyncd.stat", statusInterval = 300 } --ENDSETTINGS --SERVERS serverlist = {"SERVER1:DISTINATION", "SERVER2:DISTINATION"} --ENDSERVERS for _, server in ipairs(serverlist) do sync { default.rsync, source="<source PATH/>", target=server, delay = 30, rsync = { protect_args = false } } end </path>
How to start and stopwatch film King Arthur: Legend of the Sword now
/etc/init.d/lsyncd start /etc/init.d/lsyncd stop
There might be the issue during start of lsyncd, as some time list of files are more than max user watches. For fixing this we need to change from following file.
/proc/sys/fs/inotify/max_user_watches //Command echo "819211" > /proc/sys/fs/inotify/max_user_watches
Categories: Linux, Website Peformance
Elasticsearch is …
It is …..
 Installation
Elasticsearch is based on java, so we need to install JAVA>6
yum install java-1.7.0-openjdk.x86_64
java -version
Download source from
wget https://download.elasticsearch.org/
elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz
tar -xvf elasticsearch-0.20.5.tar.gz
cp -r elasticsearch-0.20.5.tar.gz elasticsearch
cd elasticsearch
Add elastic home path in “.bash_profile”
export $ES_HOME=/home/elasticsearch
Start/Run Elasticsearch
cd elasticsearch
bin/elasticsearch -f
Is it started?
You can confirm it by browsing URL like - http://127.0.0.1:9200/, it will shows something like
{
"ok" : true,
"status" : 200,
"name" : "Neville, Kate",
"version" : {
"number" : "0.20.5",
"snapshot_build" : false
},
"tagline" : "You Know, for Search"
}
Categories: Elasticsearch, Linux, Website Peformance