Setup suggestion: backup + replication/uptime and redundancy

How to backup and/or replicate your PacsOne Server database for redunancy and fault tolerance?
Post Reply
Jonathan
Posts:184
Joined:Mon Mar 22, 2004 11:52 am
Location:The Netherlands
Contact:
Setup suggestion: backup + replication/uptime and redundancy

Post by Jonathan » Mon Jan 10, 2005 10:16 pm

Allright here we go... fullfilling a promiss I made (http://www.pacsone.net/forum/viewtopic.php?t=97)

(I think this is the best place to put the topic, but if not so please replace it)

I mentioned it earlier in some other topics and cannot stress the topic of backup enough. Especially when you are using the PacsOne system as we do in our institute.

Have you ever thought of how much of the data you can recover after a HD crash or a simple delete of a patient on the PacsOne system? Or when the MySQl tables get corrupt and cannot be repaired/recoverd? We did and came to the following setup.

In our institue we use the PacsOne server for a while in the freely downloadable trial version and really appreciate it. We therefore decided to buy the license.

In order to have a high up-time and redundacy when (parts of) the system fails (either hardware like harddisks or some of the software like MySQL it uses) we also take a good look at our configuration. We need this high up-time and redundancy because of the central position the machine has in our institute. All CT, MR,CR, PET and DICOM-RT will be received and stored by the PacsOne system for the upcoming years.

As the databases is stored in a MySQL table we started looking for ways of backing-up the data. Diving in to the MySQl manual we found the following entries that are related to this.

A few MySQL utilities that can be used:
  • MySQL dump (MySQL manual section 8.8: http://dev.mysql.com/doc/mysql/en/mysqldump.html)
    The mysqldump client can be used to dump a database or a collection of databases for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table.

    MySQL hotcopy (MySQL manual section 8.9: http://dev.mysql.com/doc/mysql/en/mysqlhotcopy.html)
    mysqlhotcopy is a Perl script that was originally written and contributed by Tim Bunce. It uses LOCK TABLES, FLUSH TABLES, and cp or scp to quickly make a backup of a database. It's the fastest way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located. mysqlhotcopy works only for backing up MyISAM and ISAM tables.
Because of the high demand for up-time we found it unafortable to lock the server to backup my tables. It should be possible to receive data for the PacsOne server and to store the data in the tables while receiving images.

Therefore we chose for a setup with replication. (MySQL manual section 14: http://dev.mysql.com/doc/mysql/en/Replication.html)

With this setup there is a master and at least one slave MySQL server. The master is the server that recieves the images and the slave is a seperate mysql server on another host. The master also holds the PacsOne executables and provides the web interface.

One of the benefits of replication is that it is ran from the slave side and not from the master side and therefore the master does not need to be locked in anyway. The master server keeps track of all the changes in its database using a so called binary log file (MySQL manual section 5.8.4: http://dev.mysql.com/doc/mysql/en/Binary_log.html).

The slave or replication MySQL server, which is actually a client of the master server, downloads this log file and executes the MySQL statements which are recorded there in its own database. (For testing one of the slaves even runs on my desktop PC which makes testing much easier).

A strong pro for this situation in my opinion is that when a sever system failure occurs on the master server which brings it offline for a long while it is not much effort to change the slave/replication server in to the master server. Just install the PacsOne server there (Be aware don't drop the tables... else all effort is worthless because all the data is removed anyhow! Why isn't this option switched off by default in the installation setup? It would be much saver to explicitly select the database to be droppped when installing the PacsOne server. Maybe some option to change in newer setup releases?)

Now all the data recieved is still available. Changing hostname (because of the server name being hardcoded in the license) and IP address to the vacant one of the master also enables it to recieve images from other DICOM modalities again without changing enything else on the clients.

The second advantage is that we can do the real backup (dumping the MySQl tables) of the data and therefore locking of tables/databases (which caues temporarily unaivalability of this slave/replication server) on the slave server keeping the master up. This server can be locked for a while because replication will pick up when the slave/replication server is ready again after we release the locks. Even if the backup failes and completely locks up or freezes the system the master is still up and receiving images. We than (just) need to find and fix the error)

For backing up my data we use the excellent and highly configurable backup script that can be found here (http://worldcommunity.com/opensource/ut ... ackup.html)
This script allows you to configure backups to be made in several ways, use compression of the backup, a rotation scheme and even make s it possible to email you the status report, including if you want the backup as attachement. It runs on Linux as well as on Windows (although you need to install Perl and some Unix utilities on windows systems). This is also nice because of the PacsOne being available for both systems, now you only need one solution for two platforms.

(The backup script is able to compress at a high ratio because of pure MySQL output being a text file whit a lot of repeated statements. The total amount of diskspace taken up by the tables is about 60MB, in .sql files this is about 150MB and compressed with tar and gzip a little bit under 4MB. Bare in mind that this is only the MySQL information and that the backup contains no DICOM images.)

The backup of the real DICOM data is taken care of in an other way, the recieved data is directly written to a storage unit with several TB's of storage facility (yes indeed we mention therabytes: 1 TB = 1000 GB = 1000000 MB). Data stored on this storgae system cannot be deleted for years to come so we have not to bother about losing our data only maintaining access to it.

This storage system archives the DICOM file and leaves a kind of shortcut in the DICOM storage direcotry which makes it possible to recover archived images.

All togehter it was not easy and took some time figuring out how to make it work. Going in to details here would go rather far but when you are interested and are trying to do it yourself feel free to ask. I might have time ot help/point you in the right direction. However with a good read/search of the MySQL manual and using Google you can come a long way I discoverd.

Our final implementation looks like this:

1 MASTER server (dedicated):
  • Pacsone 2.1
    MySQL 4.0.x (will be upgraded to 4.1.x soon)
    PHP 4.3.x
    Apache 2.x
    Windows 2000 server
1 SLAVE server (not dedicated)
  • MySQL version 4.0.18 (will be upgraded to 4.1.x soon)
    ActivePerl 5.6.1.638
    MySQL backup script 3.1
    Windows 2000 server
1 SLAVE server (my desktop PC)
  • MySQL version 4.0.18
    Windows XP SP2
1 Storage system
  • Commercially available storage unit
I hope this give you some view on our vision to our approach of a stable and reliable storage system using the PacsOne server as the spider in a web. I also hope that you use this an input to check (and if necessary improve) your own solution for proper backup/restore options and reliability.

Jonathan
Last edited by Jonathan on Thu Jan 13, 2005 11:05 am, edited 1 time in total.

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Mon Jan 10, 2005 11:09 pm

Once again, I think this insightful post by Jonathan is invaluable for any user who needs to setup a fault-tolerant, high-availability PACS solution, not only for PacsOne Server, but also for any PACS server that uses a database.

Great job! Jonathan 8) 8) 8)

Isaac
Posts:6
Joined:Fri Jan 21, 2005 4:42 pm
Location:Mora in Sweden

A simple (but not so complete) approach to backup

Post by Isaac » Sat Feb 12, 2005 8:29 am

We use PacsOne for storing data/images that are good to have, but not a catastrophy if they are lost. (We use it to store data from a CT-scanner workstation, in order to enlarge the buffer of studies with "raw data" in the workstation. Instead of losing "raw data" in 5 days, we now have it 20 weeks. Normaly the "important" selected images are stored to our big PACS within a day, this storage is to take care of those few cases when we need to redo something later.)
For me its therefore a question of easily restore a functional system, but not neccesarily save all information.
I simply make a ghost copy of the server machine from time to time.
When restoring, I import images from the imagearchive, wich is on a separate firewire drive, like if I was importing it from a CD. It takes the system days to import the old images, but the system is up for retrieving new images as soon as the ghost-file has been read in and system restarted.
That means it probably can take two days before the 1Tbyte harddrive has been reindexed, and those images wont be available until then. But the storing of new images will start again within an hour.

The last time I tried this, I had about 300Gbytes of images, and it was indexed after half a day or so. (I didn't watch it all the time.) The PacsOne system does not give any feedback during this manouvre, but as long as the harddrive is flashing intensly, the indexing is beeing done...
(At least in my PacsOne version it instead complains about a bad importing device, because it is not a CD with dicomdir, but it works anyway. )

This aproach makes a simple backup of the complete working environement, that is my WinXP setup, firewall and everything in the PacsOne installation. It is simple to understand, and simple to do. I have two harddrives in the PacsOne machine, and ghosting from one to the other in 10 minutes. For security store the backup on DVD afterwords. (My backup is a little bit more than 1.5GB.)

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Thu Dec 20, 2012 11:02 am

As I am approaching to go live with PacsOne I was considdering all these options as well.

My SQL replication looks good, however I want to cut the time for restoring the service while the maintenance effort is kept for only one machine.

Then we decided to go for virtualization in order to keep the system state in only one backup/replication scenario. Apparently at this time VMware is offering management tools for up to 3 machines (hosts) for a low price (comparing to PacsOne Premium cost).

So we decided to mount the /DICOM folder from an external high redundancy storage, while the rest of the (Linux) machine is kept as a VM under WMware. We can keep all sorts of snapshots and backups to be able to go back for at least one month on a day by day basis. If anything happens we can restore some older image in matter of minutes since the space occupied by the VM without DICOM images is relatively small.

This scenario is in planning phase now but I think there will be no problems with it.

Post Reply