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.
Nacos supports three types of deployment modes
- 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.
Running Nacos in Standalone Mode
- Standalone means it is non-cluster Mode. * sh startup.sh -m standalone
- Standalone means it is non-cluster Mode. * cmd startup.cmd -m standalone
Running Nacos with mysql in Standalone Mode
Initialize MySQL database
add mysql datasource and configure url, user and password
spring.datasource.platform=mysql db.num=1 db.url.0=jdbc:mysql://220.127.116.11:3306/nacos_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true db.user=nacos_devtest db.password=youdontknow
Running 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