Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 606
  • Last Modified:

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?

1 Solution
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?
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) -
Good luck!
nociSoftware EngineerCommented:
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).
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

rawandnetAuthor Commented:
- do you mean clustering MySQL or whole server?
- is it difficult to configuring cluster on Linux?
nociSoftware EngineerCommented:
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.
rawandnetAuthor Commented:
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.

nociSoftware EngineerCommented:
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.
rawandnetAuthor Commented:
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.)
nociSoftware EngineerCommented:
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.    ( 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.
rawandnetAuthor Commented:
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?
nociSoftware EngineerCommented:
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.
rawandnetAuthor Commented:
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
nociSoftware EngineerCommented:
GFS is the name of a filesystem where multiple machines can access one filesystem concurrently (see also RedHat).
FC = Fibre Channel, a standard (non internet protocol) for accessing storage devices over distance.
DLM = Distributed Lock Manager (see also RedHat).
nociSoftware EngineerCommented:
rawandnetAuthor Commented:
thanks for you information
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now