Fault-tolerant website with Linode
But what if HE.net fails? Maybe I may purchase also Linode in UK?
How it may be organized, and also data replicated all the time?
Thanks,
3 Replies
The cheap, quick, and easy tool for synchronization is rsync, along with changing DNS records to divert traffic as required. If databases are involved, it becomes more complicated.
This thread
I have a development server at home configured almost identical to my linode. Same distribution (CentOS), same configurations (except where they have to be different), etc.
Nothing goes on my linode that hasn't first been on my development server. The way I upload to my linode is via rsync:
#!/bin/bash
dir=`echo $1 |sed -e s?"\/$"?""?`
echo ${dir}
test=`echo ${dir} |grep -c "^\/"`
if [ ${test} -eq 0 ]; then
echo "Must be full path"
exit 1
fi
if [ `echo ${dir} |grep -c "\/home\/"` -gt 0 ]; then
exit 1
fi
dest=`echo ${dir} |sed -e s?"[^\/]*$"?""?`
echo ${dest}
rsync -avz --delete -e "ssh -i /path/to/my/rsync-key" ${dir} user@linode:${dest}
Obviously that needs to be tailored to your individual environment.
I use rsync over ssh and run sshd on a non standard high port number.
That way, no code is on my linode that isn't on my local devel box.
Once a night via cron, I do a reverse to grab content from the linode that was uploaded/created via the web applications I run so it is also backed up on my local devel server.
This includes database. First of every month, I do a full database dump and rename it to full.sql. Then once a day, I do a full database dump, take a diff from full.sql, and save it patch-date.sql
My devel box then grabs those by rsync, applies the patch on my local machine to reproduce the days full backup, and loads it into my devel box database.
This isn't fault tolerant in the sense that if a meteorite hit the Dallas location, I would still be serving requests - but it does mean that if something happened beyond a temporary outage, I could quickly be up and running again.