Solved

Complete Server Mirroring

Posted on 2011-02-14
18
397 Views
Last Modified: 2012-06-27
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

0
Comment
Question by:sobeservices2
  • 9
  • 8
18 Comments
 
LVL 5

Accepted Solution

by:
stermeau earned 72 total points
ID: 34888834
Hi,

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?
Regards
0
 

Author Comment

by:sobeservices2
ID: 34888916
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
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 428 total points
ID: 34888921
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.  
0
 

Author Comment

by:sobeservices2
ID: 34889055
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

0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 428 total points
ID: 34891655
The two being in separate location the only way to have a floating IP is if you obtain a range from arin.net 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. www.yourdomain.com points to DC_ip. once the DC server is down, you would alter the DNS record for yourdomain.com to now point the www.yourdomain.com 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)

0
 

Author Comment

by:sobeservices2
ID: 34892137
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 ????
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 428 total points
ID: 34892748
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.
etc.
0
 

Author Comment

by:sobeservices2
ID: 34892792
I want mysql replicated , website data, and email

Humm not sure what to do now. confused
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 428 total points
ID: 34892876
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).

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:sobeservices2
ID: 34892967
How do I know if I am using Maildir. I use cpanel?

0
 

Author Comment

by:sobeservices2
ID: 34892971
How about replication of settings for spam program assp and cfs firewall?
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 428 total points
ID: 34893459
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.
0
 

Author Comment

by:sobeservices2
ID: 34897019
Ok here is what I think I am going to do

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

Server B (temp server) called domain2.com
NS Server - n1/n2 domain2.com
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
0
 
LVL 76

Expert Comment

by:arnold
ID: 34897133
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.
0
 

Author Comment

by:sobeservices2
ID: 34897303
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
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 428 total points
ID: 34898088
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.
0
 

Author Comment

by:sobeservices2
ID: 34899385
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???
0
 
LVL 76

Expert Comment

by:arnold
ID: 34900059
In My Humble Opinion.

You could use AFS and DRBD but simplification if available is encouraged.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now