WSO2 APIM 2.6.0-群集和分布式-商店中没有API

时间:2019-08-20 13:19:54

标签: wso2 wso2-am

我已经部署了具有以下详细信息的完全分布式的API Manager v260 according to the documentation

  • IS(KM)570作为密钥管理器
  • 多个网关
  • 通过IS +电子邮件用户名启用了SSO
  • 未在任何配置文件上启用hazelcast
  • 网关与NFS同步
  • 注册表索引已关闭as recommended-请参阅页面上的最后一点

当我发布API时,发布者会在网关上调用管理服务并在其中发布synapse文件:

[-1234] [2019-08-20 12:37:09,106] []  INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -  ['admin@wso2.com@carbon.super [-1234]' logged in at [2019-08-20 12:37:09,106+0200]]
[-1234] [2019-08-20 12:37:10,481] []  INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -  ['admin@wso2.com@carbon.super [-1234]' logged in at [2019-08-20 12:37:10,481+0200]]
[-1234] [2019-08-20 12:37:10,811] []  INFO {org.wso2.carbon.mediation.dependency.mgt.DependencyTracker} -  [Sequence : json_fault was added to the Synapse configuration successfully]
[-1234] [2019-08-20 12:37:11,050] []  INFO {org.wso2.carbon.mediation.dependency.mgt.DependencyTracker} -  [API : admin-AT-wso2.com--HelloWorld:v0.1 was added to the Synapse configuration successfully]
[-1234] [2019-08-20 12:37:11,052] []  INFO {org.apache.synapse.rest.API} -  [Initializing API: admin-AT-wso2.com--HelloWorld:v0.1]
[-1234] [2019-08-20 12:37:11,151] []  INFO {org.wso2.carbon.mediation.dependency.mgt.DependencyTracker} -  [Endpoint : HelloWorld--v0.1_APIproductionEndpoint was added to the Synapse configuration successfully]

我认为注册表数据库是使商店了解已发布的API的机制。在链接的说明中,没有关于如何在商店和发布者配置文件之间共享注册表的实用信息,但是我使用了以下registry.xml配置:

/opt/wso2/wso2am/api-publisher/wso2am-2.6.0/repository/conf/registry.xml

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


    <dbConfig name="wso2registry">
        <dataSource>jdbc/WSO2CarbonDB</dataSource>
    </dbConfig>
        <!--
    Directory structure federation using Governance JDBC-based Remote Instance Configuration
    https://docs.wso2.com/display/Governance540/Remote+Instance+and+Mount+Configuration+Details
    -->
    <dbConfig name="gov">
        <dataSource>jdbc/WSO2REG_DB</dataSource>
    </dbConfig>

    <remoteInstance url="https://localhost:9443/registry">
        <id>gov</id>
        <dbConfig>gov</dbConfig>
        <readOnly>false</readOnly>
        <registryRoot>/</registryRoot>
        <enableCache>true</enableCache>
        <cacheId>wso2_dbuser@jdbc:mysql://mysql:3306/wso2_reg_qa?autoReconnect=tru$
    </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/wso2am_conf</targetPath>
    </mount>

...

 <indexingConfiguration>
        <!-- Skipping indexing: https://docs.wso2.com/display/AM260/Installing+and+Configuring+the+Databases -->
        <startIndexing>false</startIndexing>
        <skipCache>true</skipCache>
        <startingDelayInSeconds>60</startingDelayInSeconds>
        <indexingFrequencyInSeconds>300</indexingFrequencyInSeconds>
        <!--number of resources submit for given indexing thread -->
        <batchSize>40</batchSize>
        <!--number of worker threads for indexing -->
        <indexerPoolSize>40</indexerPoolSize>
        <!-- location storing the time the indexing took place-->
        <lastAccessTimeLocation>/_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime</lastAccessTimeLocation>
        <!-- the indexers that implement the indexer interface for a relevant media type/(s) -->
        <indexers>
            <!--indexer class="org.wso2.carbon.registry.indexing.indexer.MSExcelIndexer" mediaTypeRegEx="application/vnd.ms-excel"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.MSPowerpointIndexer" mediaTypeRegEx="application/vnd.ms-powerpoint"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.MSWordIndexer" mediaTypeRegEx="application/msword"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.PDFIndexer" mediaTypeRegEx="application/pdf"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/xml"/-->
            <!--indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/wsdl\+xml" profiles ="default,a$
            <indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/x-xsd\+xml " profiles ="default,ap$
            <indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/policy\+xml" profiles ="default,ap$
            <indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/vnd.(.)+\+xml" profiles ="default,$
            <!--indexer class="org.wso2.carbon.registry.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/(.)+\+xml"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.PlainTextIndexer" mediaTypeRegEx="text/(.)+"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.PlainTextIndexer" mediaTypeRegEx="application/x-javascript"/-->
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.PlainTextIndexer" mediaTypeRegEx="text/plain+" profiles ="default,api-store,api-publi$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.PDFIndexer" mediaTypeRegEx="application/pdf" profiles ="default,api-store,api-publish$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.MSWordIndexer" mediaTypeRegEx="application/msword" profiles ="default,api-store,api-p$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.MSPowerpointIndexer" mediaTypeRegEx="application/vnd.ms-powerpoint" profiles ="defaul$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.MSExcelIndexer" mediaTypeRegEx="application/vnd.ms-excel" profiles ="default,api-stor$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/xml" profiles ="default,api-store,api-publish$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.WSDLIndexer" mediaTypeRegEx="application/api-wsdl" profiles ="default,api-store,api-p$
        </indexers>
        <exclusions>
            <exclusion pathRegEx="/_system/config/repository/dashboards/gadgets/swfobject1-5/.*[.]html"/>
            <exclusion pathRegEx="/_system/local/repository/components/org[.]wso2[.]carbon[.]registry/mount/.*"/>
        </exclusions>
    </indexingConfiguration>

/opt/wso2/wso2am/api-store/wso2am-2.6.0/repository/conf/registry.xml

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


    <dbConfig name="wso2registry">
        <dataSource>jdbc/WSO2CarbonDB</dataSource>
    </dbConfig>
        <!--
    Directory structure federation using Governance JDBC-based Remote Instance Configuration
    https://docs.wso2.com/display/Governance540/Remote+Instance+and+Mount+Configuration+Details
    -->
    <dbConfig name="gov">
        <dataSource>jdbc/WSO2REG_DB</dataSource>
    </dbConfig>

    <remoteInstance url="https://localhost:9443/registry">
        <id>gov</id>
        <dbConfig>gov</dbConfig>
        <readOnly>false</readOnly>
        <registryRoot>/</registryRoot>
        <enableCache>true</enableCache>
        <cacheId>wso2_dbuser@jdbc:mysql://mysql:3306/wso2_reg_qa?autoReconnect=true&amp;</cacheId>
    </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/wso2am_conf</targetPath>
    </mount>

...

 <indexingConfiguration>
        <!-- Skipping indexing: https://docs.wso2.com/display/AM260/Installing+and+Configuring+the+Databases -->
        <startIndexing>false</startIndexing>
        <skipCache>true</skipCache>
        <startingDelayInSeconds>60</startingDelayInSeconds>
        <indexingFrequencyInSeconds>300</indexingFrequencyInSeconds>
        <!--number of resources submit for given indexing thread -->
        <batchSize>40</batchSize>
        <!--number of worker threads for indexing -->
        <indexerPoolSize>40</indexerPoolSize>
        <!-- location storing the time the indexing took place-->
        <lastAccessTimeLocation>/_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime</lastAccessTimeLocation>
        <!-- the indexers that implement the indexer interface for a relevant media type/(s) -->
        <indexers>
            <!--indexer class="org.wso2.carbon.registry.indexing.indexer.MSExcelIndexer" mediaTypeRegEx="application/vnd.ms-excel"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.MSPowerpointIndexer" mediaTypeRegEx="application/vnd.ms-powerpoint"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.MSWordIndexer" mediaTypeRegEx="application/msword"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.PDFIndexer" mediaTypeRegEx="application/pdf"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/xml"/-->
            <!--indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/wsdl\+xml" profiles ="default,a$
            <indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/x-xsd\+xml " profiles ="default,ap$
            <indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/policy\+xml" profiles ="default,ap$
            <indexer class="org.wso2.carbon.governance.registry.extensions.indexers.RXTIndexer" mediaTypeRegEx="application/vnd.(.)+\+xml" profiles ="default,$
            <!--indexer class="org.wso2.carbon.registry.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/(.)+\+xml"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.PlainTextIndexer" mediaTypeRegEx="text/(.)+"/>
            <indexer class="org.wso2.carbon.registry.indexing.indexer.PlainTextIndexer" mediaTypeRegEx="application/x-javascript"/-->
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.PlainTextIndexer" mediaTypeRegEx="text/plain+" profiles ="default,api-store,api-publi$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.PDFIndexer" mediaTypeRegEx="application/pdf" profiles ="default,api-store,api-publish$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.MSWordIndexer" mediaTypeRegEx="application/msword" profiles ="default,api-store,api-p$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.MSPowerpointIndexer" mediaTypeRegEx="application/vnd.ms-powerpoint" profiles ="defaul$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.MSExcelIndexer" mediaTypeRegEx="application/vnd.ms-excel" profiles ="default,api-stor$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/xml" profiles ="default,api-store,api-publish$
            <indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.WSDLIndexer" mediaTypeRegEx="application/api-wsdl" profiles ="default,api-store,api-p$
        </indexers>
        <exclusions>
            <exclusion pathRegEx="/_system/config/repository/dashboards/gadgets/swfobject1-5/.*[.]html"/>
            <exclusion pathRegEx="/_system/local/repository/components/org[.]wso2[.]carbon[.]registry/mount/.*"/>
        </exclusions>
    </indexingConfiguration>

两个节点都指向相同的REG_DB。

    <datasource>
            <name>WSO2REG_DB</name>
            <description>The datasource used for gov registry</description>
            <jndiConfig>
                <name>jdbc/WSO2REG_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://mysql:3306/wso2_reg_qa?autoReconnect=true&amp;</url>
                    <username>wso2_dbuser</username>
                    <password>123</password>
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                    <defaultAutoCommit>true</defaultAutoCommit>
                    <maxActive>75</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
    </datasource>

但是,商店中没有可见的API。如果单击发布服务器中的“在商店中查看”链接,则可以在商店中打开API。但是,当仅浏览商店时,它会指出:“尚未发布API”。该API的发布具有公开可见性,我以超级管理员用户admin@wso2的身份登录。

我想念一些家伙吗?

编辑

好的,所以我可能会误解为“建议关闭注册表索引-请参阅页面的最后一点”。我现在打开了索引功能,但将skipCache设置为true,即商店和发布者都有以下registry.xml文件:

<!-- This defines index configuration which is used in meta data search feature of the registry -->
    <indexingConfiguration>
        <!-- Skipping indexing: https://docs.wso2.com/display/AM260/Installing+and+Configuring+the+Databases -->
        <startIndexing>true</startIndexing>
        <skipCache>true</skipCache>
        <startingDelayInSeconds>60</startingDelayInSeconds>
        <indexingFrequencyInSeconds>300</indexingFrequencyInSeconds>

然后我重新初始化数据库,“重新索引”商店,发布了PizzaShack API,但是我遇到了同样的问题。我什至在Pub和Store之间建立了Hazelcast(相同的集群domai)

2 个答案:

答案 0 :(得分:0)

商店中显示的API是从solr索引加载的,并且solr索引同步是由系统基于时间戳触发的。 要以简单方式强制同步,请在“商店”节点的Carbon控制台注册表中,将/_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime注册表路径替换为/ _system / local / repository /components/org.wso2.carbon.registry/indexing/lastaccesstime_x  并重新启动节点。

答案 1 :(得分:0)

编辑后的注册表配置文件似乎已经解决了该问题,但是API需要一些时间才能出现在商店中