0

I have tried to use MySQL Master/Slave cluster in WSO2 cluster deployment, but failed when startup. Does WSO2 only support MySql Share-Nothing cluster? How does it support MySQL Master/Slave?

My datasource was configured as below:

<datasource>
        <name>WSO2REG_LOCAL</name>
        <description>The datasource used for registry</description>
        <jndiConfig>
            <name>jdbc/WSO2REG_LOCAL</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql:replication://wso2dbmaster:3306,wso2dbslave1:3306,wso2dbslave2:3306/WSO2_REG_LOCAL_AM_GW_MGR_1?roundRobinLoadBalance=true;autoReconnect=true;</url>
                <username>test</username>
                <password>test</password>
                <driverClassName>com.mysql.jdbc.ReplicationDriver</driverClassName>
                <defaultAutoCommit>false</defaultAutoCommit>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>
    <datasource>
        <name>WSO2REG_DB</name>
        <description>This shared datasource used for registry</description>
        <jndiConfig>
            <name>jdbc/WSO2REG_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql:replication://wso2dbmaster:3306,wso2dbslave1:3306,wso2dbslave2:3306/WSO2_REG_DB?roundRobinLoadBalance=true;autoReconnect=true;</url>
                <username>test</username>
                <password>test</password>
                <driverClassName>com.mysql.jdbc.ReplicationDriver</driverClassName>
                <defaultAutoCommit>false</defaultAutoCommit>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>

registry.xml was configured as below:

<currentDBConfig>wso2registry</currentDBConfig>
<readOnly>false</readOnly>
<enableCache>true</enableCache>
<registryRoot>/</registryRoot>

<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2REG_LOCAL</dataSource>
</dbConfig>

<dbConfig name="sharedregistry">
    <dataSource>jdbc/WSO2REG_DB</dataSource>
</dbConfig>

<remoteInstance url="https://localhost:9443/registry">
    <id>instanceid</id>
    <dbConfig>sharedregistry</dbConfig>
    <readOnly>false</readOnly>
    <enableCache>true</enableCache>
    <registryRoot>/</registryRoot>
    <cacheId>wso2db@jdbc:mysql:replication://wso2dbmaster:3306,wso2dbslave1:3306,wso2dbslave2:3306/WSO2_REG_DB?roundRobinLoadBalance=true;autoReconnect=true;</cacheId>
</remoteInstance>

Exception occurred as below when starting up.

TID: [0] [AM] [2015-03-09 13:30:51,728] ERROR {org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent} -  Unable to create fixed remote mounts. {org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent}

org.wso2.carbon.registry.core.exceptions.RegistryException: An exception occurred while executing handler chain. null .... ID: [0] [AM] [2015-03-09 13:31:03,417] ERROR {org.wso2.carbon.registry.core.dataaccess.TransactionManager} - Failed to rollback transaction. {org.wso2.carbon.registry.core.dataaccess.TransactionManager} java.sql.SQLException: Total number of available connections are less than the total number of rollbacked or committed connections at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction$ManagedRegistryConnection.rollback(JDBCDatabaseTransaction.java:1284) at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.rollbackTransaction(JDBCTransactionManager.java:120) at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.rollbackTransaction(EmbeddedRegistry.java:447) at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.get(EmbeddedRegistry.java:552) at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.get(CacheBackedRegistry.java:180) at org.wso2.carbon.registry.core.session.UserRegistry.get(UserRegistry.java:524) ...

Leon Yang
  • 37
  • 6

1 Answers1

0

Normally the reason for this error is, you are using the same database for local registry space and governance space. if you are using the same jdbc/WSO2REG_DB database as local and governance registry spaces. It is wrong by definition. It is not correct to share local registry space between any nodes in a cluster. Ideally, you could use the default H2 database as local registry database (jdbc/WSO2CarbonDB). Basically you need to keep following configuration in registry.xml file by pointing to H2 db. Just found some blog about same error which may be helpful.

<currentDBConfig>wso2registry</currentDBConfig>

<dbConfig name="wso2registry"> <dataSource>jdbc/WSO2CarbonDB</dataSource> </dbConfig>

Asela
  • 5,781
  • 1
  • 15
  • 23
  • I didn't use local registry DB for sharing, please see the content of datasource.xm and registry.xml that I added. It works normally if I replaced all jdbc connection url with "jdbc:mysql://wso2db:3306" and driverClassName with "com.mysql.jdbc.Driver". – Leon Yang Mar 10 '15 at 02:12
  • Asela, do you have an idea for this issue? – Leon Yang Mar 10 '15 at 14:09