Link to home
Start Free TrialLog in
Avatar of rawandnet
rawandnet

asked on

Does rsync make an exact mirror between servers

Hi Guys,

I have a server that hosts our university website; the website is connected to MySQL. My question is can I user rsync  to create exact mirror  Linux  system file to another server, that server will be acting as a backup in case of primary server goes down. Can rsync  make mirror backup of running databases and new install packages? If not what is alternative?

Thanks
Avatar of Julian Parker
Julian Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

It will copy the files but if the files are in use I'm not sure they would be in a good state for a recovery.

Can  you cluster?
Yep,
when it comes to database "mirroring" it is most probable (if not certain) that you will end up with a corrupted databe at the mirror site.
So rsync is good for flat files, but for MySQL I'd strongly recommend using its replication functionality.
Here is a comprehensive outline (part of the MySQL Reference) -
http://dev.mysql.com/doc/refman/5.0/en/replication.html
Good luck!
wmp
Avatar of noci
noci

The above are generalized in:

if a file is written sequentialy then it might be only partly copied when it mirrored to a different disk, (ie the remainder is still missing).
if a file is written randomly then it should be considered to be corrupted if it was accessed during the sync process as parts that have been copied, could allready have been changed.

What do you want to protect is the main question:
- loss of a disk: use a mirror raid set (raid 1)
- loss of a whole system: -
   - you can mirror f.e. using a gfs file system (off the system) and use a cluster that has multiple machines but one live instance this might still need repair (roll back until the last valid transaction).
   - you can mirror mysql (as mentioned before).
Avatar of rawandnet

ASKER

- do you mean clustering MySQL or whole server?
- is it difficult to configuring cluster on Linux?
Both can be done
On RHEL/CENTOS the tooling is installable. Other Distro's need a bit more work. (esp. GFS Filesystem, DLM lock manager, Enhanced LVM ), you also need a storage service (iSCSI) so the data is accessible to multiple systems.
Then you can run MySQL once on the cluster. and pull the service (+ ip address ) to a surviving system.

Otherwise you setup two MySQL instances as their failover.
With my understanding I thought Cluster used for sharing Processing load between servers (not as redundancy).  But what you saying is Cluster used for create exact backup copy of data between two servers,  does that include making exact copy of entire linux system files between to servers (as an image), example if I install rpm package on one server cluster will to replication automatically on other server.

How you deploy your application defines how use a cluster.

In Real life i am an admistrator for OpenVMS Clusters. (There it can be everything, there are no application worries., redundancy, failover, upgrades of systems without downtime. One of the slogans: "When downtime is not an option" is very true, and it has done so for more that 25 years.)
Applications can be run on multiple nodes at the same time using ONE dataset (files/database etc) because of the correctly enforced use of a lock manager (comparable to DLM in Linux). This locking is enforced on EVERYTHING. (In Unix there is more or less advisory locking, if someone doesn't use the locking for some file, you can access the file, But I digress).

You can have shared filesystems with Cluster filesystems like GFS, where a lockmanager is inserted by GFS to handle allocation & freeing of disk resources. (NOT access to files, but creating/removing files etc.).
If mysql could use this shared data access (by carefull locking the "right stuff") it could access one database from many systems..
The problem being that most Unix/Linux apps. don't care about locking.

AFAIK you cannot boot from a GFS filesystem, so /boot and / (minimal {tmp,bin,lib}) needs to be a local file system. The remainder could be on a GFS, and thus be shared.
could you please explain this a bit more:
> In Real life i am an admistrator for OpenVMS Clusters. (There it can be everything, there are no   application worries., redundancy, failover, upgrades of systems without downtime. One of the slogans: "When downtime is not an option" is very true, and it has done so for more that 25 years.)
My professions is OpenVMS Systems Manager.

Linux/Unix systems are on the Side.
w.r.t. to creating environments where uptime requirements are above 99.999% of uptime a year (including scheduled downtime).
there is IMHO only one serious contender. OpenVMS, that OS isn't something that acquired "Clustering" shortly as an after thought.
Clustering is the heart & soul of OpenVMS.    (http://www.hp.com/go/openvms for more info).

If an application is multiuser safe (i.e. it allows concurrent sharing of resources on one system, it will allow concurrent sharing the resources on multiple systems, out of the box).  And no hassle with "fencing/stonith" with it's inevitable single point of failure.
I agree with that OS deoesn't require Clustring, but if i install rpm package or complie source code on one server i have to do same one other server.

- then cluster can create multiple copy of date on several servers. clustring isn't only for using slave servers resources (CPU, memory..) it can be used as a failover if one server fail, is that true?
Yes that is true if you install your software on a Cluster-Common-Filesystem.

GFS is such a filesystem.  Such a filesystem requires that all resources for thactual storage are accessible for all machines when the machines are running.  => you need an external FC- or iSCSI storagebox (SAN/NAS).
That allows multiple clients to the same "served"-device.

Those clients need to organise themselves (using a DLM f.e.) to coordinate access to shared resources.
Above that for mysql you need to ensure only one system is active and that during failover the "server" ip address is moved to the failover system.
Although some of the word you use is totally new for me like GFS, FC and DLM, but I will try to read some about that and get some knowledge, if you have any induction links please send it to me
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for you information