使用membershipScheme = AWS

时间:2017-03-20 15:18:09

标签: wso2 wso2-am wso2carbon

我正在将WSO2 AM 1.10.0运行到同一区域/区域的Amazon EC2节点上。其中一个是管理器节点,另一个是工作节点。

使用membershipScheme = WKA运行它们时,一切正常。尝试membershipScheme = AWS时,两台服务器都正确注册到云,但不互相交互。我验证了axis2.xml中的AWS参数是否正确,并将端口5700-5800打开为ALL。

我的WKA配置如下:

经理节点(WKA)

<parameter name="membershipScheme">wka</parameter>
<parameter name="localMemberPort">5701</parameter>
<parameter name="localMemberHost">ec2-M</parameter>
<groupManagement enable="true">
    <applicationDomain name="wso2.apim.domain"
                           description="APIM group"
                           agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
                           subDomain="worker"
                           port="5757"/>
</groupManagement>
<members>
    <member>
        <hostName>127.0.0.1</hostName>
        <port>5701</port>
    </member>
    <member>
        <hostName>ec2-GW</hostName>
        <port>5702</port>
    </member>
</members>

工作人员节点(WKA)

<parameter name="membershipScheme">wka</parameter>
<parameter name="localMemberPort">5702</parameter>
<parameter name="localMemberHost">ec2-GW</parameter>
<groupManagement enable="true">
    <applicationDomain name="wso2.apim.domain"
                       description="APIM group"
                       agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
                       subDomain="mgt"
                       port="5757"/>
</groupManagement>
<members>
    <member>
        <hostName>ec2-M</hostName>
        <port>5701</port>
    </member>
    <member>
        <hostName>127.0.0.1</hostName>
        <port>5702</port>
    </member>
</members>

在这种模式下,一切正常,在管理员日志中,我看到网关工作人员加入集群:

Managing group application domain:wso2.apim.domain, sub-domain:mgt using agent class org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent
Cluster domain: wso2.am.domain
Using wka based membership management scheme

Added member: Host:127.0.0.1, Remote Host:null, Port: 5701, HTTP:-1, HTTPS:-1, Domain: null, Sub-domain:null, Active:true
Added member: Host:ec2-GW,    Remote Host:null, Port: 5702, HTTP:-1, HTTPS:-1, Domain: null, Sub-domain:null, Active:true

Local member: [cf971938-ae01-42f7-84c1-563943ea1570] - Host:10.1.0.87, Remote Host:null, Port: 5701, HTTP:8281, HTTPS:8244, Domain: wso2.am.domain, Sub-domain:mgt, Active:true
Elected this member [cf971938-ae01-42f7-84c1-563943ea1570] as the Coordinator node

Added member: Host:10.1.0.87, Remote Host:null, Port: 5701, HTTP:8281, HTTPS:8244, Domain: wso2.am.domain, Sub-domain:mgt, Active:true
Application member Host:ec2-M, Remote Host:null, Port: 5757, HTTP:8281, HTTPS:8244, Domain: wso2.apim.domain, Sub-domain:mgt, Active:true joined application cluster

Member joined [a9268bd0-de59-47eb-bd90-69e6e3ef82c8]: ec2-GW/10.1.0.193:5702
Added member: Host:10.1.0.193, Remote Host:null, Port: 5702, HTTP:8280, HTTPS:8243, Domain: wso2.am.domain, Sub-domain:worker, Active:true

现在更改为AWS模式:

经理和工作人员节点(AWS)

<parameter name="membershipScheme">aws</parameter>
<parameter name="accessKey">...</parameter>
<parameter name="secretKey">...</parameter>
<parameter name="securityGroup">...</parameter>
<parameter name="region">eu-west-1</parameter>

(保持其他一切不变)

Managing group application domain:wso2.apim.domain, sub-domain:mgt using agent class org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent
Cluster domain: wso2.am.domain
Using aws based membership management scheme

Group management local member for domain [wso2.apim.domain],sub-domain [mgt] UUID: e8847f8c-b6c4-434d-9c3c-7eb8ceca59f2. Host:ec2-M, Remote Host:null, Port: 5757, HTTP:8281, HTTPS:8244, Domain: wso2.apim.domain, Sub-domain:mgt, Active:true

Local member: [2740f020-ca36-4e41-a94c-996d4c1a4fee] - Host:10.1.0.87, Remote Host:null, Port: 5701, HTTP:8281, HTTPS:8244, Domain: wso2.am.domain, Sub-domain:mgt, Active:true
Elected this member [2740f020-ca36-4e41-a94c-996d4c1a4fee] as the Coordinator node

Application member Host:ec2-M, Remote Host:null, Port: 5757, HTTP:8281, HTTPS:8244, Domain: wso2.apim.domain, Sub-domain:mgt, Active:true joined application cluster

从日志中可以看出,没有工人的迹象。

此外,管理员所做的更改不会被工作人员使用。

在工作节点中:

Managing group application domain:wso2.apim.domain, sub-domain:worker using agent class org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent
Cluster domain: wso2.am.domain
Using aws based membership management scheme

Group management local member for domain [wso2.apim.domain],sub-domain [worker] UUID: d034e9b0-b101-4d78-af44-d3e4a28ba0fd. Host:ec2-GW, Remote Host:null, Port: 5757, HTTP:8280, HTTPS:8243, Domain: wso2.apim.domain, Sub-domain:worker, Active:true

Application member Host:ec2-GW, Remote Host:null, Port: 5757, HTTP:8280, HTTPS:8243, Domain: wso2.apim.domain, Sub-domain:worker, Active:true joined application cluster

Local member: [50961848-8d78-412f-b83f-01dc8c7ad3bf] - Host:10.1.0.193, Remote Host:null, Port: 5702, HTTP:8280, HTTPS:8243, Domain: wso2.am.domain, Sub-domain:worker, Active:true
Elected this member [50961848-8d78-412f-b83f-01dc8c7ad3bf] as the Coordinator node

我使用telnet检查:端口5757,5701和5702可以通过两个节点访问。

为什么两个节点没有通信的任何想法?

根据评论跟进#1

为两个节点添加了标签

  

$ aws ec2 create-tags --resources ec2-M ec2-GW --tags Key = component,Value = gateway

使用describe-instances进行验证:

  

$ aws ec2 describe-instances

...
"Tags": [
                    {
                        "Value": "gateway", 
                        "Key": "component"
                    }
]
...

修改了axis2.xml,用于ec2-M和ec2-GW:

    <parameter name="localMemberPort">5701</parameter>
    ...
    <parameter name="accessKey">...</parameter>
    <parameter name="secretKey">...</parameter>
    <parameter name="securityGroup">...</parameter>
    <parameter name="region">eu-west-1</parameter>
    <parameter name="tagKey">component</parameter> 
    <parameter name="tagValue">gateway</parameter>

仍未与节点进行通信

进一步调查后跟进#2

使用Hazelcast REST API,我注意到在WKA模式下,每个成员都在两个节点的Hazelcast中注册

在经理上,运行http://ec2-M:5701/hazelcast/rest/cluster

Members [2] {
    Member [ec2-M]:5701 this
    Member [ec2-GW]:5702
}

在工作人员上,正在运行http://ec2-GW:5702/hazelcast/rest/cluster

Members [2] {
    Member [ec2-M]:5701 
    Member [ec2-GW]:5702 this
}

在AWS模式下,每个节点只能看到自己。

在经理上,运行http://ec2-M:5701/hazelcast/rest/cluster

Members [1] {
    Member [ec2-M]:5701 this
}

在工作人员上,正在运行http://ec2-GW:5701/hazelcast/rest/cluster

Members [1] {
    Member [ec2-GW]:5701 this
}

0 个答案:

没有答案