You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ab...@apache.org on 2020/08/14 15:46:23 UTC
[ignite] 02/03: add running nodes behind nat page
This is an automated email from the ASF dual-hosted git repository.
abudnikov pushed a commit to branch IGNITE-7595
in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 6c28f14504e7ecd13fc9b2243907987c03e9010a
Author: abudnikov <ab...@gridgain.com>
AuthorDate: Fri Aug 14 18:45:04 2020 +0300
add running nodes behind nat page
---
.../running-client-nodes-behind-nat.adoc | 33 ++++++++++++++++++++++
.../java/org/apache/ignite/snippets/Discovery.java | 26 +++++++++++++++++
docs/_docs/code-snippets/xml/client-behind-nat.xml | 28 ++++++++++++++++++
3 files changed, 87 insertions(+)
diff --git a/docs/_docs/clustering/running-client-nodes-behind-nat.adoc b/docs/_docs/clustering/running-client-nodes-behind-nat.adoc
new file mode 100644
index 0000000..55d5703
--- /dev/null
+++ b/docs/_docs/clustering/running-client-nodes-behind-nat.adoc
@@ -0,0 +1,33 @@
+= Running Client Nodes Behind NAT
+
+If your client nodes are deployed behind a NAT, the server nodes won't be able to establish connection with the clients because of the limitations of the communication protocol.
+This includes deployment cases when client nodes are running in virtual environments (like Kubernetes) and the server nodes are deployed elsewhere.
+
+For cases like this, you need to enable a special mode of communication:
+
+[tabs]
+--
+tab:XML[]
+
+[source, xml]
+----
+include::code-snippets/xml/client-behind-nat.xml[tags=ignite-config;!discovery,indent=0]
+----
+tab:Java[]
+[source, java]
+----
+include::{javaCodeDir}/Discovery.java[tags=client-behind-nat,indent=0]
+----
+tab:C#/.NET[]
+
+tab:C++[unsupported]
+--
+
+== Limitations
+
+* This mode cannot be used when `TcpCommunicationSpi.usePairedConnections = true` on both server and client nodes.
+
+* Peer class loading for link:key-value-api/continuous-queries[continuous queries (transformers and filters)] does not work when a continuous query is started from a client node `forceClientToServerConnections = true`.
+You will need to add the corresponding classes to the classpath of every server node.
+
+* This property can only be used on client nodes. This limitation will be addressed in the future releases.
diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Discovery.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Discovery.java
new file mode 100644
index 0000000..adf3e35
--- /dev/null
+++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Discovery.java
@@ -0,0 +1,26 @@
+package org.apache.ignite.snippets;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.junit.jupiter.api.Test;
+
+public class Discovery {
+
+ @Test
+ void clientsBehindNat() {
+
+ //tag::client-behind-nat[]
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setClientMode(true);
+
+ cfg.setCommunicationSpi(new TcpCommunicationSpi().setForceClientToServerConnections(true));
+
+ //end::client-behind-nat[]
+ try(Ignite ignite = Ignition.start(cfg)) {
+
+ }
+ }
+}
diff --git a/docs/_docs/code-snippets/xml/client-behind-nat.xml b/docs/_docs/code-snippets/xml/client-behind-nat.xml
new file mode 100644
index 0000000..4fa51cd
--- /dev/null
+++ b/docs/_docs/code-snippets/xml/client-behind-nat.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
+ <!-- tag::ignite-config[] -->
+ <bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="clientMode" value="true"/>
+ <property name="communicationSpi">
+ <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
+ <property name="forceClientToServerConnections" value="true"/>
+ </bean>
+ </property>
+ <!-- tag::discovery[] -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <value>127.0.0.1:47500..47509</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ <!-- end::discovery[] -->
+ </bean>
+ <!-- end::ignite-config[] -->
+</beans>
\ No newline at end of file