在docker集装箱上点燃服务

我正在Docker容器中运行我的Gridgain服务器,并已部署该服务。 我在主机上运行我的Intellij,并试图在Gridgaindocker容器中部署服务。 我总是得到错误信息如下。

运行命令来启动容器:

docker运行-it –net主机-p 47500:47500 -p 47100:47100 apacheignite

错误信息:

无法连接到IP查找器的任何地址(将每2秒重试join拓扑):[/192.168.99.100:47500]

Docker Machine的默认IP是:192.168.99.100

我在服务器和客户端的TCPconfiguration:

<property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="localPort" value="47500"/> <property name="localPortRange" value="10"/> <!-- Setting up IP finder for this cluster --> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> <property name="addresses"> <list> <value>192.168.99.100:47500</value> </list> </property> </bean> </property> </bean> </property> 

Intellij的我的客户端代码:

Ignition.setClientMode(真);

 try (Ignite ignite = Ignition.start("sample.xml")) { GridGainService service = ignite.services().serviceProxy("GridGainService", GridGainService.class, true); return service.sayHello(); } 

但是我能够使用遮罩工具使用ip和端口192.168.99.100:11211连接到节点。 你能帮我解决这个连接问题吗?

更新 :

服务器节点日志:

  [14:18:55,219][INFO][main][IgniteKernal%sample] >>> __________ ________________ >>> / _/ ___/ |/ / _/_ __/ __/ >>> _/ // (7 7 // / / / / _/ >>> /___/\___/_/|_/___/ /_/ /___/ >>> >>> ver. 1.7.7#20170213-sha1:d72046dd >>> 2017 Copyright(C) Apache Software Foundation >>> >>> Ignite documentation: http://ignite.apache.org [14:18:55,221][INFO][main][IgniteKernal%sample] Config URL: jar:file:/opt/ignite/gridgain-enterprise-fabric-7.7.7/libs/GridGainExample-1.0-SNAPSHOT.jar!/sample.xml [14:18:55,221][INFO][main][IgniteKernal%sample] Daemon mode: off [14:18:55,221][INFO][main][IgniteKernal%sample] OS: Linux 4.4.59-boot2docker amd64 [14:18:55,222][INFO][main][IgniteKernal%sample] OS user: root [14:18:55,222][INFO][main][IgniteKernal%sample] PID: 53 [14:18:55,223][INFO][main][IgniteKernal%sample] Language runtime: Java Platform API Specification ver. 1.8 [14:18:55,223][INFO][main][IgniteKernal%sample] VM information: OpenJDK Runtime Environment 1.8.0_111-8u111-b14-2~bpo8+1-b14 Oracle Corporation OpenJDK 64-Bit Server VM 25.111-b14 [14:18:55,224][INFO][main][IgniteKernal%sample] VM total memory: 0.97GB [14:18:55,224][INFO][main][IgniteKernal%sample] Remote Management [restart: on, REST: on, JMX (remote: on, port: 49112, auth: off, ssl: off)] [14:18:55,224][INFO][main][IgniteKernal%sample] IGNITE_HOME=/opt/ignite/gridgain-enterprise-fabric-7.7.7 [14:18:55,227][INFO][main][IgniteKernal%sample] VM arguments: [-Xms1g, -Xmx1g, -XX:+AggressiveOpts, -XX:MaxMetaspaceSize=256m, -DIGNITE_QUIET=true, -DIGNITE_SUCCESS_FILE=/opt/ignite/gridgain-enterprise-fabric-7.7.7/work/ignite_success_bd343e0b-1fef-4e48-9fd7-c7dff57fa897, -Dcom.sun.management.jmxremote, -Dcom.sun.management.jmxremote.port=49112, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -DIGNITE_HOME=/opt/ignite/gridgain-enterprise-fabric-7.7.7, -DIGNITE_PROG_NAME=/opt/ignite/gridgain-enterprise-fabric-7.7.7/bin/ignite.sh] [14:18:55,228][INFO][main][IgniteKernal%sample] Configured caches ['ignite-marshaller-sys-cache', 'ignite-sys-cache', 'ignite-atomics-sys-cache', 'SampleCache'] [14:18:55,240][INFO][main][IgniteKernal%sample] 3-rd party licenses can be found at: /opt/ignite/gridgain-enterprise-fabric-7.7.7/libs/licenses [14:18:55,362][INFO][main][IgnitePluginProcessor] Configured plugins: [14:18:55,362][INFO][main][IgnitePluginProcessor] ^-- GridGain 7.7.7#20170213-sha1:2de56164 [14:18:55,362][INFO][main][IgnitePluginProcessor] ^-- 2017 Copyright(C) GridGain Systems [14:18:55,362][INFO][main][IgnitePluginProcessor] [14:18:55,499][INFO][main][TcpCommunicationSpi] IPC shared memory server endpoint started [port=48100, tokDir=/opt/ignite/gridgain-enterprise-fabric-7.7.7/work/ipc/shmem/933b16a3-4634-4f05-9ccb-7421856af81b-53] [14:18:55,499][INFO][main][TcpCommunicationSpi] Successfully bound shared memory communication to TCP port [port=48100, locHost=0.0.0.0/0.0.0.0] [14:18:55,517][INFO][main][TcpCommunicationSpi] Successfully bound to TCP port [port=47100, locHost=0.0.0.0/0.0.0.0] [14:18:55,562][WARNING][main][NoopCheckpointSpi] Checkpoints are disabled (to enable configure any GridCheckpointSpi implementation) [14:18:55,606][WARNING][main][GridCollisionManager] Collision resolution is disabled (all jobs will be activated upon arrival). [14:18:55,613][WARNING][main][NoopSwapSpaceSpi] Swap space is disabled. To enable use FileSwapSpaceSpi. [14:18:55,615][INFO][main][IgniteKernal%sample] Security status [authentication=off, tls/ssl=off] [14:18:55,938][INFO][main][GridTcpRestProtocol] Command protocol successfully started [name=TCP binary, host=0.0.0.0/0.0.0.0, port=11211] [14:18:55,985][WARNING][main][GridPluginProvider] Rolling updates are disabled. GridGain version update will require full cluster restart. Consider changing 'GridGainConfiguration.rollingUpdatesEnabled' configuration property. [14:18:56,197][INFO][main][IgniteKernal%sample] Non-loopback local IPs: 10.0.2.15, 172.17.0.1, 172.18.0.1, 192.168.99.100 [14:18:56,197][INFO][main][IgniteKernal%sample] Enabled local MACs: 024258C6D970, 0242F66F408F, 08002733608E, 08002763D2CC [14:18:56,244][INFO][main][TcpDiscoverySpi] Successfully bound to TCP port [port=49600, localHost=0.0.0.0/0.0.0.0, locNodeId=933b16a3-4634-4f05-9ccb-7421856af81b] [14:18:56,594][INFO][main][GridCacheProcessor] Started cache [name=SampleCache, mode=PARTITIONED] [14:18:56,616][INFO][main][GridCacheProcessor] Started cache [name=ignite-sys-cache, mode=REPLICATED] [14:18:56,618][INFO][main][GridCacheProcessor] Started cache [name=ignite-atomics-sys-cache, mode=PARTITIONED] [14:18:56,619][INFO][main][GridCacheProcessor] Started cache [name=ignite-marshaller-sys-cache, mode=REPLICATED] [14:18:56,749][INFO][exchange-worker-#20%sample%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=0], evt=NODE_JOINED, node=933b16a3-4634-4f05-9ccb-7421856af81b] [14:18:56,854][INFO][srvc-deploy-#21%sample%][GridServiceProcessor] Starting service instance [name=GridGainService, execId=fe7cdb63-1276-4dca-8177-d2a80cfc857e] [14:18:56,910][INFO][main][IgniteKernal%sample] Performance suggestions for grid 'sample' (fix if possible) [14:18:56,910][INFO][main][IgniteKernal%sample] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true [14:18:56,910][INFO][main][IgniteKernal%sample] ^-- Decrease number of backups (set 'backups' to 0) [14:18:56,911][INFO][main][IgniteKernal%sample] [14:18:56,911][INFO][main][IgniteKernal%sample] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat} [14:18:56,912][INFO][main][IgniteKernal%sample] [14:18:56,912][INFO][main][IgniteKernal%sample] >>> +----------------------------------------------------------------------+ >>> Ignite ver. 1.7.7#20170213-sha1:d72046dd61bba3acff25d961aaf2b703f01760b3 >>> +----------------------------------------------------------------------+ >>> OS name: Linux 4.4.59-boot2docker amd64 >>> CPU(s): 1 >>> Heap: 1.0GB >>> VM name: 53@default >>> Grid name: sample >>> Local node [ID=933B16A3-4634-4F05-9CCB-7421856AF81B, order=1, clientMode=false] >>> Local node addresses: [172.17.0.1/10.0.2.15, 172.18.0.1/127.0.0.1, 192.168.99.100/172.17.0.1, win7-pc.rouat.rotest/172.18.0.1, /192.168.99.100] >>> Local ports: TCP:11211 TCP:47100 TCP:48100 TCP:49600 [14:18:56,914][INFO][main][GridDiscoveryManager] Topology snapshot [ver=1, servers=1, clients=0, CPUs=1, heap=1.0GB] 

更新(05-10):仍然没有运气如果有人给我一些工作的例子,这将是伟大的。 如何在Docker容器中运行的Gridgain服务网格中部署服务,并从主机访问它。

  I guess it should be simple i was able to access the tomcat and Cassandra without any issues with the Docker Container ip address. What is the ip i need to use inside the ipfinder configuration. 

尝试在org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi中设置“localAddress”属性,它应该有所帮助。

另外,请看“IgniteConfiguration.setAddressResolver”。 您可以使用它将内部映射到外部IP