Sign in to follow this  
Lichbane

What's your server backup strategy?

Recommended Posts

Folks,

 

What is your backup strategy for your server?  Can you backup the server files while the server is in operation?  Or do you need to take the server down, backup the files and then start the server again?  If it's the later, is there any way of automating the process (ie run a batch file to bring down a current server via remote command -> backup the files -> bring up the server again)?

 

I realise this may not be an issue for some servers as the files are sufficiently small that backups would be relatively quick, but large servers do take a while to shutdown and then start again.

Edited by Lichbane

Share this post


Link to post
Share on other sites

My server company I go threw has a backup icon. It auto's every thing. It will start by shutting server down then doing the back up then restarting and it does all this in like 2 mins on a 4096 x 4096 map it is not really that much of a pain.

Share this post


Link to post
Share on other sites

Hosting is not really an option for me.  My map needs 32Gb to run, and since I'd be paying by the the Gb, it's a little pricey.  Otherwise, I'd go that way.

Edited by Lichbane

Share this post


Link to post
Share on other sites
1 hour ago, Lichbane said:

Hosting is not really an option for me.  My map needs 32Gb to run, and since I'd be paying by the the Gb, it's a little pricey.  Otherwise, I'd go that way.

 

Pro tip: Your gonna run out of space REAL quick if you kept all copies of a 32gb map. MOST server owners keep 2 or 3, all the way up to 5 copies of a game at most. 5 is really stretching it too, 2 is the norm. Its usually an automated process too, Backup, auto delete oldest copy, turn server on repeat. 

Share this post


Link to post
Share on other sites

You can backup the binary files while the server is running, it could lead to minor inconsistency if you ever need to restore from them because the server saves changes to the maps in batches, not right away as they happen.

 

IT would be possible to shutdown the server using RMI (not sure if any tool already exists for that, but it would be easy to write), do the backup and start it back from a script. It would be pretty annoying to the players tho.

 

For the databases you can use ".backup" command from sqlite CLI to safely make a copy of the database.

 

For actual storage i'm using duplicity to store the data on google cloud storage, encrypted to a public key that i store offline in 2 safe locations *puts on tinfoil hat*

 

Here's the actual script i use: https://gist.github.com/bdew/7abf2f606aac42982f47

 

The script will auto delete backups older than 10 days, regardless of how many you are running daily. Change the second call to duplicity to match whataever you need if you use it.

Edited by bdew
  • Like 1

Share this post


Link to post
Share on other sites

Thanks bdew.  Good tips.  I'll need to do something automated as currently I'm doing it all manually.

 

I recently invested in a NAS, so backup space shouldn't be a big issue, but I take your point of restricting the number of saves.

 

EDIT: As I'm using Windows, I'm wondering if the following would be sufficient (it's a bit primitive, I know)

Quote

sqlite3 sqlite\modsupport.db .dump > backup\sqlite\modsupport.bak
sqlite3 sqlite\wurmcreatures.db .dump > backup\sqlite\wurmcreatures.bak
sqlite3 sqlite\wurmdeities.db .dump > backup\sqlite\wurmdeities.bak
sqlite3 sqlite\wurmeconomy.db .dump > backup\sqlite\wurmeconomy.bak
sqlite3 sqlite\wurmitems.db .dump > backup\sqlite\wurmitems.bak
sqlite3 sqlite\wurmlogin.db .dump > backup\sqlite\wurmlogin.bak
sqlite3 sqlite\wurmlogs.db .dump > backup\sqlite\wurmlogs.bak
sqlite3 sqlite\wurmplayers.db .dump > backup\sqlite\wurmplayers.bak
sqlite3 sqlite\wurmtemplates.db .dump > backup\sqlite\wurmtemplates.bak
sqlite3 sqlite\wurmzones.db .dump > backup\sqlite\wurmzones.bak
copy *.* backup\*.*
copy logs\*.* backup\logs\*.*

 

If I schedule that to run every 3-6 hours and then have my backup software (that I got with the NAS) to do a full backup, of the backup directory whenever a change occurs, keeping x copies.

 

Should that work ok? 

Edited by Lichbane

Share this post


Link to post
Share on other sites

You're better off using .backup rather than .dump

 

sqlite3 sqlite\wurmzones.db ".backup backup\\sqlite\\wurmzones.db"

(quotes and escaping slashes is important, atleast under windows)

 

That way you get a ready-for-use db file in case you need to ever restore, instead of an SQL file you'd need to import back into a database. It's also probably faster.

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this