Complete Server Mirroring

I am trying to mirror a Centos OS colo server I have. I just recently rented a temp box from my data center to start this project off a bit.

Here is the problem I am running into.
I am trying to use heartbeat and DRBD on both servers to do this unless someone here can provide me a better solution.

>>We will need a fresh partition on each servers so that we can create a DRBD between both the servers on that partition. As we cannot create a DRBD on a live partition as >>it will reinitialize it and will loose the data subsequently
>>Heartbeat can be set up without much prerequisite
>>We will need an external floating IP to be set up by the DC(working by the routers) so that we can assign them to the active server as per need
>>We will need to create internal floating IPs as well, which can be done by us(we will just need an internal IP assigned as well)

Apparently my DC can't provide me with a floating ip.

How can I setup the mirroring. Even if I had two servers in different locations how can I set this up

Who is Participating?
stermeauConnect With a Mentor Commented:

You can install and run DRBD without a floating IP.
The floating is used to have an automatic failover mechanism.
What are you looking for exactly? Is it just a mirror or an hot standy you are trying to setup?
sobeservices2Author Commented:
What do you mean hot stand?

I am trying to set it up as an automatic failover.

This is what one fourm told me

"We will need the floating ip in order to setup heartbeat and drbd on both servers and an alternative to floating ip will be to setup NAT redirection in the iptables which is too complicated and may not work desirably. Also in the event of one server going down, NAT would start not working. In the sense, we need a floating ip to work this drdb and heartbeat."

If I can't get a automatic failover I could I guess use mirroring and if Server A were to fail manual switch to B
arnoldConnect With a Mentor Commented:
You might want to consider the Andrew FS as an alternative to DRBD.

presumably the only thing you would mirror is the data

Are you looking at the centos clustering setup that will move DC provided IP from one node to the other?
The problem is you would have to have access to three IPs or depending on your provider have a private IP between the two server and the DC provided IP as a cluster resource.  The problem though is that as part of the cluster configuration you would need to run a route add script to add the correct routing rules to the active node when the DC provided IP is allocated.
It also depends on what services your system provides.
mysql backend could be setup with master/master replication.
the options are limitless to achieve what I think you want, but depend on what options are available to you from the DC.  
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

sobeservices2Author Commented:
Well my DC said they could provide DRBD that wouldn't be a problem but the floating ip would be sense they are on two different networks.

I am looking for exact 1 to 1 mirroring both boxes have Centos os right now and both boxes have cpanel. So I would want a exact 1 to 1 mirroring going on.

But my devices (servers) are in two separate locations. One's at a DC and one is in house small business office with comcast internet and 5 statics.

Current Server A is Main
Server B is a temp sever

I want to mirror these devices as the first step. The in house server will come in play later down the road.

Usage of the server are for web/email and mysql

arnoldConnect With a Mentor Commented:
The two being in separate location the only way to have a floating IP is if you obtain a range from and then have BGP peering with your providers such that you would control the advertisement of your IP blocks and by extension which server is accessed when someone uses yourip w.x.y.z

Mirroring The server when they are in different location would mean/suggest that the only thing that is mirrored are the data files for the application while the two are functional on their own.

DRBD might be a bandwidth hog and might not be suitable for linking servers in separate locations depending on the cost of data transfer since you'll be paying twice once for the outgoing traffic on one and once for the incoming traffic on the other.

In your situation the only way to control which server is accessed the DC or the  Home, is via DNS control i.e. points to DC_ip. once the DC server is down, you would alter the DNS record for to now point the to your Comcast static IP.
You could have both listed with a short TTL i.e. 60 seconds such that the request will be DNS distributed (DNS loadbalancing)

sobeservices2Author Commented:
OK could I have DRBD setup in a mirrior

Server A - DC
Server B - inhouse

I would change change the NS server information in the event that something fail and traffic would be directed to new server????

Is this correct?

But the DRBD would contently keep these two devices in sync?

Also could I control the DRBD between the two maybe sync on a different type of schedule instead of instant sync to keep bandwidth down if I had to ????
arnoldConnect With a Mentor Commented:
There is an Async option in DRBD, but you run the risk that you switch from one to the other while the data did not propagate.  You also need to determine what you will put on the DRBD volume and what you would replicate through other means.
I.e. database file might be better replicated via the application layer versus via drbd.
sobeservices2Author Commented:
I want mysql replicated , website data, and email

Humm not sure what to do now. confused
arnoldConnect With a Mentor Commented:
mysql replication should be Application level which will provide the option of loadbalancing the access i.e. either side can be accessed and work. DRBD would mean that prior to switching you would need to start mysql and change the DRBD replication direction.

DRBD can be where the web pages are stored as well as the emails provided you are using a Maildir format  (each message in its own file) rather than a mailbox (single file for each user).

sobeservices2Author Commented:
How do I know if I am using Maildir. I use cpanel?

sobeservices2Author Commented:
How about replication of settings for spam program assp and cfs firewall?
arnoldConnect With a Mentor Commented:
you could use rsync since you can not have /etc/ on a replicating volume since most of your system settings are there. If you configure your anti-spam to reference the rules from a different directory than you can use drbd or Andrew FS (AFS) or you can have the rules within a mysql table.
Cpanel is the GUI based system manager tool, what is the backend mail server: sendmail, postfix, exim, qmail, etc. where are the emails stored? Look within that directory structure to see if it has the forma directory_name with new, cur and tmp subfolders where new and cur have individual message files.
sobeservices2Author Commented:
Ok here is what I think I am going to do

Server A (main server old) called
NS Server - ns1/ns2
8 Statics for about 8 websites

Server B (temp server) called
NS Server - n1/n2
8 Statics for about 8 websites

What I think I am going to do first is copy all the information from Server A to Server B which I already have done.
Setup a DRBD between both servers.
I guess I will not be able to have failover but atleast I will have both servers syncing content websites/ email/ cpanel stuff / spam settings/ mysql/ etc

Sence Server A will have a different ns domain name as server B
When I get ready to pull Server A out I will switch the NS in my register to the name server of server B

Run off of server B till I get a chance to build my new server up. Once I have built my new serve up with Centos OS 5.5 64 bit and cpanel.
I will also place DRBD on the new server.

Could I then manually copy the data and settings from temp Server B over to the new server?
Or can I use DRBD to copy and mirror the stuff back over?

Once everything is copied to new server which I will assign the same domain name ns info of the server I just pulled offline.
I will have the new server fully operational and ready

Then I will go back into the register settings and change the ns server to point back to the new box.

Please advise and make suggestions on the above and let me know if this is an easy doable solution
DRBD needs available unallocated/unused space on the local harddrive.
Are currently server A and server B production?

I'd recommend you setup two servers as you think you would server A and serverB and test your procedure.

You could use VM to test this setup with VMWARE or VirtualBox.
sobeservices2Author Commented:
Currently Server A is production but will not have the DRBD. Server B is not production yet but will add DRBD to the device and the new server down line
arnoldConnect With a Mentor Commented:
You should test the implementation that you are envisioning so that you know the approximate bandwidth/other issues that might come up.
IMHO, application level replication should be used when possible especially with mysql (note monitoring is needed to make sure the replication is functioning and issues can be detected early) this way you can load balance since you could write and read from either database server.

The optimal solution could revolve around implementing different features for different items.
Have a look at the Andrew FileSystem (AFS) and see whether file replication is better than the low level block replication that DRBD is offering in some cases it is and in some cases it is not.
sobeservices2Author Commented:
Ok thanks guys..

IMHO what does this mean?

I will look more into AFS lots of commits about that I've only gone into detail on DRBD
Could I use a little of both maybe???
In My Humble Opinion.

You could use AFS and DRBD but simplification if available is encouraged.
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.

All Courses

From novice to tech pro — start learning today.