Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问我执行器无网络,需要通过本地代理才能连上 xxl-job-admin,我应该怎么配置? #56

Closed
Shimada666 opened this issue Oct 16, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Shimada666
Copy link

如题,网络流量都是:
执行器 - 网关 - 调度中心

从调度中心连接执行器可以通过网关转发实现
从执行器连调度中心也要配上本地代理才能访问,但是不知道如何配置?

@fcfangcc
Copy link
Owner

config = ExecutorConfig(
    xxl_admin_baseurl="http://调度中心代理地址和端口/xxl-job-admin/api/",
    executor_app_name="xxl-job-executor-sample",
    executor_host="调度中心连接执行器通过网关转发的地址或域名",
   executor_port="调度中心连接执行器通过网关转发的端口",
   executor_listen_port=9999,
   executor_listen_host="0.0.0.0",  # xxl-admin监听时绑定的host
   debug=True,
)

参考文档 ExecutorConfig

@Shimada666
Copy link
Author

@fcfangcc 感谢回复!但是我是执行器连接调度中心都需要代理。查阅源码我发现是使用 aiohttp 进行连接,目前手动修改源码增加 proxy 实现了,请问后续考虑提供对 proxy 的支持吗?

    async def _post(self, path: str, payload: JsonType, retry_times: Optional[int] = None) -> Response:
        logger.debug("post to xxl-job path={} payload={}".format(path, payload))
        times = 0
        retry_times = retry_times or self.retry_times
        while times < retry_times:
            try:
                # 我修改了此处,增加了 proxy
                async with self.session.post(self.url_path + path, json=payload, headers=self.headers, proxy='http://localhost:65030') as response:
                    if response.status == 200:
                        r = Response(**(await response.json()))
                        if not r.ok:
                            raise XXLClientError(r.msg or "")

@fcfangcc
Copy link
Owner

后续有时间我加一下

@Shimada666
Copy link
Author

非常感谢!

@fcfangcc fcfangcc self-assigned this Oct 16, 2024
@fcfangcc fcfangcc added the enhancement New feature or request label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants