...
This page explains how to point WSO2point WSO2AM_CARBON_DB into a MySQL cluster (NDB), as Fail Over.
After creating the database in a MySQL cluster, modify the default datasource configuration datasourceconfiguration in the
<APIM_HOME>/repository/conf/datasources/master-datasources.xml
file. Replace the URL, username, password, driver class name and any other values with your custom values.Code Block language xml <datasource> <name>WSO2_CARBON<name>WSO2AM_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2CarbonDB<WSO2AM_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://192.168.43.238.58.215:3306,192.168.58.216:3306/carbondb?WSO2AM_DB?autoReconnect=true&relaxAutoCommit=true&?autoReconnect=true<&useSSL=false&failOverReadOnly=false</url> <username>root</username> <password>root123</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Connection URL should be in the below format for Fail Over Configuration.
Code Block <url>jdbc:mysql://[primary_mysql_node_IP]:[port],[secondary_mysql_node_IP]:[port]/[DB_Name]?autoReconnect=true&relaxAutoCommit=true&useSSL=false&failOverReadOnly=false</url>
- Copy the MySQL JDBC driver library into
<APIM_HOME>/repository/components/lib
directory. - To create the related API Manager database tables related to the user store and registryin the MySQL cluster databse, execute the cluster script located inside the
<APIM_HOME>/dbscripts/apimgt/mysql_cluster.sql
file. If you prefer to create database tables during server startup, replace the content of the
<APIM_HOME>/dbscripts/mysql.sql
file with the content of the<APIM_HOME>/dbscripts/
file and start the API Manager instance withapimgt
/mysql_cluster.sql-Dsetup vm argument
.Note Note that we recommend to useFail Over configuration with the MySQL cluster, over Load Balaced configuration