frp 负载均衡

如果我们同时拿到了多台内网机器,为了进一步提高代理的稳定性,同时也希望避免沦陷主机资源负载过高等异常情况。我们可以考虑使用frp的负载均衡的配置来分担流量,同时开启frp自带的健康检查,避免出现服务单点故障,从而实现高可用架构的稳定代理

Server:frps.ini

[common]
bind_addr = 0.0.0.0
bind_port = 7000
kcp_bind_port = 7000
tls_enable = true
# IP 与 bind_addr 默认相同,可以不设置
# dashboard_addr = 0.0.0.0
# ,只有设置web页面才生效
dashboard_port = 7500
# 用户密码保平安
dashboard_user = amdin
dashboard_pwd = password

client1: frpc.ini

[common]
server_addr = 101.200.157.195
# kcp监听的端口
server_port = 7000
protocol = kcp

[client_socks5_one]
type = tcp
remote_port = 6005
plugin = socks5
plugin_user = abc
plugin_passwd = abc
# 启用健康检查,类型为 tcp
health_check_type = tcp
# 建立连接超时时间为 3 秒
health_check_timeout_s = 3
# 连续 3 次检查失败,此 proxy 会被摘除
health_check_max_failed = 3
# 每隔 10 秒进行一次健康检查
health_check_interval_s = 10

# 负载均衡配置客户组
group = load_balance
group_key = 123

client2: frpc.ini

[common]
server_addr = 101.200.157.195
# kcp监听的端口
server_port = 7000
protocol = kcp

[client_socks5_two]
type = tcp
remote_port = 6005
plugin = socks5
plugin_user = abc
plugin_passwd = abc
# 启用健康检查,类型为 tcp
health_check_type = tcp
# 建立连接超时时间为 3 秒
health_check_timeout_s = 3
# 连续 3 次检查失败,此 proxy 会被摘除
health_check_max_failed = 3
# 每隔 10 秒进行一次健康检查
health_check_interval_s = 10

# 负载均衡配置客户组
group = load_balance
group_key = 123