communicate - project-nano/releases GitHub Wiki
Communication and networking
In the Nano, communication divide into external communication and internal communication.
External communication is the communication between the Nano cluster and the external module, usually using the fixed address and port. For example, the REST API interface provided by the FrontEnd call Core module is set to the TCP 5850 port by default.
Internal communication is the control and transmission between the internal modules of the Nanocluster, such as control messages between platform modules, and image transmission data between Cell and ImageServer.
Most of the internal network communication addresses and ports of Nano dynamically allocate and automatically configure, adapting to the ever-changing network. No need to worry about anything when network change or module migrate, Nano will handle everything, swift and smartly.
see figure below:
Web front end and REST interface
The REST API is provided by the Core module with default listening port TCP 5850. The FrontEnd module base on the REST interface and provides a full web management GUI. The default web listening port is TCP 5870. Users can also customize their FrontEnd service on demand.
These two ports are statically configured and will not change when the platform is running. Users can use any available ports they like. (the module must be restarted to take effect, see configure)
See more details about API definition and FrontEnd customization here: customize
Cluster discovery and module communication
Communicate domain
The real network is so complicated and easy to change. Nano defines the Communicate Domain to implement an automated cluster networking.
Multiple Nano clusters are allowed in the same network environment.
Each Nano cluster uses a separate communication domain. A communication domain defined by the domain name, multicast address plus port.
Modules using the same communication domain can discover each other, automatically network.
The default communication domain for Nano cluster installation is as follows:
Domain Name: Nano
Multicast address: 224.0.0.226
Multicast port: 5599
Users can modify the default parameters during setup or module configuration to adapt to their environment or build multiple Nano clusters.
The discovery and networking of the communication domain implement by the multicast protocol.
After the user sets up the multicast address and port and starts the module, the module will construct two multicast channels. The Core module listens at the domain address as the stub channel, like 224.0.0.226:5599. Other modules, such as Cell, work as a pinger receiving stub response on the same address, but with the port ( multicast port - 1), like 224.0.0.226:5598.
Start the core module first when startup your Nano cluster.the Core will check the local network device for the first time, choose a network interface with network available as the listening device, and listen to the multicast address and communication port.
If multiple network devices available, the Core will prompt to choose the device suitable for intranet communication. For example, a physical server has two network interfaces, one uses IP 59.36.83.74 to connect to the public network, and one uses IP 172.16.6.3 to connect to the internal network. Please select 172.16.6.3 as the listening address.
When a module (such as the Cell) starts after The Core, it will first send a query message to the stub channel. The Core receives the query, then reply self-address to the pinger. The pinger using the echo message received to determine own address, then start service and attempts to connect the Core module.
Communication between modules
The communication between the internal modules of the Nano cluster uses a reliable transmission protocol based on UDP. All addresses and ports of Nano modules automatically select to ensure availability and reduce configuration failures. The module will find available ports in the range of UDP 5600~5800 ports after start, establish communication with other modules.
Nano's framework will assign a module name according to the module category and the MAC address of the server. The module name of Cell_000c29987ded use as identification in the system, module always get the same name as long as the network device does not change in the current server.
Image Transportation
To protect data security, and prevent data leakage or corruption, Nano internal image and instance data are transmitted using HTTPS.
By default, the Nano installer generates a self-signed CA certificate and deploy on each server. Nano also uses digital signatures to check the consistency of files during the image building and cloning process, to prevent data corruption caused by the network failure or transmission abnormality.