Yes, you can use rsync as your backup system over the network.
Here is my real problem on site:
- The box must not restart, shutdown or any downtime.
- The firewall has configured with only couple of port opened ( SSH, ftp ) these port has been changed into un-usual port. ( lets say 30022 as SSH, and 30021 as ftp ).
- I want to do all backup process automatically.
and Here’s my preparation.
- I have another box connected to internet with the same port opened. I dont want to have the usual port for SSH and FTP, hacker always try to hijack these port.
- Another media or harddrive must be prepared.
Here is the steps
First.
Make sure client-server are connected each other using ssh port (30022).
The idea is the server will connect to client using rsync with 30022 port. So, there will be no rsync daemon installed on server.
The basic syntax I am going to use is
rsync -av –progress –inplace –rsh=’ssh -p30022′ /etc root@client_ip:somedir/
lets try to run that syntax first, dont forget to change client_ip .
Run it on Server shell. And you will be prompted for client root’s password.
Last line of the result is :
etc/yum/yum-updatesd.conf
490 100% 0.84kB/s 0:00:00 (xfer#1990, to-check=2/3375)
etc/yum/pluginconf.d/
etc/yum/pluginconf.d/installonlyn.conf
84 100% 0.14kB/s 0:00:00 (xfer#1991, to-check=0/3375)
sent 108993486 bytes received 42267 bytes 31153072.29 bytes/sec
total size is 108818539 speedup is 1.00
When I see in ~root/somedir there are complete files of /etc directory from server.
Execute once again the same above syntax will not result anything like before, that mean the directory has been synced.
What do you think ? Not bad huh ?
You can repeat this step for another directory / from the server.
Another challange here is , ” Can I do this on Crontab schedule ?”.
As you can see above, you must enter root’s password, and this cannot be done by crontab.
…. to be continued..
April 29th, 2009
Posted by
admin |
CentOS, General, Ubuntu, backup |
no comments
rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion.
In daemon mode, rsync listens to the default TCP port of 873, serving files in the native rsync protocol or via a remote shell such as RSH or SSH. In the latter case, the rsync client executable must be installed on both the local and the remote host.
( source : http://en.wikipedia.org/wiki/Rsync )
Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.
Rsync finds files that need to be transferred using a “quick check” algorithm (by default) that looks for files that have changed in size or in last-modified time. Any changes in the other preserved attributes (as requested by options) are made on the destination file directly when the quick check indicates that the file’s data does not need to be updated.
Some of the additional features of rsync are:
- support for copying links, devices, owners, groups, and permissions
- exclude and exclude-from options similar to GNU tar
- a CVS exclude mode for ignoring the same files that CVS would ignore
- can use any transparent remote shell, including ssh or rsh
- does not require super-user privileges
- pipelining of file transfers to minimize latency costs
- support for anonymous or authenticated rsync daemons (ideal for mirroring)
( source : rsync man page )
So, I will try to use rsync as backup system application to backup full system without any server downtime.
April 28th, 2009
Posted by
admin |
CentOS, General, Ubuntu, backup |
no comments
Backup all the system is very important, many backup programs are available in internet but they are bootable disc.
The programs will start when the machine is restarting and booted from CD.
The problem is, the server is running and no way to turn it off even to restart it.
Based on that problem, I will try to make a simple backup and the box is still running.
Wait for my post in short day.
April 28th, 2009
Posted by
admin |
CentOS, General, Ubuntu, backup |
no comments
Web server and File server is good to be placed on different machine.
In my case, I have web server running apache+php+mysql under Centos Box, and File Server is on Windows Advanced Server 2000. The problem is apache cannot read the php file in Windows server.
All I have done :
- I added line at fstab configuration
//192.168.1.3/data/media/code cifs username=administrator,password= 0 0
- I edit httpd.conf as below
EnableMMAP off
EnableSendfile off
That’s all, and only that. Many people pay for this solution, But I gave you FREE !!.
April 14th, 2009
Posted by
admin |
Apache, CentOS, Samba, Ubuntu, Windows |
no comments
It is important to make kannel running as daemon, so it will easily to start-stop this service
Create file kannel in /etc/init.d
#!/bin/sh
#
# kannel This script takes care of starting and stopping the kannel \
# WAP gateway services (bearer/wap/smsbox).
# chkconfig: - 97 03
# description: The Kannel WAP and SMS gateway services
# config: /etc/kannel.conf
# Use start-stop-kannel
prog=”/usr/sbin/start-stop-kannel”
args=”–start –background –exec ”
config=”/etc/kannel.conf”
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ “${NETWORKING}” = “no” ] && exit 0
[ -f $config ] || exit 1
RETVAL=0
RETVAL_BEARER=0
RETVAL_WAP=0
RETVAL_SMS=0
start() {
# Start daemons.
echo -n “Starting kannel bearer box: ”
daemon $prog $args /usr/sbin/bearerbox $config
RETVAL_BEARER=$?
sleep 3s # Sleep for a while before we try to start smsbox
echo
# Starting wap and sms only makes sense if bearerbox is running
if [ $RETVAL_BEARER -eq 0 ]; then
if grep “^group = wapbox” $config &>/dev/null; then
echo -n “Starting kannel wap box: ”
daemon $prog $args /usr/sbin/wapbox $config
RETVAL_WAP=$?
echo
fi
if grep “^group = smsbox” $config &>/dev/null; then
echo -n “Starting kannel sms box: ”
daemon $prog $args /usr/sbin/smsbox $config
RETVAL_SMS=$?
echo
fi
fi
[ $RETVAL_BEARER -eq 0 -a $RETVAL_WAP -eq 0 -a $RETVAL_SMS -eq 0 ] \
&& touch /var/lock/subsys/kannel || RETVAL=1
}
stop() {
# Stop daemons.
if grep “^group = smsbox” $config &>/dev/null; then
echo -n “Shutting down kannel sms box: ”
killproc /usr/sbin/smsbox
RETVAL_SMS=$?
echo
fi
if grep “^group = wapbox” $config &>/dev/null; then
echo -n “Shutting down kannel wap box: ”
killproc /usr/sbin/wapbox
RETVAL_WAP=$?
echo
fi
echo -n “Shutting down kannel bearer box: ”
killproc /usr/sbin/bearerbox
RETVAL_BEARER=$?
echo
[ $RETVAL_BEARER -eq 0 -a $RETVAL_WAP -eq 0 -a $RETVAL_SMS -eq 0 ] \
|| RETVAL=1
rm -f /var/lock/subsys/kannel
}
# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status /usr/sbin/bearerbox
RETVAL_BEARER=$?
if grep “^group = wapbox” $config &>/dev/null; then
status /usr/sbin/wapbox
RETVAL_WAP=$?
fi
if grep “^group = smsbox” $config &>/dev/null; then
status /usr/sbin/smsbox
RETVAL_SMS=$?
fi
[ $RETVAL_BEARER -eq 0 -a $RETVAL_WAP -eq 0 -a $RETVAL_SMS -eq 0 ] \
|| RETVAL=1
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart|status}”
RETVAL=1
esac
exit $RETVAL
Add a line at /etc/rc.local
sh /etc/init.d/kannel start
The service sytax is
# /etc/init.d/kannel status
# /etc/init.d/kannel stop
# /etc/init.d/kannel start
Thats all. Thanks.
April 14th, 2009
Posted by
admin |
SMS gateway |
no comments