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

当使用普通端口转发时无法使用peer进行复杂负载均衡 #1002

Open
franocisgar opened this issue Dec 28, 2023 · 2 comments
Open

Comments

@franocisgar
Copy link

我知道peer是要用协议代理的。
但我是想做一个复杂的端口转发负载均衡。

-L tcp://:8080/1.1.1.1:8080,2.2.2.2:8080,3.3.3.3:8080

是可行的,但我想先对1.1.1.1:8080和2.2.2.2:8080进行random轮询,如果这两个建立不起连接,最后再fifo进3.3.3.3:8080

-L tcp://:8080/1.1.1.1:8080,2.2.2.2:8080,3.3.3.3:8080?peer=8080.txt

以及8080.txt为

strategy        fifo
max_fails       1
fail_timeout    30s

reload          10s

# peers
peer    1.1.1.1:8080?ip=8080ips.txt
peer    3.3.3.3:8080

8080ips.txt为

1.1.1.1
2.2.2.2

时无法使用?peer=8080.txt参数,会默认进行端口转发中的round模式

有什么办法可以达成先对1.1.1.1:8080和2.2.2.2:8080进行random轮询,如果这两个建立不起连接,最后再fifo进3.3.3.3:8080吗?

@franocisgar
Copy link
Author

franocisgar commented Dec 28, 2023

我有一个想法
先监听8080转发去本地8081 和3.3.3.3:8080进行fifo,然后再8081端口进行random负载均衡

-L tcp://:8080/127.0.0.1:8081,3.3.3.3:8080?ip=127.0.0.1:8081,3.3.3.3:8080&strategy=fifo&max_fails=1&fail_timeout=60s
-L tcp://:8081/1.1.1.1:8080,2.2.2.2:8080?ip=1.1.1.1:8080,2.2.2.2:8080&strategy=random&max_fails=1&fail_timeout=60s

不知道能不能达成相对应的效果,但这样的话有点复杂

@franocisgar
Copy link
Author

franocisgar commented Dec 28, 2023

以及如果我在

-L tcp://:8081/1.1.1.1:8080,2.2.2.2:8080?ip=1.1.1.1:8080,2.2.2.2:8080&strategy=random&max_fails=1&fail_timeout=60s

中使用iplist.txt的话 ip=iplist.txt可以热更新吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant