Hi Saul,
(Please reply to the mailinglist too)
Saul Waizer wrote:
> Geert,
>
> I have a php web application that uses a regular connection string to the
> mysql node1, I have no idea how to really “use” the cluster, right now
> everything is being sent to one node, but if that node fails there is no
> true redundancy unless I point the connection to the second node
>
> NODE1 <----> NODE2
> |
> |
> V
> APPLICATION
Check out this URL and the diagram there:
http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-overview.html
What you probably have is:
DATANODE <---> DATANODE
|
|
MYSQL NODE
|
|
Application
> According to this diagram if node one fails the application will fail as
> well because the connection string is directed to node1
You can't make your Application connect to a particular data node, only to a
MySQL node. It's important to always mention what kind of node you are
talking about, as there are 3 types :)
Your application is connecting to a 'MySQL node' (or 'API Node'). This MySQL
node will then connect to one of the 'data nodes'.
If you have 2 data nodes and NoOfReplicas=2, then you data nodes are
redundant: if one fails, your cluster will still be up! No need to do much here.
Again, you will need to do some load balancing or fail-over on MySQL nodes
level. Add a second MySQL node and make it connect to the cluster. Then you
have couple of options:
- your application connects to one, if the connection fails to the first
MySQL node, it should use the second one.
- you run your application on both machines where MySQL nodes are running,
and load balance between them
- you load balance between the MySQL nodes and make your application only
connect to the load balancer, which should handle also the fail-over.
I would use second option, as you have your application redundant as well then.
Cheers,
Geert
--
Geert Vanderkelen, Support Engineer
MySQL GmbH, Germany, www.mysql.com
Hauptsitz: MySQL GmbH, Radlkoferstr. 2, D-81373 München
Geschäftsführer: Hans von Bell, Kaj Arnö - HRB München 162140