xuxueli / xxl-job

A distributed task scheduling framework.(分布式任务调度平台XXL-JOB)
http://www.xuxueli.com/xxl-job/
GNU General Public License v3.0
27.46k stars 10.86k forks source link

xxl-job kubernetes部署无法注册执行器 #1516

Closed jiangxiaoqiang closed 4 years ago

jiangxiaoqiang commented 4 years ago

Please answer some questions before submitting your issue. Thanks!

Which version of XXL-JOB do you using?

2.0.2

Expected behavior

在Kubernetes中部署完毕后,可以成功注册执行器。

Actual behavior

注册执行器失败。服务端提示错误:09:23:26.625 logback [http-nio-8080-exec-6] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/xxl-job-admin/api/registry] in DispatcherServlet with name 'dispatcherServlet'

客户端提示错误:09:25:48.713 logback [xxl-job, executor ExecutorRegistryThread] INFO c.x.j.c.t.ExecutorRegistryThread - >>>>>>>>>>> xxl-job registry fail, registryParam:RegistryParam{registryGroup='EXECUTOR', registryKey='job-schedule-executor1', registryValue='172.30.184.4:9997'}, registryResult:ReturnT [code=500, msg=xxl-rpc remoting fail, StatusCode(404) invalid. for url : http://xxl-job-admin.dabai-fat.svc.cluster.local:8080/xxl-job-admin/api/registry, content=null]

日志提示错误:10:28:38.250 logback [main] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/api]}" onto public void com.xxl.job.admin.controller.JobApiController.api(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException

Steps to reproduce the behavior

"spec": {
        "containers": [
          {
            "name": "xxl-job-admin",
            "image": "xuxueli/xxl-job-admin:2.0.2",
            "env": [
              {
                "name": "PARAMS",
                "value": "--spring.datasource.url=jdbc:mysql://mysql.dabai-fat.svc.cluster.local:3306/xxl-job?Unicode=true&characterEncoding=UTF-8&useSSL=false --spring.datasource.username=root --spring.datasource.password=123456 --server.servlet.context-path=/xxl-job-admin"
              }
            ],
            "resources": {},
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "imagePullPolicy": "IfNotPresent",
            "securityContext": {
              "privileged": false
            }
          }
        ],
        "restartPolicy": "Always",
        "terminationGracePeriodSeconds": 30,
        "dnsPolicy": "ClusterFirst",
        "securityContext": {},
        "schedulerName": "default-scheduler"
      }

Other information

我的xxl客户端配置:

### xxl-job admin address list:调度中心部署跟地址:如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调"。
xxl.job.admin.addresses = http://xxl-job-service.dabai-fat.svc.cluster.local:8080/xxl-job-admin

### xxl-job executor address:执行器"AppName"和地址信息配置:AppName执行器心跳注册分组依据;地址信息用于"调度中心请求并触发任务"和"执行器注册"。执行器默认端口为9999,执行器IP默认为空表示自动获取IP,多网卡时可手动设置指定IP,手动设置IP时将会绑定Host。单机部署多个执行器时,注意要配置不同执行器端口;
xxl.job.executor.appname = job-schedule-executor
xxl.job.executor.ip = 
xxl.job.executor.port = 9996

### xxl-job, access token:执行器通讯TOKEN,非空时启用
xxl.job.accessToken = 

### xxl-job log path:执行器运行日志文件存储的磁盘位置,需要对该路径拥有读写权限
xxl.job.executor.logpath = /data/applogs/xxl-job-fat/jobhandler/

### xxl-job log retention days:执行器Log文件定期清理功能,指定日志保存天数,日志文件过期自动删除。限制至少保持3天,否则功能不生效;
xxl.job.executor.logretentiondays = -1

WEB UI界面可以正常访问,但是注册地址无法正常访问,注册访问对应的地址:

efault|bash-3.2$  curl http://xxl-job-service.dabai-fat.svc.cluster.local:8080/api/registry
<!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1></body></html>

@default|bash-3.2$  curl http://xxl-job-service.dabai-fat.svc.cluster.local:8080/xxl-job-admin/api/registry
无内容
jiangxiaoqiang commented 4 years ago

我的客户端版本与服务端不匹配导致此问题,服务端是2.0.2版本,客户端是2.1.2版本。