WSO2 API 管理器 - 在使用 SQL Server 进行群集时设置“CacheId"

2022-01-17 00:00:00 configuration sql-server wso2 wso2-am

我正在按照本指南在三台服务器(网关 + 发布者/存储 + 密钥存储)上对 WSO2 API Manager (v1.10.0) 进行集群:https://docs.wso2.com/display/CLUSTER44x/Clustering+API+管理器+1.10.0

我正在执行安装和配置数据库"部分的第 11a 步.这说明了以下内容:

<块引用>

  1. 要授予 Publisher 和 Store 组件访问注册表数据库的权限,请打开这两个组件中的/repository/conf/registry.xml 文件并进行如下配置:

一个.在 Publisher 组件的 registry.xml 文件中,添加或修改 <dbConfig name="govregistry"> 元素的 dataSource 属性,如下所示:

<dbConfig name="govregistry"><dataSource>jdbc/WSO2REG_DB</dataSource></dbConfig><remoteInstance url="https://publisher.apim-wso2.com"><id>政府</id><cacheId>user@jdbc:mysql://regdb.mysql-wso2.com:3306/regdb</cacheId><dbConfig>govregistry</dbConfig><readOnly>false</readOnly><enableCache>true</enableCache><registryRoot>/</registryRoot></远程实例><mount path="/_system/governance" overwrite="true"><instanceId>gov</instanceId><targetPath>/_system/governance</targetPath></mount><mount path="/_system/config" overwrite="true"><instanceId>gov</instanceId><targetPath>/_system/config</targetPath></mount>

但是,我使用的是 Microsoft SQL Server,而不是 MySQL,所以 cacheId 值对我来说并不合适.

请问SQL Server的cacheId应该如何配置?

我查看了 registry.xml 文件中被注释掉的描述,但无法弄清楚.

这是我的 WSO2REG_DB 配置:

<name>WSO2REG_DB</name><description>注册表使用的数据源</description><jndiConfig><name>jdbc/WSO2REG_DB</name></jndiConfig><定义类型="RDBMS"><配置><url>jdbc:sqlserver://***SERVER***:1433;databaseName=***DATABASE_NAME***</url><用户名>WS02RegUser</用户名><密码>***已删除***</密码><defaultAutoCommit>false</defaultAutoCommit><driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</driverClassName><maxActive>50</maxActive><maxWait>60000</maxWait><testOnBorrow>true</testOnBorrow><validationQuery>SELECT 1</validationQuery><validationInterval>30000</validationInterval></配置></定义></数据源>

解决方案

cacheId - 这是远程实例的缓存 ID.这里是缓存id 格式应为 $database_username@$database_url,其中$database_username 是远程实例数据库的用户名,并且$database_url 是远程实例数据库 URL.

参考:https://docs.wso2.com/display/Governance460/Remote+Instance+and+Mount+Configuration+Details#RemoteInstanceandMountConfigurationDetails-JDBC-basedRemoteInstanceConfiguration

I'm clustering WSO2 API Manager (v1.10.0) across three servers (Gateway + Publisher/Store + Key Store) by following this guide: https://docs.wso2.com/display/CLUSTER44x/Clustering+API+Manager+1.10.0

I am on Step 11a of the 'Installing and configuring the databases' section. This states the following:

  1. To give the Publisher and Store components access to the registry database, open the /repository/conf/registry.xml file in each of these two components and configure them as follows:

a. In the Publisher component's registry.xml file, add or modify the dataSource attribute of the <dbConfig name="govregistry"> element as follows:

<dbConfig name="govregistry">
  <dataSource>jdbc/WSO2REG_DB</dataSource>
</dbConfig>
<remoteInstance url="https://publisher.apim-wso2.com"> 
   <id>gov</id>
   <cacheId>user@jdbc:mysql://regdb.mysql-wso2.com:3306/regdb</cacheId>
   <dbConfig>govregistry</dbConfig>
   <readOnly>false</readOnly>
   <enableCache>true</enableCache>
   <registryRoot>/</registryRoot>
</remoteInstance>
<mount path="/_system/governance" overwrite="true">
   <instanceId>gov</instanceId>
   <targetPath>/_system/governance</targetPath>
</mount>
<mount path="/_system/config" overwrite="true">
   <instanceId>gov</instanceId>
   <targetPath>/_system/config</targetPath>
</mount>

However, I'm using Microsoft SQL Server, rather than MySQL, so the cacheId value doesn't look right to me.

How should the cacheId be configured for SQL Server please?

I have taken a look through the commented-out descriptions in the registry.xml file, but cannot figure this out.

Here is my WSO2REG_DB configuration:

<datasource>
    <name>WSO2REG_DB</name>
    <description>The datasource used by the registry</description>
    <jndiConfig>
        <name>jdbc/WSO2REG_DB</name>
    </jndiConfig>
    <definition type="RDBMS">
        <configuration>
            <url>jdbc:sqlserver://***SERVER***:1433;databaseName=***DATABASE_NAME***</url>
            <username>WS02RegUser</username>
            <password>***REMOVED***</password>
            <defaultAutoCommit>false</defaultAutoCommit>
        <driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</driverClassName>
            <maxActive>50</maxActive>
            <maxWait>60000</maxWait>
            <testOnBorrow>true</testOnBorrow>
            <validationQuery>SELECT 1</validationQuery>
            <validationInterval>30000</validationInterval>
        </configuration>
    </definition>
</datasource>

解决方案

cacheId - This is the cache id of the remote instance. Here the cache id should be in the format of $database_username@$database_url, where $database_username is the username of the remote instance database and $database_url is the remote instance database URL.

Reference: https://docs.wso2.com/display/Governance460/Remote+Instance+and+Mount+Configuration+Details#RemoteInstanceandMountConfigurationDetails-JDBC-basedRemoteInstanceConfiguration

相关文章