![]() |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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;
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. |
|
#3
|
|||
|
|||
|
Does no-one have any advice/suggestions for me?
Even thoughts? |
|
#4
|
|||
|
|||
|
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 |
![]() |
| Tags |
| cluster, mysql, odbc |
| Thread Tools | |
| Display Modes | |
|
|