Commit 6b5879b8 authored by 陈红帅's avatar 陈红帅

perf(springboot):动态分配端口

parent 074024c2
...@@ -22,6 +22,9 @@ public class XxlJobExecutorApplication { ...@@ -22,6 +22,9 @@ public class XxlJobExecutorApplication {
* @param args * @param args
*/ */
private static void initZookeeperAddres(String[] args){ private static void initZookeeperAddres(String[] args){
if(args == null || args.length == 0){
throw new RuntimeException("请传入zookeeper的地址");
}
String addres = "zookeeper://" + args[0]; String addres = "zookeeper://" + args[0];
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("dubbo.registry.address",addres); properties.setProperty("dubbo.registry.address",addres);
......
# web port # web port 等于0时自动获取
server.port=8081 server.port=0
# log config # log config
logging.config=classpath:logback.xml logging.config=classpath:logback.xml
...@@ -11,7 +11,8 @@ xxl.job.admin.addresses=http://127.0.0.1:8181/xxl-job-admin ...@@ -11,7 +11,8 @@ xxl.job.admin.addresses=http://127.0.0.1:8181/xxl-job-admin
### xxl-job executor address ### xxl-job executor address
xxl.job.executor.appname=com-spacetech-service-xxl-job-springboot xxl.job.executor.appname=com-spacetech-service-xxl-job-springboot
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=9999 ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
xxl.job.executor.port=0
### xxl-job, access token ### xxl-job, access token
xxl.job.accessToken= xxl.job.accessToken=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment