禁用集群中的 HAproxy 禁用服务器时未找到此类服务器
No such server found while disabling HAproxy disable server from cluster
我的haproxy.cfg
global
log 127.0.0.1 local0
maxconn 20000
user haproxy
group haproxy
stats socket /var/run/haproxy/haproxy.sock level admin
stats timeout 2m
listen admin
bind *:8080
stats enable
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
# timeout http-request 5s
timeout connect 5000
timeout client 60000
timeout server 60000
frontend http-in
bind *:80
default_backend monkey
backend monkey
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth admin:hello
stats auth Another_User:hi
mode http
compression algo gzip
compression type text/html text/plain text/css application/json
balance roundrobin
option httpclose
option forwardfor
default-server inter 1s fall 1
server cd-test-1 1.2.3.4:80 check
server cd-test-2 5.6.7.8:80 check
我一直在使用 socat 从 HAproxy 集群中禁用一个节点。
下面是命令
echo "disable server monkey/cd-test-1"| socat stdio /var/run/haproxy/haproxy.sock
以上从 haproxy 禁用了我的节点。但是如果我使用 ip 地址(1.2.3.4)而不是 "cd-test-1" 它 returns 没有这样的服务器。
我正在使用 ansible 来自动执行此操作。我使用 {{inventory_hostname}} 并将命令委托给我的 HAproxy 服务器。因此这个问题。
- name: Disable {{ inventory_hostname }} in haproxy and letting the services drain
shell: echo "disable server monkey/{{inventory_hostname}}"| socat stdio /var/run/haproxy/haproxy.sock
become_user: root
delegate_to: "{{ item }}"
with_items: groups.haproxy_backend
这returns"No such server."并继续前进。
谁能帮我找出使用 IP 而不是服务器名称的问题。可能正在做一些非常愚蠢的事情。感谢任何帮助。
使用 socat 禁用和启用 HAproxy,必须提及服务器别名。
否则,我们将收到 No such server
错误。
我的haproxy.cfg
global
log 127.0.0.1 local0
maxconn 20000
user haproxy
group haproxy
stats socket /var/run/haproxy/haproxy.sock level admin
stats timeout 2m
listen admin
bind *:8080
stats enable
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
# timeout http-request 5s
timeout connect 5000
timeout client 60000
timeout server 60000
frontend http-in
bind *:80
default_backend monkey
backend monkey
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth admin:hello
stats auth Another_User:hi
mode http
compression algo gzip
compression type text/html text/plain text/css application/json
balance roundrobin
option httpclose
option forwardfor
default-server inter 1s fall 1
server cd-test-1 1.2.3.4:80 check
server cd-test-2 5.6.7.8:80 check
我一直在使用 socat 从 HAproxy 集群中禁用一个节点。 下面是命令
echo "disable server monkey/cd-test-1"| socat stdio /var/run/haproxy/haproxy.sock
以上从 haproxy 禁用了我的节点。但是如果我使用 ip 地址(1.2.3.4)而不是 "cd-test-1" 它 returns 没有这样的服务器。
我正在使用 ansible 来自动执行此操作。我使用 {{inventory_hostname}} 并将命令委托给我的 HAproxy 服务器。因此这个问题。
- name: Disable {{ inventory_hostname }} in haproxy and letting the services drain
shell: echo "disable server monkey/{{inventory_hostname}}"| socat stdio /var/run/haproxy/haproxy.sock
become_user: root
delegate_to: "{{ item }}"
with_items: groups.haproxy_backend
这returns"No such server."并继续前进。
谁能帮我找出使用 IP 而不是服务器名称的问题。可能正在做一些非常愚蠢的事情。感谢任何帮助。
使用 socat 禁用和启用 HAproxy,必须提及服务器别名。
否则,我们将收到 No such server
错误。