Within a Continuent Tungsten Cluster installation, the connector receives its cluster configuration directly from the managers. It is NOT desirable to change it, there are high risks of destabilizing the cluster, creating split brains or writing data to replicas.
For this reason, if the Proxy is connected to a cluster, a confirmation flag ?i-am-sure=true
will
have to be passed to the following call examples.
For standalone proxies cluster configuration changes are accessible without the confirmation flag.
To create a data service name "europe"
POST 'https://127.0.0.1:8096/api/v8/services/europe'
Adding a data source requires the following call with a payload of type TungstenPropertiesPayload
POST 'https://127.0.0.1:8096/api/v8/services/europe/datasources' { "payloadType" : "DataSourcePayload", "payload" : { "name" : "db5", "dataServiceName" : "europe", "isAvailable" : true, "role" : "slave", "host" : "db5", "state" : "ONLINE", "driver" : "org.drizzle.jdbc.DrizzleDriver", "url" : "jdbc:mysql:thin://db5:13306/${DBNAME}?jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&allowMultiQueries=true&yearIsDateType=false", "isComposite" : false } }
No validation of the data source will be performed when creating it. Errors, if any, will appear when using/connecting-to the data source
A cluster configuration, called "data services map", can be passed through a single call to
POST 'https://127.0.0.1:8096/api/v8/connector/service-map'
The cluster map may look like the following example:
{ "payloadType": "DataServicesMapPayload", "payload": { "europe": { "c1": { "dataServiceName": "europe", "name": "c1", "isAvailable": true, "role": "master", "host": "c1", "state": "ONLINE", "url": "jdbc:mysql:thin://c1:13306/${DBNAME}?jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&allowMultiQueries=true&yearIsDateType=false", "isComposite": false, "driver": "org.drizzle.jdbc.DrizzleDriver" }, "c2": { "dataServiceName": "europe", "name": "c2", "isAvailable": true, "role": "slave", "host": "c2", "state": "ONLINE", "url": "jdbc:mysql:thin://c2:13306/${DBNAME}?jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&allowMultiQueries=true&yearIsDateType=false", "isComposite": false, "driver": "org.drizzle.jdbc.DrizzleDriver" }, "c3": { "dataServiceName": "europe", "name": "c3", "isAvailable": true, "role": "slave", "host": "c3", "state": "ONLINE", "url": "jdbc:mysql:thin://c3:13306/${DBNAME}?jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&allowMultiQueries=true&yearIsDateType=false", "isComposite": false, "driver": "org.drizzle.jdbc.DrizzleDriver" } } } }
The same REST API entry point can be used with the HTTP PUT method to modify the current cluster configuration. Bringing a node
offline can be done by passing a data source configuration and setting the flag "isAvailable": false
Similarly, a full "switch" operation will be accomplished by exchanging the "roles", giving the new primary the "master"
role, and the replica "slave"
. Note that, just as Tungsten Clustering does, you might want to first set both nodes to
"isAvailable": false
before proceeding to the role change.