LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-19-2016, 01:56 AM   #1
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Rep: Reputation: 0
Database replication for High Availability Standby system


Hi all,

I am making a standby High Availibility system with 2 nodes using Pacemaker, Corosync and PCS. The resource is an Apache webserver with SQL database storing dynamic values from a program. This program is running simultaneously on both the PCs and populating their respective databases.

Now, I have to set up a failover mechanism for database. For example, if the main fails and standby takes over, and the main recovers after that, how will the SQL database of main will synchronise with that of standby at bootup.

Regards
 
Old 04-19-2016, 03:25 AM   #2
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

There are several things to consider that might lead to different but still "working" solution while looking at your problem.

From a HA perspective, you have your apache resource that is handled by pacemaker, so I guess that you also have a filesystem resource for the folder /var/www.
So, you can also have shared filesystem (gluster or clvm) for your database data (normally /var/lib/pgsql if you are using PostgreSQL).

Or you can look at the native mechanism of your database engine.
All recent and decent database engines should have that.
 
Old 04-19-2016, 03:37 AM   #3
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tshikose View Post
Hi,

There are several things to consider that might lead to different but still "working" solution while looking at your problem.

From a HA perspective, you have your apache resource that is handled by pacemaker, so I guess that you also have a filesystem resource for the folder /var/www.
So, you can also have shared filesystem (gluster or clvm) for your database data (normally /var/lib/pgsql if you are using PostgreSQL).

Or you can look at the native mechanism of your database engine.
All recent and decent database engines should have that.
Thanx Tshikose, but am really a noob in this matter and didnt quite get what u wanted to imply. Can u please give me some more details or references please.

Regards
 
Old 04-19-2016, 03:42 AM   #4
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

Basically you have two choices for your database high availability.
You can rely on HA with pacemaker, or on the own database replication capabilities.
What is yours?

Which database engine are you using?
 
Old 04-19-2016, 03:44 AM   #5
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tshikose View Post
Hi,

Basically you have two choices for your database high availability.
You can rely on HA with pacemaker, or on the own database replication capabilities.
What is yours?

Which database engine are you using?
I have some experience with SQL DB so will use that sir.
 
Old 04-19-2016, 04:35 AM   #6
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

While there are plans form Microsoft to port MS SQL Server to Linux, that will not happen before next year.
So, I doubt that your experience with MS SQL Server will be of much help.
At least SQL is SQL everywhere, so there are similarities, but also big differences.

My understanding was that you already have running system for which you wanted to add HA.
Now, it seems as if you are not yet there.
If you can I advise you to use Postgres as database engine.

What is your experience with Linux HA?
 
Old 04-19-2016, 04:45 AM   #7
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
I have never worked on postegres SQL before but if its advisable...ill shift on that.
I have successfully setuo my cluster on 2 nodes with httpd apache resource and its working fine.
Now i have to include the database part and make the webpage dynamic.
 
Old 04-19-2016, 05:00 AM   #8
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

That is good.
Try to build a Postgres resource similar to httpd with a shared folder /var/lib/pgsql.
I have never done that (just because I never came in a situation where I needed to build a HA DB), so I am just sharing guidelines.
 
Old 04-19-2016, 05:02 AM   #9
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
Thanx sir,
Ill try doing that.
Do u have any reference or tutorial for this?

Regards
 
Old 04-19-2016, 05:11 AM   #10
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Official Red Hat Enterprise Linux 7 documentation. Look at Clustering section.
 
Old 04-21-2016, 01:48 AM   #11
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tshikose View Post
Official Red Hat Enterprise Linux 7 documentation. Look at Clustering section.
Sir I had a look at the documentation.

I have a small doubt regarding my scenario.

I have the same application running in 2 PCs - one main and one standby - and this application is updating the SQL DB and same is queried by the client via a webpage.
The solution given in the documentation replicates the main DB into standby DB at all times whereas my requirement is of replication only once when the main system recovers from a failover and need to replicate data from standby for the time it was down.

Is there a solution for this kind of scenario sir?

Regards
 
Old 04-21-2016, 01:57 AM   #12
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

Database replication generally involves huge data.
So, trying to start a replication when a failover occcurs is not pratical. The replication time will just take long enough, keeping the service unavailable, and then defeating the goal of HA.
You need to permanently replicate the data between your two database instances. Like that when a failover occurs, just few not yet replicated data need to be shipped across.

Googling a little for "Linux Postgres replication" gave me this.
 
Old 04-21-2016, 02:04 AM   #13
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tshikose View Post
Hi,

Database replication generally involves huge data.
So, trying to start a replication when a failover occcurs is not pratical. The replication time will just take long enough, keeping the service unavailable, and then defeating the goal of HA.
You need to permanently replicate the data between your two database instances. Like that when a failover occurs, just few not yet replicated data need to be shipped across.

Googling a little for "Linux Postgres replication" gave me this.
Will this take care of my HA needs too?
I mean, with this implemented, if my main system goes down then the client will be automatically redirected to standby database or do i still need to implement HA using pacemaker and corosync sir?
 
Old 04-21-2016, 02:14 AM   #14
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

Yes, I think that you can have a pgsql resource managed by your HA pacemaker.
And if the database information normally located in /var/lib/pgsql/data iis well synced by the Postgres replication, then the pgsql resource should take over where the previous left.
 
Old 04-21-2016, 02:17 AM   #15
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0
Sir can u pls explain this point...its making some sense but not fully understood by me...sorry for the trouble.
 
  


Reply

Tags
database, replication



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: High Availability - Real Time Data Replication Across Multiple Nodes using GlusterFS On Centos LXer Syndicated Linux News 0 05-22-2013 07:01 PM
LXer: How To Install Repcached (Memcached Replication) For High-Availability Over 2 Nodes On Ubuntu LXer Syndicated Linux News 0 09-30-2011 12:30 PM
How to build a redundant, high-availability File Server system manya Linux - Server 3 03-24-2010 05:07 AM
[SOLVED] Linux high performance and high availability clustering Blue_Ice Linux - Software 2 03-27-2009 04:49 AM
Replication + High Availability !! varungupta_82 Linux - General 0 02-28-2004 01:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration