简体   繁体   English

WSO2 API Manager 1.6.0-什么是正确的数据库配置?

[英]WSO2 API Manager 1.6.0 - What is the correct database configuration?

I have an installation of APIM 1.6.0 and a configuration as follows for each component. 我已经安装了APIM 1.6.0,并且每个组件的配置如下。 Databases: WSO2CarbonDB, WSO2UM_DB, WSO2REG_DB, WSO2AM_DB 数据库:WSO2CarbonDB,WSO2UM_DB,WSO2REG_DB,WSO2AM_DB

I've left the entry in all of the registry.xml files that points to carbon by default, and added the gov registry configuration: 我在默认情况下指向所有碳的所有Registry.xml文件中保留了该条目,并添加了gov注册表配置:

<currentDBConfig>wso2registry</currentDBConfig>
<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2CarbonDB</dataSource>
</dbConfig>
<dbConfig name="govregistry">
        <dataSource>jdbc/WSO2REG_DB</dataSource>
    </dbConfig>
    <remoteInstance url="https://localhost:9446/registry">
        <id>gov</id>
        <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/nodes</targetPath>
    </mount>

For the user-mgt.xml file I left the original carbon entry and added the user db entry: 对于user-mgt.xml文件,我保留了原始的carbon条目并添加了用户db条目:

   <Property name="dataSource">jdbc/WSO2CarbonDB</Property>
   <UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
<Property name="dataSource">jdbc/WSO2UM_DB</Property>

In the api-manager.xml file I added: 在api-manager.xml文件中,我添加了:

 <DataSourceName>jdbc/WSO2AM_DB</DataSourceName>

This was done on the Publisher node, Store node, Gateway node, and KeyManager node. 这是在Publisher节点,Store节点,Gateway节点和KeyManager节点上完成的。 What I expected would happen was that all of the components would use the databases as follows: 我预期将发生的所有组件将按如下方式使用数据库:

  • WSO2UM_DB would get used for UM_ tables interaction from all components. WSO2UM_DB将用于所有组件的UM_表交互。
  • WSO2REG_DB would get used for REG_ tables interaction from all components. WSO2REG_DB将用于所有组件之间的REG_表交互。
  • WSO2AM_DB would get used for API_ tables interaction from all components. WSO2AM_DB将用于所有组件的API_表交互。
  • I really didn't expect the WSO2CarbonDB to get used. 我真的没想到WSO2CarbonDB会被使用。

What I have seen from database traces is that the following happens: 我从数据库跟踪中看到的是发生了以下情况:

  • WSO2AM_DB is used by the Publisher for API_ tables. WSO2AM_DB被发布服务器用于API_表。 (I have not seen any other components access yet). (我还没有看到任何其他组件访问权限)。
  • WSO2UM_DB is used by all components for UM_ tables. WSO2UM_DB被UM_表的所有组件使用。
  • WSO2REG_DB is used by all components for REG_ tables. WSO2REG_DB被REG_表的所有组件使用。
  • WSO2CarbonDB is used by all components for both UM_ and REG_ tables updates. 所有组件都将WSO2CarbonDB用于UM_和REG_表更新。

The thing that suprised me was that for all components: Publisher, Store, Gateway, and Key Manager the WSO2CarbonDB was used for both UM_ and REG_ tables. 令我惊讶的是,对于所有组件:Publisher,商店,网关和密钥管理器,WSO2CarbonDB用于UM_和REG_表。 This was for inserts, updates, deletes, and selects. 这用于插入,更新,删除和选择。

Is that expected? 那是预期的吗? Or should I have removed/updated the WSO2CarbonDB to be the User or Registry database? 还是应该删除/更新WSO2CarbonDB作为用户或注册表数据库?

If you need jdbc/WSO2UM_DB to be the database for the user store of all the comonents, then you have to change the default datasource property value to be jdbc/WSO2UM_DB in user-mgt.xml. 如果需要jdbc / WSO2UM_DB作为所有组件的用户存储的数据库,则必须在user-mgt.xml中将默认数据源属性值更改为jdbc / WSO2UM_DB。 So you don't need to keep the jdbc/WSO2CarbonDB in there. 因此,您无需将jdbc / WSO2CarbonDB保留在其中。

<Property name="dataSource">jdbc/WSO2UM_DB</Property>

WSO2REG_DB to be the database for registry in all components, configure registry.xml same as your given configuration. WSO2REG_DB要成为所有组件中注册表的数据库,请配置与给定配置相同的registry.xml。 Then gov and conf registry space of all of those will get pointed to WSO2REG_DB. 然后,所有这些的gov和conf注册表空间都将指向WSO2REG_DB。

Also note that default WSO2CarbonDB will be used as the local registry of each and every component. 另请注意,默认WSO2CarbonDB将用作每个组件的本地注册表。

You could create all the database scripts into one single database schema. 您可以将所有数据库脚本创建到一个数据库模式中。 Point all your datasource (master-datasources.xml) to this database and schema. 将所有数据源(master-datasources.xml)指向此数据库和架构。

Here is my master-datasources.xml; 这是我的master-datasources.xml; it is used by Puppet. 由Puppet使用。 Puppet is replacing the <%= %> tags during provisioning. 在配置期间,Puppet将替换<%=%>标签。

<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_url %></url>
                    <username><%= jdbc_username %></username>
                    <password><%= jdbc_password %></password>
                    <driverClassName>oracle.jdbc.OracleDriver</driverClassName>
                    <maxActive>90</maxActive>
                    <maxWait>80000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>

        <datasource>
            <name>WSO2AM_DB</name>
            <description>The datasource used for API Manager database</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url><%= jdbc_url %></url>
                    <username><%= jdbc_username %></username>
                    <password><%= jdbc_password %></password>
                    <driverClassName>oracle.jdbc.OracleDriver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>

         <datasource>
            <name>WSO2AM_STATS_DB</name>
            <description>The datasource used for getting statistics to API Manager</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_STATS_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url><%= jdbc_url %></url>
                    <username><%= jdbc_username %></username>
                    <password><%= jdbc_password %></password>
                    <driverClassName>oracle.jdbc.OracleDriver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
         </datasource>

        <!-- For an explanation of the properties, see: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html -->
        <!--datasource>
            <name>SAMPLE_DATA_SOURCE</name>
            <jndiConfig>
                <name></name>
                <properties>
                    <property name="java.naming.factory.initial"></property>
                    <property name="java.naming.provider.url"></property>
                </properties>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>

                    <defaultAutoCommit></defaultAutoCommit>
                    <defaultReadOnly></defaultReadOnly>
                    <defaultTransactionIsolation>NONE|READ_COMMITTED|READ_UNCOMMITTED|REPEATABLE_READ|SERIALIZABLE</defaultTransactionIsolation>
                    <defaultCatalog></defaultCatalog>
                    <username></username>
                    <password svns:secretAlias="WSO2.DB.Password"></password>
                    <maxActive></maxActive>
                    <maxIdle></maxIdle>
                    <initialSize></initialSize>
                    <maxWait></maxWait>

                    <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
                    <dataSourceProps>
                        <property name="url">jdbc:mysql://localhost:3306/Test1</property>
                        <property name="user">root</property>
                        <property name="password">123</property>
                    </dataSourceProps>

                </configuration>
            </definition>       
        </datasource-->
    </datasources>

</datasources-configuration>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM