发生了什么
- 当我启动工作节点时,蝗虫不工作,因为无法从工作节点连接主节点。以下是详细信息
- 这个问题偶尔会发生
$ locust -f /path/to/a.py --config=config/master.conf
[2022-10-25 17:56:34,618] PC-0003395.local/INFO/locust.main: Starting web interface at http://0.0.0.0:8089 (accepting connections from all network interfaces)
[2022-10-25 17:56:34,623] PC-0003395.local/INFO/locust.main: Starting Locust 2.12.2
$ locust -f /path/to/a.py --config=config/worker.conf
[2022-10-25 17:56:59,326] PC-0003395.local/WARNING/locust.runners: Failed to connect to master 127.0.0.1:5557, retry 3/60.
[2022-10-25 17:57:04,331] PC-0003395.local/WARNING/locust.runners: Failed to connect to master 127.0.0.1:5557, retry 4/60.
[2022-10-25 17:57:09,334] PC-0003395.local/WARNING/locust.runners: Failed to connect to master 127.0.0.1:5557, retry 5/60.
在这段时间里,我有以下配置文件。
- master.conf
headless = false
master = true
expect-workers = 1
host = SOME_HOST
users = 1
spawn-rate = 1
run-time = 1m
- worker.conf
headless = false
worker = true
master-host = 127.0.0.1
我的环境
- 操作系统
- macOS蒙特利12.4版
- CPU
- M1
- 蟒蛇/蝗虫
locust 2.12.2 from /opt/homebrew/Cellar/locust/2.12.2/libexec/lib/python3.10/site-packages/locust (python 3.10.8)
除了重新启动我的mac,我不知道如何解决这个问题。请教我如何修理这个。
设置中的一切看起来都很好。我唯一能想到的是macOS的软件防火墙(弹出的防火墙会问你"Python可以接收传入连接吗?"(
请尝试在master.conf中设置master-bind-host = 127.0.0.1
,这可能会有所帮助。