Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2012, 05:50 AM
ShaunVW ShaunVW is offline
Junior Member
 
Join Date: Feb 2012
Posts: 9
Default MySQL Cluster

I am wanting to set up a MySQL cluster. The setup will be 2 mngt nodes, 2 SQL nodes and 2 data nodes, each data and SQL node will share the same PC, i.e. in total I will have 4 PCs in the full setup.

Currently I have a MySQL server to which I set up an ODBC connector with the IP address of the server. However, when it comes to the cluster setup, how do I choose which SQL node's IP address to choose in the ODBC connector? My understanding is that if one SQL node goes down, then it would/should seamlessly be able to transfer all requests to the other SQL node still running, however, how does the application actually know "where" the other node is? Do I code it into my application? Because what if I add more SQL nodes, do I then have to re-code to account for these extra nodes? Or do I just maintain some kind of a list that the application accesses? Or is it set up in the actual cluster itself?

Sorry, I know that this might be Delphi related, or it could be MySQL setup related, so not sure where to ask the question.
Reply With Quote
  #2  
Old 04-12-2012, 01:48 PM
ShaunVW ShaunVW is offline
Junior Member
 
Join Date: Feb 2012
Posts: 9
Default

I have now managed to set up my cluster, hope that it might help others how I did it. I am still having some issues, and hope someone can advise me.

I eventually went with 3 PC's, one the mgnt node, the other 2 each having a data and sql node on them.
Then in my application, instead of setting up a permanent data link (Control Panel), I still need to install the MySQL connector, but I now make use of 2 datalink files (UDL extentention). Then in my application, each time I want to access my MySQL database, I first make a call to a function to check connectivity to the one of the two PC's. If it doesn't succeed, I then call the second. This is my function:

Code:
function TmainForm.connectedToClusterServer():Boolean;
var
 query : String;
begin
 //Check for cluster connection
 with clusterADOQuery do
  begin
   Active := FALSE;
   try
    ConnectionString := 'FILE NAME=MySQLNode1.udl';
    SQL.Clear;
    query := 'SELECT 1';
    SQL.Add(query);
    Open;
    status1Label.Caption := 'Using primary node';
    status1Label.Font.Color := clGreen;
    result := TRUE;
    except
     try
      ConnectionString := 'FILE NAME=MySQLNode2.udl';
      SQL.Clear;
      query := 'SELECT 1';
      SQL.Add(query);
      Open;
      status1Label.Caption := 'Using secondary node';
      status1Label.Font.Color := clBlue;
      result := TRUE;
      except
       status1Label.Caption := 'No connection';
       status1Label.Font.Color := clRed;
       result := FALSE;
     end;
   end;
  end;
end;
The try/except statement catches the exceptions that will get raised if no connection exists, or error updating a table, however, it doesn't seem to catch "temporary server error..." messages coming through, with the effect that my program stops until the dialog box is cleared.
I can't seem to do anything about these temporary errors anyway, so how can I get my program to not even display them. (this is why I tried it in a try/exception block)
Thanks.
Reply With Quote
  #3  
Old 04-16-2012, 04:56 AM
ShaunVW ShaunVW is offline
Junior Member
 
Join Date: Feb 2012
Posts: 9
Default

Does no-one have any advice/suggestions for me?
Even thoughts?
Reply With Quote
  #4  
Old 04-16-2012, 07:19 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 6,775
Default

Nope, I'm a MSSQL user, therefor I cannot even give you any advise on this...

Perhaps there's a specific error class that is used for the no connection exists error, which you need to trap besides the E:Exception
Reply With Quote
Reply

Tags
cluster, mysql, odbc

Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 02:13 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.