我正在使用HAProxy,尝试在两个节点上(TCP)负载均衡运行在端口6311上监听TCP套接字以调用R脚本的Rserve服务。
以下是我的配置文件。当我运行HAProxy时,它没有任何问题。但是当我连接到平衡的节点时,会出现以下错误。配置有问题吗?
握手失败:期望32字节头,得到-1
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode tcp
log global
option httplog
option dontlognull
option http-server-close
#option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen haproxy_rserve
bind *:81
mode tcp
option tcplog
timeout client 10800s
timeout server 10800s
balance leastconn
server rserve1 rserveHostName1:6311
server rserve2 rserveHostName2:6311
listen stats proxyHostName:8080
mode http
stats enable
stats realm Haproxy\ Statistics
stats uri /haproxy_stats
stats hide-version
stats auth admin:password
我尝试了下面这种前端后端负载均衡的方式,结果相同。
frontend haproxy_rserve
bind *:81
mode tcp
option tcplog
timeout client 10800s
default_backend rserve
backend rserve
mode tcp
option tcplog
balance leastconn
timeout server 10800s
server rserve1 rserveHostName1:6311
server rserve2 rserveHostName2:6311
/usr/sbin/setsebool
是配置SELinux的实用程序。这意味着您正在运行CentOS/RHEL并启用了SELinux。您可以通过Google了解SELinux是什么以及为什么大多数系统管理员在设置操作系统的第一分钟禁用它。简而言之,它应该是一个安全层,防止读取文件或打开网络套接字等操作,但经常会破坏应用程序,并且没有任何指示发生了什么。 - user5994461