WSO2 Identity Server群集错误

时间:2015-08-31 20:41:07

标签: cluster-computing wso2is

我正在使用安装在两台服务器上的WSO2 Identity Server 5.0和Service Pack WSO2-IS-5.0.0-SP01组成一个集群,在指南https://docs.wso2.com/display/CLUSTER420/Clustering+Identity+Server中设置但我遇到以下错误启动节点:

{org.wso2.carbon.identity.user.store.remote.internal.CarbonRemoteUserStoreDSComponent} -  Carbon Remote User Store activated successfully.
[2015-08-31 16:34:52,777]  INFO {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService} -  Configured Registry in 195ms
[2015-08-31 16:34:52,970]  INFO {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService} -  Configured Registry in 1ms
[2015-08-31 16:34:53,107] ERROR {org.wso2.carbon.registry.core.dataaccess.TransactionManager} -  Failed to commit transaction.
java.sql.SQLException: Total number of available connections are less than the total number of committed connections
        at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction$ManagedRegistryConnection.commit(JDBCDatabaseTransaction.java:1227)

我的文件/opt/WSO2/wso2is-5.0.0/repository/conf/registry.xml配置:

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

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

<remoteInstance url="https://localhost:9443/registry">
        <id>instanceid</id>
        <dbConfig>sharedregistry</dbConfig>
        <readOnly>false</readOnly>
        <enableCache>true</enableCache>
        <registryRoot>/</registryRoot>
    </remoteInstance>


    <mount path="/_system/config" overwrite="true">
        <instanceId>instanceid</instanceId>
        <targetPath>/_system/nodes</targetPath>
    </mount>
    <mount path="/_system/governance" overwrite="true">
        <instanceId>instanceid</instanceId>
        <targetPath>/_system/governance</targetPath>
    </mount>

我的文件/opt/WSO2/wso2is-5.0.0/repository/conf/datasources/master-datasources.xml配置:

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> 
     <providers> 
        <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> 
    </providers> 
    <datasources> 
        <datasource> 
            <name>REGISTRY_LOCAL1</name> 
            <description>The datasource used for registry-local</description> 
            <jndiConfig> 
                <name>jdbc/WSO2CarbonDB</name> 
            </jndiConfig> 
            <definition type="RDBMS"> 
                <configuration> 
                    <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL1?autoReconnect=true</url> 
                    <username>regadmin</username> 
                    <password>regadmin</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> 
        <datasource> 
            <name>REGISTRY_DB</name> 
            <description>The datasource used for registry-config/governance</description> 
            <jndiConfig> 
                <name>jdbc/WSO2RegistryDB</name> 
            </jndiConfig> 
            <definition type="RDBMS"> 
                <configuration> 
                    <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> 
                    <username>regadmin</username> 
                    <password>regadmin</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> 
        <datasource> 
           <name>WSO2_USER_DB</name> 
           <description>The datasource used for registry and user manager</description> 
           <jndiConfig> 
               <name>jdbc/WSO2UMDB</name> 
           </jndiConfig> 
           <definition type="RDBMS"> 
               <configuration> 
                   <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> 
                   <username>regadmin</username> 
                   <password>regadmin</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> 
   </datasources> 
</datasources-configuration>

在MySQL中创建数据库:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| REGISTRY_DB        |
| REGISTRY_LOCAL1    |
| WSO2_USER_DB       |
| mysql              |
| performance_schema |
| regdb              |
| sharedreg_db       |
+--------------------+
8 rows in set (0.00 sec)

mysql>

提前致谢,

1 个答案:

答案 0 :(得分:1)

请勿更改currentDBConfig。保持原状。除了现有的currentDBConfig之外,还必须添加上述文档中提到的注册表安装配置。

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

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

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

<remoteInstance url="https://localhost:9443/registry">
   <id>instanceid</id>
   <dbConfig>sharedregistry</dbConfig>
   <readOnly>false</readOnly>
   <enableCache>true</enableCache>
   <registryRoot>/</registryRoot>
</remoteInstance>

<mount path="/_system/config" overwrite="true">
   <instanceId>instanceid</instanceId>
   <targetPath>/_system/nodes</targetPath>
</mount>
<mount path="/_system/governance" overwrite="true">
   <instanceId>instanceid</instanceId>
   <targetPath>/_system/governance</targetPath>
</mount>

您要遵循的文件需要更正。您可以在此处找到WSO2 API Manager的正确文档[1]。执行以上更改并重新启动服务器。它应该解决你的问题。

此外,您可以使用嵌入式H2数据库进行本地注册,因为我们不会与群集中的其他节点共享本地注册表。所以你的master-datasources.xml可以改变如下。

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> 
     <providers> 
        <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> 
    </providers> 
    <datasources> 
        <datasource>
            <name>WSO2_CARBON_DB</name>
            <description>The datasource used for registry and user manager</description>
            <jndiConfig>
                <name>jdbc/WSO2CarbonDB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
                    <username>wso2carbon</username>
                    <password>wso2carbon</password>
                    <driverClassName>org.h2.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>
        <datasource> 
            <name>REGISTRY_DB</name> 
            <description>The datasource used for registry-config/governance</description> 
            <jndiConfig> 
                <name>jdbc/WSO2RegistryDB</name> 
            </jndiConfig> 
            <definition type="RDBMS"> 
                <configuration> 
                    <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> 
                    <username>regadmin</username> 
                    <password>regadmin</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> 
        <datasource> 
           <name>WSO2_USER_DB</name> 
           <description>The datasource used for registry and user manager</description> 
           <jndiConfig> 
               <name>jdbc/WSO2UMDB</name> 
           </jndiConfig> 
           <definition type="RDBMS"> 
               <configuration> 
                   <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> 
                   <username>regadmin</username> 
                   <password>regadmin</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> 
   </datasources> 
</datasources-configuration>

如果要进行此更改,请执行此操作并确保删除wso2is-5.0.0/repository/database目录并使用-Dsetup参数(sh wso2server.sh -Dsetup)重新启动服务器。

[1] https://docs.wso2.com/display/CLUSTER420/Clustering+API+Manager