我已经使用基于SVN的部署同步设置了一个分布式集群WSO2 API Manager 1.6.0环境。SVN Jar将在启动时执行,接收SVN存储中的任何新添加。
TID: [0] [AM] [2014-10-30 14:52:57,790] INFO {org.apache.synapse.rest.API} - Initializing API: admin--TestAPI_Phil:v0.1 {org.apache.synapse.rest.API}
TID: [0] [AM] [2014-10-30 14:52:57,798] INFO {org.apache.synapse.deployers.APIDeployer} - API named 'admin--TestAPI_Phil:v0.1' has been deployed from file : /opt/wso2am-1.6.0/repository/deployment/server/synapse-configs/default/api/admin--TestAPI_Phil_v0.1.xml {org.apache.synapse.deployers.APIDeployer}
然而,几分钟后,当svnClientBundle jar执行其工作时,它进入睡眠状态,并且在更新时不会重新激活,即使Store/Publisher说网关已经更新:
TID: [0] [AM] [2014-10-30 15:21:06,965] INFO {org.apache.synapse.rest.API} - Initializing API: admin--TestAPI-2:v0.1 {org.apache.synapse.rest.API}
TID: [0] [AM] [2014-10-30 15:21:20,115] INFO {org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask} - Sent [SynchronizeRepositoryRequest{tenantId=-1234, tenantDomain='carbon.super', messageId=a3e77858-985d-4616-9b50-d6c9b47c0bf2}] {org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask}
网关不会接受新推出的API。我该如何让WSO2意识到有更新,或者使用svnClientBundle-1.0.0.jar编写脚本来定期检查SVN存储库?我应该制作BeanShell脚本吗?
具有完整日志输出的GitHub Gist位于此处:https://gist.github.com/predatorian3/024193918330af2140bb
我还遵循了文档:
https://docs.wso2.com/display/AM140/SVN-Based+部署+同步器
https://docs.wso2.com/display/CLUSTER420/SVN-based+部署+同步器
https://docs.wso2.com/display/CLUSTER420/Clustering+API+管理器#集群API管理器-安装和配置数据库
基于SVN的部署同步和集群API管理器的文档冲突,并表示svnClientBundle-1.0.0.jar需要位于不同的位置。
正如您在docs[1]中看到的,svnClientBundle-1.0.0.jar必须始终复制到<PRODUCT_HOME>/repository/components/dropins
目录中。
部署同步器取决于集群消息,因此您需要确保产品集群正常工作。正如您所观察到的,服务器将在服务器启动时签出工件。之后,只有当服务器收到集群消息时,工件才会更新。
产品集群应该位于[2]中提到的相同域中。我们建议使用wka会员计划。
请先启动您的wka成员,然后再启动其他服务器。您必须在wka成员的日志中看到"加入"消息。如果您没有看到这一点,那么<AM_HOME>/repository/conf/axis2/axis2.xml
中的集群配置一定有问题。请确保在群集配置中使用IP地址。
我在你的日志中看不到加入消息。请检查您的配置。
请参阅有关对网关进行集群的文档[3]。由于您没有使用ELB,您只需要避免将ELB详细信息添加到axis2.xml中。
例如,如果您有两个网关节点,以下是axis2.xml 中所需的配置
网关1:
<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
<parameter name="membershipScheme">wka</parameter>
<parameter name="domain">wso2.am.domain</parameter>
<parameter name="localMemberHost">192.168.10.1</parameter>
<parameter name="localMemberPort">4100</parameter>
<parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
</parameter>
<members>
</members>
</clustering>
网关2:
<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
<parameter name="membershipScheme">wka</parameter>
<parameter name="domain">wso2.am.domain</parameter>
<parameter name="localMemberHost">192.168.10.2</parameter>
<parameter name="localMemberPort">4101</parameter>
<parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
</parameter>
<members>
<member>
<hostName>192.168.10.1</hostName>
<port>4100</port>
</member>
</members>
</clustering>
我希望这能有所帮助。
[1]https://docs.wso2.com/display/CLUSTER420/SVN-based+部署+同步器
[2]https://docs.wso2.com/display/CLUSTER420/Clustering+API+管理器#集群API管理器-配置eAPIPublisherdAPIStoretoon the me-clusterdomain
[3]https://docs.wso2.com/display/CLUSTER420/Clustering++网关