Browse Source

doc: update neuron ekuiper connection guide

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 2 years ago
parent
commit
dba925215a

+ 23 - 14
docs/en_US/integrations/neuron/docker-compose.yml

@@ -2,32 +2,41 @@ version: '3.4'
 
 services:
   manager:
-    image: emqx/ekuiper-manager:1.5
+    image: emqx/ekuiper-manager:1.9
     container_name: ekuiper-manager
     ports:
       - "9082:9082"
   ekuiper:
-    image: lfedge/ekuiper:1.5-slim
+    image: lfedge/ekuiper:1.9
     ports:
       - "9081:9081"
       - "127.0.0.1:20498:20498"
-    container_name: manager-ekuiper
-    hostname: manager-ekuiper
+    container_name: ekuiper
+    hostname: ekuiper
     environment:
-      MQTT_SOURCE__DEFAULT__SERVER: "tcp://syno.home:1883"
+      MQTT_SOURCE__DEFAULT__SERVER: "tcp://mybroker:1883"
       KUIPER__BASIC__CONSOLELOG: "true"
       KUIPER__BASIC__IGNORECASE: "false"
+      # The default neuron url. Change it if you want to use another port.
+      SOURCES__NEURON__DEFAULT__URL: "tcp://neuron:7081"
     volumes:
-      - nng-ipc:/tmp
+      - /tmp/data:/kuiper/data
+      - /tmp/log:/kuiper/log
+      # Enable the following line if you want to use the IPC mode to connect to earlier version of neuron
+      # - nng-ipc:/tmp
   neuron:
-    image: neugates/neuron:2.0.1
+    image: neugates/neuron:2.4.0
     ports:
-      - "127.0.0.1:7001:7001"
-      - "127.0.0.1:7000:7000"
-    container_name: manager-neuron
-    hostname: manager-neuron
+      - "7001:7001"
+      # The default port to communicate with eKuiper. Change it if you want to use another port.
+      - "7081:7081"
+    container_name: neuron
+    hostname: neuron
     volumes:
-      - nng-ipc:/tmp
+      - /tmp/neuron/data:/opt/neuron/persistence
+      # Enable the following line if you want to use the IPC mode to connect to earlier version of eKuiper
+      # - nng-ipc:/tmp
 
-volumes:
-  nng-ipc:
+# Enable the following lines if you want to use the IPC mode to connect to earlier version of eKuiper and neuron
+# volumes:
+#  nng-ipc:

BIN
docs/en_US/integrations/neuron/eKuiper_to_neuron.png


BIN
docs/en_US/integrations/neuron/ekuiper_to_neuron.png


+ 54 - 33
docs/en_US/integrations/neuron/neuron_integration_tutorial.md

@@ -8,17 +8,22 @@ In versions prior to eKuiper 1.5.0, MQTT was required as a transit between Neuro
 
 ## Integration of Neuron and eKuiper
 
-In Neuron 2.0, eKuiper support has been added to northbound applications. When Neuron opens a northbound eKuiper application, the two are connected by inter-process communication via the NNG protocol, which significantly reduces network communication consumption and improves performance.
+In Neuron 2.0, eKuiper support has been added to northbound applications. When Neuron opens a northbound eKuiper application, the two are connected via the NNG protocol, which significantly reduces network communication consumption and improves performance.
 
-![eKuiper to neuron](./eKuiper_to_neuron.png)
+![eKuiper to neuron](./ekuiper_to_neuron.png)
 
-The integration between eKuiper and Neuron is bi-directional and the implementation consists of two main parts:
+The integration between eKuiper and Neuron is bidirectional and the implementation consists of two main parts:
 
 - A Neuron source is provided to support data subscription from Neuron.
 - A Neuron sink is provided to support device control via Neuron.
 
 In a typical industrial IoT edge data processing scenario, Neuron and eKuiper are deployed on the same edge machine. This is the scenario currently supported by the integration of the two. If communication over the network is required, collaboration can still be performed in the same way as before with MQTT.
 
+The connection between Neuron and eKuiper has gone through several phases.
+1. Early versions, where both sides used MQTT as a relay.
+2. Neuron 2.0 and eKuiper 1.5 onwards, where the two sides use the IPC protocol for one-to-one connectivity.
+3. Neuron 2.4 and eKuiper 1.9 onwards, the two sides use TCP protocol to connect and can support many-to-many connections.
+
 ## Preparation
 
 This tutorial will take the industrial IoT data collection and cleansing scenario as an example, and introduce how to complete the data collection, data cleansing and data control of cloud-edge collaboration step by step.
@@ -40,37 +45,53 @@ Both Neuron and eKuiper support binary installation packages and Docker containe
    version: '3.4'
 
    services:
-     manager:
-       image: emqx/ekuiper-manager:1.5.0
-       container_name: ekuiper-manager
-       ports:
-         - "9082:9082"
-     ekuiper:
-       image: lfedge/ekuiper:1.5-slim
-       ports:
-         - "9081:9081"
-         - "127.0.0.1:20498:20498"
-       container_name: manager-ekuiper
-       hostname: manager-ekuiper
-       environment:
-         MQTT_SOURCE__DEFAULT__SERVER: "tcp://cloud.host:1883"
-         KUIPER__BASIC__CONSOLELOG: "true"
-         KUIPER__BASIC__IGNORECASE: "false"
-       volumes:
-         - nng-ipc:/tmp
-     neuron:
-       image: neugates/neuron:2.0.1
-       ports:
-         - "127.0.0.1:7001:7001"
-         - "127.0.0.1:7000:7000"
-       container_name: manager-neuron
-       hostname: manager-neuron
-       volumes:
-         - nng-ipc:/tmp
-
-   volumes:
-     nng-ipc:
+      manager:
+         image: emqx/ekuiper-manager:1.9
+         container_name: ekuiper-manager
+         ports:
+            - "9082:9082"
+      ekuiper:
+         image: lfedge/ekuiper:1.9
+         ports:
+            - "9081:9081"
+            - "127.0.0.1:20498:20498"
+         container_name: ekuiper
+         hostname: ekuiper
+         environment:
+            MQTT_SOURCE__DEFAULT__SERVER: "tcp://mybroker:1883"
+            KUIPER__BASIC__CONSOLELOG: "true"
+            KUIPER__BASIC__IGNORECASE: "false"
+            # The default neuron url. Change it if you want to use another port.
+            SOURCES__NEURON__DEFAULT__URL: "tcp://neuron:7081"
+         volumes:
+            - /tmp/data:/kuiper/data
+            - /tmp/log:/kuiper/log
+            # Enable the following line if you want to use the IPC mode to connect to earlier version of neuron
+            # - nng-ipc:/tmp
+      neuron:
+         image: neugates/neuron:2.4.0
+         ports:
+            - "7001:7001"
+            # The default port to communicate with eKuiper. Change it if you want to use another port.
+            - "7081:7081"
+         container_name: neuron
+         hostname: neuron
+         volumes:
+            - /tmp/neuron/data:/opt/neuron/persistence
+            # Enable the following line if you want to use the IPC mode to connect to earlier version of eKuiper
+            # - nng-ipc:/tmp
+
+      # Enable the following lines if you want to use the IPC mode to connect to earlier version of eKuiper and neuron
+      # volumes:
+      #  nng-ipc:
    ```
+   To modify the port, you need to modify Neuron's eKuiper northbound application port, as well as the parts of this document that use the port, i.e., neuron's port exposure and eKuiper's environment variable default connection url section.
+   
+   > Notes for different version combinations
+   > 1. eKuiper 1.9 onwards can only interface with Neuron versions before 2.4 via ipc, you need to configure `SOURCES__NEURON__DEFAULT__URL: "ipc:///tmp/neuron-ekuiper.ipc"` and enable the configuration of volumes nng-ipc. Neuron does not need to expose port 7081.
+   > 2. eKuiper versions before 1.9 can only interface with neuron versions before 2.4 via ipc, you need to remove the `SOURCES__NEURON__DEFAULT__URL` environment variable configuration and enable the volumes nng-ipc configuration.
+   > 3. eKuiper versions before 1.9 and neuron versions after 2.4 cannot connect directly, but can be relayed through MQTT
+   
 2. In the directory where the file is located, run:
    
    ```shell

+ 23 - 14
docs/zh_CN/integrations/neuron/docker-compose.yml

@@ -2,32 +2,41 @@ version: '3.4'
 
 services:
   manager:
-    image: emqx/ekuiper-manager:1.5
+    image: emqx/ekuiper-manager:1.9
     container_name: ekuiper-manager
     ports:
       - "9082:9082"
   ekuiper:
-    image: lfedge/ekuiper:1.5-slim
+    image: lfedge/ekuiper:1.9
     ports:
       - "9081:9081"
       - "127.0.0.1:20498:20498"
-    container_name: manager-ekuiper
-    hostname: manager-ekuiper
+    container_name: ekuiper
+    hostname: ekuiper
     environment:
-      MQTT_SOURCE__DEFAULT__SERVER: "tcp://syno.home:1883"
+      MQTT_SOURCE__DEFAULT__SERVER: "tcp://mybroker:1883"
       KUIPER__BASIC__CONSOLELOG: "true"
       KUIPER__BASIC__IGNORECASE: "false"
+      # The default neuron url. Change it if you want to use another port.
+      SOURCES__NEURON__DEFAULT__URL: "tcp://neuron:7081"
     volumes:
-      - nng-ipc:/tmp
+      - /tmp/data:/kuiper/data
+      - /tmp/log:/kuiper/log
+      # Enable the following line if you want to use the IPC mode to connect to earlier version of neuron
+      # - nng-ipc:/tmp
   neuron:
-    image: neugates/neuron:2.0.1
+    image: neugates/neuron:2.4.0
     ports:
-      - "127.0.0.1:7001:7001"
-      - "127.0.0.1:7000:7000"
-    container_name: manager-neuron
-    hostname: manager-neuron
+      - "7001:7001"
+      # The default port to communicate with eKuiper. Change it if you want to use another port.
+      - "7081:7081"
+    container_name: neuron
+    hostname: neuron
     volumes:
-      - nng-ipc:/tmp
+      - /tmp/neuron/data:/opt/neuron/persistence
+      # Enable the following line if you want to use the IPC mode to connect to earlier version of eKuiper
+      # - nng-ipc:/tmp
 
-volumes:
-  nng-ipc:
+# Enable the following lines if you want to use the IPC mode to connect to earlier version of eKuiper and neuron
+# volumes:
+#  nng-ipc:

BIN
docs/zh_CN/integrations/neuron/eKuiper_to_neuron.png


BIN
docs/zh_CN/integrations/neuron/ekuiper_to_neuron.png


+ 52 - 32
docs/zh_CN/integrations/neuron/neuron_integration_tutorial.md

@@ -8,9 +8,9 @@ Neuron 支持同时为多个不同通讯协议设备、数十种工业协议进
 
 ## Neuron 与 eKuiper 的集成
 
-Neuron 2.0 中,北向应用增加了 eKuiper 支持。当 Neuron 开启北向 eKuiper 应用之后,二者之间通过 NNG 协议的进程间通信方式进行连接,从而显著降低网络通信消耗,提高性能。
+Neuron 2.0 中,北向应用增加了 eKuiper 支持。当 Neuron 开启北向 eKuiper 应用之后,二者之间通过 NNG 协议进行连接,从而显著降低网络通信消耗,提高性能。
 
-![ekuiper to neuron](./eKuiper_to_neuron.png)
+![ekuiper to neuron](./ekuiper_to_neuron.png)
 
 eKuiper 与 Neuron 之间的集成是双向的,其实现主要包含两个部分:
 
@@ -19,6 +19,11 @@ eKuiper 与 Neuron 之间的集成是双向的,其实现主要包含两个部
 
 典型的工业物联网边缘数据处理场景中,Neuron 和 eKuiper 部署在同一台边缘机器上。这也是目前二者集成所支持的场景。若需要通过网络进行通信,则仍然可以通过之前 MQTT 的方式进行协同。
 
+Neuron 与 eKuiper 的连接经历了几个阶段:
+1. 早期版本,双方采用 MQTT 作为中转。
+2. Neuron 2.0 和 eKuiper 1.5 之后的版本,双方采用 IPC 协议一对一连接。
+3. Neuron 2.4 和 eKuiper 1.9 之后的版本,双方采用 TCP 协议连接,可支持多对多连接。
+
 ## 准备工作
 
 本教程将以工业物联网数据采集和清洗的场景为例,手把手地介绍如何一步一步完成云边协同的数据采集,数据清理和数据反控。
@@ -40,37 +45,52 @@ Neuron 和 eKuiper 都支持二进制安装包以及 Docker 容器化部署方
    version: '3.4'
 
    services:
-     manager:
-       image: emqx/ekuiper-manager:1.5.0
-       container_name: ekuiper-manager
-       ports:
-         - "9082:9082"
-     ekuiper:
-       image: lfedge/ekuiper:1.5-slim
-       ports:
-         - "9081:9081"
-         - "127.0.0.1:20498:20498"
-       container_name: manager-ekuiper
-       hostname: manager-ekuiper
-       environment:
-         MQTT_SOURCE__DEFAULT__SERVER: "tcp://cloud.host:1883"
-         KUIPER__BASIC__CONSOLELOG: "true"
-         KUIPER__BASIC__IGNORECASE: "false"
-       volumes:
-         - nng-ipc:/tmp
-     neuron:
-       image: neugates/neuron:2.0.1
-       ports:
-         - "127.0.0.1:7001:7001"
-         - "127.0.0.1:7000:7000"
-       container_name: manager-neuron
-       hostname: manager-neuron
-       volumes:
-         - nng-ipc:/tmp
-
-   volumes:
-     nng-ipc:
+      manager:
+         image: emqx/ekuiper-manager:1.9
+         container_name: ekuiper-manager
+         ports:
+            - "9082:9082"
+      ekuiper:
+         image: lfedge/ekuiper:1.9
+         ports:
+            - "9081:9081"
+            - "127.0.0.1:20498:20498"
+         container_name: ekuiper
+         hostname: ekuiper
+         environment:
+            MQTT_SOURCE__DEFAULT__SERVER: "tcp://mybroker:1883"
+            KUIPER__BASIC__CONSOLELOG: "true"
+            KUIPER__BASIC__IGNORECASE: "false"
+            # The default neuron url. Change it if you want to use another port.
+            SOURCES__NEURON__DEFAULT__URL: "tcp://neuron:7081"
+         volumes:
+            - /tmp/data:/kuiper/data
+            - /tmp/log:/kuiper/log
+            # Enable the following line if you want to use the IPC mode to connect to earlier version of neuron
+            # - nng-ipc:/tmp
+      neuron:
+         image: neugates/neuron:2.4.0
+         ports:
+            - "7001:7001"
+            # The default port to communicate with eKuiper. Change it if you want to use another port.
+            - "7081:7081"
+         container_name: neuron
+         hostname: neuron
+         volumes:
+            - /tmp/neuron/data:/opt/neuron/persistence
+            # Enable the following line if you want to use the IPC mode to connect to earlier version of eKuiper
+            # - nng-ipc:/tmp
+
+      # Enable the following lines if you want to use the IPC mode to connect to earlier version of eKuiper and neuron
+      # volumes:
+      #  nng-ipc:
    ```
+   用户可自定义配置连接端口,本例中为 7081。修改端口时,需要修改 Neuron 的 eKuiper 北向应用端口,同时修改本文件中用到该端口的部分,即 neuron 的端口暴露和 eKuiper 的环境变量默认连接 url 部分。
+
+   > 各版本使用注意事项
+   > 1. eKuiper 1.9 之后版本与 Neuron 2.4 之前版本对接只能通过 ipc,需要配置 `SOURCES__NEURON__DEFAULT__URL: "ipc:///tmp/neuron-ekuiper.ipc"`,并且启用 volumes nng-ipc 的配置。Neuron 无需暴露 7081 端口。
+   > 2. eKuiper 1.9 之前版本与 neuron 2.4 之前版本对接只能通过 ipc,需要去除 `SOURCES__NEURON__DEFAULT__URL` 环境变量配置并且启用 volumes nng-ipc 的配置。Neuron 无需暴露 7081 端口。
+   > 3. eKuiper 1.9 之前版本与 neuron 2.4 之后版本无法直接对接,可通过 MQTT 中转。
 2. 在该文件所在目录,运行:
    
    ```shell