8
今尝试将xxl-job-admin和xxl-job-executor-samples封装到docker中,发现通信存在问题
1 建立自定义网络mynet
2 运行xxl-job-admin
docker run -it --name xxl-job-admin --rm --net mynet xxl-job-admin:1.0.0
3 运行xxl-job-executor-samples
docker run -it --name xxl-job-executor-sample-springboot --rm --net mynet --env JAR_PARAM="--xxl.job.admin.addresses=http://xxl-job-admin/xxl-job-admin --xxl.job.executor.ip=xxl-job-admin" xxl-job-executor-sample-springboot:1.0.0
4 容器xxl-job-admin尝试ping xxl-job-executor-samples是通的,如下图
5 容器xxl-job-executor-samples尝试ping xxl-job-admin是通的,如下图
6 但是xxl-job-executor-samples的运行日志一直报错,连不上admin,异常如下
11:48:08.892 logback [xxl-job, executor ExecutorRegistryThread] INFO c.x.j.c.t.ExecutorRegistryThread - >>>>>>>>>>> xxl-job registry fail, registryParam:RegistryParam{registryGroup='EXECUTOR', registryKey='xxl-job-executor', registryValue='http://xxl-job-admin:9989/'}, registryResult:ReturnT [code=500, msg=xxl-job remoting error(Connection refused (Connection refused)), for url : http://xxl-job-admin/xxl-job-admin/api/registry, content=null]
11:48:38.893 logback [xxl-job, executor ExecutorRegistryThread] ERROR c.x.job.core.util.XxlJobRemotingUtil - Connection refused (Connection refused)
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
at java.net.Socket.connect(Socket.java:606)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:499)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:594)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:278)
at sun.net.www.http.HttpClient.New(HttpClient.java:375)
at sun.net.www.http.HttpClient.New(HttpClient.java:393)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1240)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1167)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1061)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:995)
at com.xxl.job.core.util.XxlJobRemotingUtil.postBody(XxlJobRemotingUtil.java:99)
at com.xxl.job.core.biz.client.AdminBizClient.registry(AdminBizClient.java:42)
at com.xxl.job.core.thread.ExecutorRegistryThread$1.run(ExecutorRegistryThread.java:48)
at java.lang.Thread.run(Thread.java:750)