大网数据广告活动
服务器运维问答

SFTP configuration through HAProxy loadbalancing

· 52CE 我爱测

I have LB server which currently load balancing 2 machines as for apache2 "http" and "https" requests as master/slave, How to make the same server load balancing "sftp" requests to the same both machines using default port "22"? …

问题原文

原帖链接 · MohammedSimba · CC BY-SA 3.0

I have LB server which currently load balancing 2 machines as for apache2 "http" and "https" requests as master/slave,

How to make the same server load balancing "sftp" requests to the same both machines using default port "22"?

frontend ft_app
        bind 1.1.1.1:80
        reqadd X-Forwarded-Proto:\ http
        default_backend bk_app

frontend ft_apps
        bind 1.1.1.1:443 ssl crt /etc/ssl/certs/bundle.pem ca-file /etc/ssl/certs/cert.cer verify optional
        reqadd X-Forwarded-Proto:\ https
        default_backend bk_apps

backend bk_app
        server server1 2.2.2.2:80 check
        server server2 3.3.3.3:80 check backup

backend bk_apps
        server servers1 2.2.2.2:443 ssl check verify none
        server servers2 3.3.3.3:443 ssl check verify none backup

已采纳解答

原帖链接 · Castaglia · CC BY-SA 3.0

You might try using the following for the backend SFTP servers:

listen frontend_ssh 1.1.1.1:22
        mode tcp
        option tcplog
        balance roundrobin
        server server1 2.2.2.2:22
        server server2 3.3.3.3:22

I based the above on this post: http://jpmorris-iso.blogspot.com/2013/01/load-balancing-openssh-sftp-with-haproxy.html

Hope this helps

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。