WSO2是否支持MySQL主/从群集?

时间:2015-03-09 14:12:36

标签: wso2 mysql-cluster

我曾尝试在WSO2群集部署中使用MySQL Master / Slave群集,但在启动时失败了。 WSO2是否仅支持MySql Share-Nothing集群?它如何支持MySQL Master / Slave?

我的数据源配置如下:

<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:执行处理程序链时发生异常。空值 .... ID:[0] [AM] [2015-03-09 13:31:03,417] ERROR {org.wso2.carbon.registry.core.dataaccess.TransactionManager} - 无法回滚事务。 {} org.wso2.carbon.registry.core.dataaccess.TransactionManager java.sql.SQLException:可用连接总数小于回滚或已提交连接的总数         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)         在org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.rollbackTransaction(EmbeddedRegistry.java:447)         在org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.get(EmbeddedRegistry.java:552)         在org.wso2.carbon.registry.core.caching.CacheBackedRegistry.get(CacheBackedRegistry.java:180)         在org.wso2.carbon.registry.core.session.UserRegistry.get(UserRegistry.java:524) ...

1 个答案:

答案 0 :(得分:0)

通常,此错误的原因是,您使用相同的数据库用于本地注册表空间和治理空间。 如果您使用相同的jdbc / WSO2REG_DB数据库作为本地和治理注册表空间。根据定义,这是错误的。在群集中的任何节点之间共享本地注册表空间是不正确的。理想情况下,您可以使用默认H2数据库作为本地注册表数据库(jdbc / WSO2CarbonDB)。基本上,您需要通过指向H2 db在registry.xml文件中保持以下配置。刚刚发现了一些blog相同的错误,可能会有所帮助。

<currentDBConfig>wso2registry</currentDBConfig>

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