我曾尝试在 WSO2 集群部署中使用 MySQL Master/Slave 集群,但启动时失败。WSO2 是否只支持 MySql Share-Nothing 集群?它如何支持 MySQL 主/从?
我的数据源配置如下:
<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 配置如下:
<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>
启动时出现如下异常。
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:执行处理程序链时发生异常。null .... ID:[0] [AM] [2015-03-09 13:31:03,417] 错误 {org.wso2.carbon.registry.core.dataaccess.TransactionManager} - 无法回滚事务。{org.wso2.carbon.registry.core.dataaccess.TransactionManager} java.sql.SQLException:可用连接的总数小于 org.wso2.carbon.registry.core.jdbc 处回滚或提交的连接总数。 dataaccess.JDBCDatabaseTransaction$ManagedRegistryConnection.rollback(JDBCDatabaseTransaction.java:1284) 在 org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.rollbackTransaction(JDBCTransactionManager.java:120) 在 org.wso2.carbon.registry.core。 jdbc.EmbeddedRegistry.rollbackTransaction(EmbeddedRegistry.java: