Connector/J 5.1.30 is out with Fabric support

Today marks the release of several exciting pieces of software from Oracle. In addition to MySQL server 5.7.4 DMR, MySQL Fabric is out as a release candidate 1.4.2 and Connector/J 5.1.30 has full support. MySQL Fabric is a new way to implement high-availability and scale-out with MySQL server. It provides a way to group sets of servers into high-availability groups with automatic replication configuration. If scale-out is important, sharding can be defined in terms of these high-availability groups.

To use Connector/J with Fabric, you only need to add the jar to your classpath. If you are still using Java 5, you will need to manually load the com.mysql.fabric.jdbc.FabricMySQLDriver class to register the driver. Fabric-aware connections are made with a JDBC URL of the form jdbc:mysql:fabric://host:port/db. Several connection properties are available to influence the behavior of Fabric-aware connections. You can find the documentation for them at Connection Properties. Fabric-aware connections also expose a separate API called FabricMySQLConnection.

Connector/J supports both high-availability configurations and sharding on top of them. A basic high-availability configuration would consist of several servers in a master-slave configuration all belonging to the same group in Fabric. Connector/J can create a Fabric-aware connection to this group and send all writes to the master and load-balance between the slaves for all reads. This type of connection can be made by specifying the fabricServerGroup connection property or using the setServerGroupName() method in the FabricMySQLConnection API.

To implement a Fabric-aware connection with a sharded setup, you would typically specify the table name with the fabricShardTable connection property and use the setShardKey() method of the FabricMySQLConnection API to choose a shard. If the shard key is not provided, or set to null, all queries will be sent to the global group associate with the chosen shard table. If you only need to access a single shard for the duration of a connection, you can just as easily specify the fabricShardKey as a connection property. It doesn't become fixed for the duration of the connection, so you can also use it as a default if most connections won't need to change it.

There are plenty of other ways to use connection properties and APIs to interact with Fabric. You can find the full Connector/J documentation for Fabric-aware connections at Using Connector/J with MySQL Fabric. There are also several demos in the Connector/J source under the src/demo/fabric directory. Check out other resources available at:

 

Do you want to participate?

There is a lot you can do if you want to help improve MySQL Fabric.

Blogs about MySQL Fabric

 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

MySQL and Java

Search

Categories
Archives
« April 2015
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  
       
Today