How to use a service to start multiple instances in IDEA SpringCloud

Multi-instance is a service that deploys multiple applications with the same function. As we all know, one instance needs to occupy one port, and the configuration file in our code can only specify one port.

  • Question: How to specify the port number it occupies when starting the microservice?

1. Right-click on the microservice to be copied and select Copy Configuration
insert image description here
2. Right-click on the copied configuration to edit
insert image description here
3. Set the name and port number of the new microservice ( specify the port to start on the VM parameter side:- Dserver.port=xxxx

-Dserver.port=63051 -Dxxl.job.executor.port=9998

insert image description here
4. After everything is started, you can clearly see that a service has been deployed by multiple instances in the nacos registration center
insert image description here

Guess you like

Origin blog.csdn.net/weixin_54514751/article/details/131002436