How to configure a distributed file system with replication using GlusterFS

Distributed file system between multiple servers is a thing I have planned for a long time, but I never got around to it because I first had to find the right filesystem for it.
After a lot of research, I found that GlusterFS was the right file system for me.
My plan was to use a distributed filesystem to share the content of my webservers to make sure all my webservers had the same content on their pages at all time and using some sort of high availability to make sure the content was always there.
To this I used a tool in Linux called Lsyncd before I set up my GlusterFS cluster, this worked well and did live syncing of all the servers using rsync. But there was one problem with it.
If I uploaded a lot of files (20+) to one webserver, and it started to sync to the other webserver before I was finished copying, the result would be that some of the files ended up corrupt, and this was a problem for me!

My distributed file system overview

Here is the overview of the setup I am making, it’s not pretty but I’m sure it’s a lot more easy to explain the setup using a simple mspaint drawing than with text!
GlusterFS distributed file system overview
As you can see in the picture above, I have build this with high availability in mind, since I want my websites to always be up and running!
Continue reading

Upgrading Debian Squeeze server to Debian Wheezy server

My web and others servers was set up on Debian Squeeze about a year ago. and they have been working great. But it thought it was about time to upgrade all my Debian servers to Wheezy instead so I could get some newer updates for packages and in general be up-to-date.
Here is the simple, fast and trouble free way I did it.
Continue reading

Rsync tips and tricks

This post is about tips and tricks for Rsync.
Rsync is a great tool used by many for backup, or just copying data from one server to another and even for local copying of multiple files or syncing folders.
In this post I will show you some examples of what I use rsync for every day
Normally you would use the rsync program like this, to copy files from one folder to another:

rsync -zrav /source/dir/ /destination/dir

What does the parameters do?
z = Compress the data stream, this can improve performance if you copy from one server to another over the network
r = recurse into directories
a = Keep the attributes, this is for example the timestamp on which the file was last modified, or created.
v = Verbose, this just makes sure you see some helpful info while it copies.
If you want to sync and folder to another server via. ssh. you can use the following:

rsync -zrav /local/source/dir/ root@remote-server:/destination/dir/on/remote/server/

There are some other useful parameters you can append to the commands above. Here are some examples that I use a lot:
Continue reading

D-link DP-101 or other print server IP reset

So you found an old D-link DP-101 or other printer server that you need to use, but don’t know what static IP address you gave it years ago?
The solution is simple.
This also on other D-link print server models, if you did this on models that are not listed below, please leave a comment so i can add them.
Verified to work with:

  • DP-101
  • DP-101P+
  • DP-300U

The D-link Dp-101 is a stable parallel to network print server, but it does not have the feature of a “Reset to default settings” hardware button anywhere. If you want to reset the device to default, or change the IP address without knowing what it is now, you have to do it with D-link’s tool, and it only works on 32Bit computers!
Here is how you do it, with link to the software
Continue reading

Belkin F5U103V serial to USB converter on Windows 7 64Bit

Update: I have not tested this on Windows 8, but it should work. If anyone does this on Windows 8 (i don’t have a Windows 8 machine laying around), please leave a comment to verify if it works or not.
Yes, this post is about Windows!
I had a problem yesterday, and thought I should post my solution since I had a hard time getting it to work and it might help others.
I have a D-link DGS-3324SR rack switch for my servers, and it had some random IP address on the configuration interface that I was not able to find, and I needed to get into the switch to configure some vlans.
I thought “That’s easy, just connect to the console port and thats it”, but then i came home to notice that none of my computers have a serial (RS323) port!
I then found a serial (RS323) to USB converter at work, the Belkin F5U103V and borrowed it for the day, but when i got home and plugged it into a Windows 7 64Bit laptop I noticed that there was no driver found for the device.
Continue reading

Convert multiple JPG or PNG to PDF in Linux

I think we all have been in the situation before, you have some scanned documents in JPG or PNG format that you need to convert into a PDF file.
There are many solutions for this on the internet, including free sites that just does it for you if you upload your images, but they almost always put some kind of watermark on the pages if you don’t pay them.
There are also a bunch of Windows applications that do this, but they are often complicated or full of ads.
This guide show you a free solution on Linux, that just works, is fast, and does not add any crap to the PDF.
Continue reading

Temperature measuring using Linux and Raspberry Pi

The story

I have a small server room, with some rack servers, NAS’s, VMware ESXi’s and other fun stuff, but I had one problems.. in the summer it got really hot, and I had to open the window to let fresh air in, and the old out to lower the temperature again, but I never knew when it was too hot, so i had to drive by the server room once or twice a day to manually feel if it was too hot..
This was a problem, because sometimes I was not home, or sometimes I forgot, or just had no time to drive by to check the temp.
Having a temperature sensor in the room, from a freezer or something like that didn’t help me much, since I still had to drive by to check it manually.
So I had to make something I was able to get the room temperature from, over the internet/lan, and thats when I decided to make my network thermometer.
I looked for weeks on the internet for a good guide about this, but none of them worked. so I decided to write my own to help others with the same problem out.

This post will be about

How to make your own network thermometer, using open source software and a cheap USB temperature sensor!
Continue reading