Home » 2014 » February

Using rsnapshot for daily PostgreSQL backups

Having done backups for MySQL using rsnapshot before I recently had to do the same thing for PostgreSQL. Turns out PostgreSQL has similar tools to do this and it’s actually quite easy to set it up.

First, assuming rsnapshot will run under the root user you’ll need to create a .pgpass file at /root/.pgpass that will hold the credentials that are required for setting up a connection with your database. The expected format is host:port:database:user:password, so for example:

localhost:*:mydbname:myusername:mypassword

With that in place create a shell script that will use this file and run the pg_dump program. Put it some place you can remember, e.g. /usr/local/bin/postgresql-backup.sh:

#!/bin/bash
export PGPASS=/root/.pgpass
pg_dump -w -h localhost -U myusername mydbname > postgresql-dump.sql
gzip postgresql-dump.sql

Again, just as with the using rsnapshot for daily MySQL backups article you need to configure rsnapshot.

Next is setting up /etc/rsnapshot.conf which is easy as well. At the end of this file you’ll find all the instructions of which directories to backup. Enter the next line. Do note that rsnapshot.conf uses a tab to separate values.

backup_script   /usr/local/bin/postgresql-backup.sh  postgresql/

To enable daily backups uncomment the next line:

#interval       hourly  6
interval        daily   7
#interval       weekly  4
#interval       monthly 3

To make rsnapshot run every day update /etc/cron.d/rsnapshot:

# 0 */4         * * *           root    /usr/bin/rsnapshot hourly
  30 3          * * *           root    /usr/bin/rsnapshot daily
# 0  3          * * 1           root    /usr/bin/rsnapshot weekly
# 30 2          1 * *           root    /usr/bin/rsnapshot monthly

Finally, try running rsnapshot. After it has run check your backup directory, which on Ubuntu 12.04 defaults to /.snapshots/. Be sure to mount /.snapshots/ on a separate drive. Because what use is it if your data drive contains your backup and decides to commit suicide?

$ sudo rsnapshot daily

Your PostgreSQL backup file should now be located at /.snapshots/daily.0/postgresql/postgresql-dump.sql. You can restore this file with the psql commandline utility.

Which 2013 tablet is the best for gaming?

Just in the nick of time Apple has launched the new iPad mini 2 with retina display (to give it its full official name) to enable us to declare it the best 2013 tablet for gaming. Just a little time ago we declared that the award should go to the Nexus 7, but at that time it seemed as if the iPad Mini 2 wouldn’t appear until sometime in the New Year. The Nexus is a great tablet for gaming, and in terms of specifications there is little to choose between it and the new iPad Mini 2, however the build of the iPad Mini 2 is so much better than that of the Nexus 7 that it wins hands down. Naturally the iPad mini 2 with retina display is somewhat more expensive, but then you don’t get a sleek machined aluminium case for peanuts. With a price tag of £320 for the entry level model the iPad Mini 2 is no toy, but you never know, with a little luck you might find one in your Christmas stocking.

Although the new iPad Mini 2 might be considered to be overkill for gamers whose main interest in games is Angry Birds or who enjoy playing blackjack and poker at an online casino such as Lucky Nugget’s Australian casino for example. Admittedly those kinds of games are not as demanding as some of the high end console type games which are now available for iOS and Android operating systems. The problem is though that once you pick up and use the new iPad mini 2 with retina display it is very difficult to put it down again. You can get by with less, but do you really want to? You might need to pay a little more, but then you are paying for quality.

The new iPad Mini 2 marks a new beginning for hand held tablet gaming. It certainly deserves the awards as the best 2013 gaming tablet and surpasses its main rival, the Nexus 7, but a large margin in terms of build quality and ergonomics.

Getting close to launching HTML2PDF Web Service!

For the last couple of months I’ve been busy developing HTML2PDF Web Service. Due to some setbacks I had to postpone its launch. The way it’s looking now I’ll be ready to launch by the end of the month.

So what had to change?

  • I had to switch from Payment Service Provider, which is done now. Instead of only credit cards I’m now supporting PayPal, iDEAL, Paysafe Card and Mister Cash. Credit Card support should come back later. Instead of recurring subscriptions you can now buy up to 1 year of access in advance. This is due to not being able to support recurring subscriptions anymore because of the PSP switch.
  • The website is now multilingual: currently supporting English and Dutch. Both have their own domain names. I’ve done this to get a better position in the Dutch market.

All that’s left now is changing the way token usage is being calculated and it should be all set to go. The HTML2PDF Web Service is still in beta, so feel free to try it out. Once the web service is out of beta I’ll do another post here with a follow up on used technology (Perl, Go and more!).

 

File Joiner for .001 files

Earlier this week I was in need of a file joiner for .001-files (and .002, .003 etc.). I always though I could do this with WinRAR but that didn’t do the trick. I know Quickpar can do it as well but it requires the .svf-file. I’ve also done it using the command line (I think it was with cat) but only using Linux, not sure how to do it using the Windows command line. Thankfully there’s also File Joiner! A simple application where you select the files or a folder containing the .001-files and then simply let the application join the files.

Ordered a Nexus 7 tablet

Nexus-7-2013I just ordered a Nexus 7 (2013) tablet for a really nice price. I plan on using it for Android development and website testing. Together with my iPad 3 and Android phone this should cover a wide range of test cases. Now to decide if I should go with Xamarin C# or stick with Java…

Since I’m note a big fan of Java I’m leaning towards Xamarin but the yearly subscription costs are a bit steep if you’re not actually generating money out of mobile stuff. Still, with Xamarin it’s easier and maybe cheaper in the sense of time to develop for both Android and iOS since you can write the core of your application in C# and use that on both target platforms.