MySQL Forums
Forum List  »  NDB clusters

Re: mysql cluster .NET connector
Posted by: Fernando Gonzalez.Sanchez
Date: April 12, 2013 12:08PM

Hi

In Connector/NET we have load balancing built-in available as of Connector/NET 6.7 (currently in its second alpha 6.7.1, available here http://dev.mysql.com/downloads/connector/net/6.7.html).

To enable a simple scenario, you need to configure either replication or clustering in the MySql backend.

Then you need to state the backend topology in the .NET configuration file that is going to use a Connector/NET enabled for load balancing (6.7.x):

The following is an example of the sections required to be added to the app.config file in order to use the replication/load balancing functionality:


<configuration>
...
<configSections>
<section name="MySQL" type="MySql.Data.MySqlClient.MySqlConfiguration, MySql.Data, Version=6.7.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</configSections>
...
<MySQL>
<LoadBalancing>
<ServerGroups>
<Group name="Group1">
<Servers>
<Server name="master" IsMaster="true" connectionstring="server=localhost;port=3306;uid=user;password=pass;"/>
<Server name="slave1" IsMaster="false" connectionstring="server=localhost;port=3307;uid=user;password=pass;"/>
</Servers>
</Group>
<Group name="Group2">
<Servers>
<Server name="slave1" connectionstring="server=localhost;port=3306;uid=user;password=pass;"/>
<Server name="slave2" IsMaster="false" connectionstring="server=localhost;port=3307;uid=user;password=pass;"/>
<Server name="slave3" IsMaster="false" connectionstring="server=localhost;port=3308;uid=user;password=pass;"/>
</Servers>
</Group>
</ServerGroups>
</LoadBalancing>
</MySQL>
...
</configuration>

In order to reference a "group" of servers to use load balancing, it must be referenced in the connection string using the server attribute:

"server=Group1;"

By opening a connection using this connection string will assume the pair master/slave;

The configuration group Group1 assumes that replication of two servers (the slave means read only in the context of Connector/NET load balancing and master means both read/write).

In your case of using clustering, you can put all servers as master.


IMPORTANT NOTE: Configuration section in App.config file must include the assembly full name in order to run or copy the assembly into the same folder as the executable.

Options: ReplyQuote


Subject
Views
Written By
Posted
2778
April 09, 2013 01:05PM
Re: mysql cluster .NET connector
2206
April 12, 2013 12:08PM
1645
April 15, 2013 02:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.