我曾尝试在WSO2集群部署中使用MySQL主从集群,但在启动时失败。WSO2是否只支持MySql无共享集群?如何支持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:执行处理程序链时发生异常。空....447)在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) ...
发布于 2015-03-09 22:43:55
通常,出现此错误的原因是,您将相同的数据库用于本地注册表空间和治理空间。如果您使用与本地和治理注册表空间相同的jdbc/WSO2REG_DB数据库。从定义上讲,它是错误的。在集群中的任何节点之间共享本地注册表空间是不正确的。理想情况下,您可以使用默认的H2数据库作为本地注册表数据库(jdbc/WSO2CarbonDB)。基本上,您需要通过指向H2 db在registry.xml文件中保持以下配置。刚刚发现了一些关于相同错误的blog,这可能会有所帮助。
<currentDBConfig>wso2registry</currentDBConfig>
<dbConfig name="wso2registry"> <dataSource>jdbc/WSO2CarbonDB</dataSource> </dbConfig>
https://stackoverflow.com/questions/28944112
复制相似问题