栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何使安装在docker上不同aws实例上的Hazelcast节点彼此交互?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何使安装在docker上不同aws实例上的Hazelcast节点彼此交互?

您需要使用

--net=host
选项运行hazelcast
docker映像。我测试了由hazelcast(https://hub.docker.com/r/hazelcast/hazelcast/)发布的Docker镜像,版本3.5.4,在AWS
EC2上有两个实例。我的Docker版本是
Docker version 1.9.1, build a34a1d5
ec2上使用的ami
UbuntuServer 14.04 LTS (HVM), SSD Volume Type - ami-fce3c696
,这是我的
hazelcast.xml


<?xml version="1.0" encoding="UTF-8"?><hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd"xmlns="http://www.hazelcast.com/schema/config"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    <group>        <name>dev</name>        <password>dev-pass</password>    </group>    <management-center enabled="false">http://localhost:8080/mancenter</management-center>    <network>        <port auto-increment="true" port-count="100">5701</port>        <outbound-ports> <!-- Allowed port range when connecting to other nodes. 0 or * means use system provided port. --> <ports>0</ports>        </outbound-ports>        <join> <multicast enabled="false">     <multicast-group>224.2.2.3</multicast-group>     <multicast-port>54327</multicast-port> </multicast> <tcp-ip enabled="false">     <interface>127.0.0.1</interface>     <member-list>         <member>127.0.0.1</member>     </member-list> </tcp-ip> <aws enabled="true">     <access-key>your-acces-key</access-key>     <secret-key>your-secret-key</secret-key> </aws>        </join>        <public-address>private-ip-address-of-ec2-instance</public-address>    </network>    <properties>       <property name="hazelcast.local.localAddress">private-ip-address-of-ec2-instance</property>   </properties></hazelcast>

这是我的docker命令,用于使用自定义配置文件运行hazelcast映像:

docker run --net=host -eJAVA_OPTS="-Dhazelcast.config=/configFolder/hazelcast.xml" -v~/configFolder:/configFolder -ti hazelcast/hazelcast

如果该

--net=host
选项不起作用,请确保在hazelcast使用的安全组中,配置端口已作为入站端口打开。您还可以启用调试以查看有关通过ec2
Discovery发现的节点的更多详细信息。

请参阅

Debugging
hazelcast
ec2发现部分下的部分:http :
//docs.hazelcast.org/docs/latest-dev/manual/html-
single/index.html#discovering-members-within-
ec2-cloud



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/397701.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号