Nacos supports three types of deployment modes
Nacos deployment environment
Nacos is defined as an IDC internal application component, not a product for the public network environment. It is not recommended expose it to the public network environment directly.
All network related concepts such as VIP and network interface mentioned in the following documents are in the internal network environment.
- Standalone Mode - used in DEV or TEST environment.
- Cluster Mode - used in production environment to ensure high-availability.
- Multi-Cluster Mode - in complicated production mode, you may want to deploy multi-cluster mode to support different business units.
Environment preparation
- JDK installed, 1.8 and above are required
- Recommendation: 2 core CPU / 4G RAM and above
- Recommendation: Production environment with 3 nodes and above
Running Nacos in Standalone Mode
Linux/Unix/Mac
- Standalone means it is non-cluster Mode. * sh startup.sh -m standalone
Windows
- Standalone means it is non-cluster Mode. * cmd startup.cmd -m standalone
Running Nacos with mysql in Standalone Mode
Initialize MySQL database
application.properties configuration
application.properties configuration file
add mysql datasource and configure url, user and password
Running Nacos in Multi-Node Cluster Mode
Nacos in Multi-Node Cluster Mode
Deploy Nacos in Multi-Cluster Mode
Nacos support a NameServer route request mode, by which you can design a useful mapping rule to control the request forward to the corresponding cluster, in the mapping rule you can sharding the request by namespace or by tenant etc…
to setup a NameServer:
IP Selection of Multiple Network Cards
When the local environment is complex, the Nacos service needs to choose IP or network card to use at runtime when it starts up. Nacos Gets IP Reference Spring Cloud Design from Multiple Network Cards. With the nacos.inetutils parameter, you can specify the network card and IP address used by Nacos. The configuration parameters currently supported are:
- ip-address parameter can set Nacos IP directly
- use-only-site-local-interfaces parameter allows Nacos to use LAN ip, which is useful when Nacos deploys a machine with multiple network cards
- ignored-interfaces parameter support network card arrays, allowing Nacos to ignore multiple network cards
- preferred-networks parameter allow Nacos to select the matching IP preferentially and support regular matching and prefix matching