RHEL7에서 HAProxy 문제 해결

RHEL7에서 HAProxy 문제 해결

RHEL7 시스템을 사용하고 있습니다. 나는 haproxy를 처음 사용합니다. 제 생각엔 뭔가 문제가 있는 것 같아요. 제가 사용하고 싶은 주소입니다.

[root@haproxy-el7-001 haproxy]# grep 1936 /etc/haproxy/haproxy.cfg 
  bind 10.29.103.39:1936 

이것이 내 haproxy.cfg의 모습입니다...

listen haproxy_stats
  bind 10.29.103.39:1936  
  mode  http   
  stats  enable
  stats  hide-version
  stats  realm Haproxy\ Statistics
  stats  uri / 
  stats  auth xxxxx:xxxxx

로드 밸런싱이 필요한 다른 서비스는 없지만, 그래도 이렇게 통계를 볼 수 있으면 좋겠습니다...

[root@haproxy-el7-001 haproxy]# wget http://10.29.103.39:1936
--2015-02-17 19:11:33--  http://10.29.103.39:1936/
Connecting to 10.29.103.39:1936... failed: No route to host.

서비스 haproxy가 실행 중입니다.

[root@haproxy-el7-001 ~]# systemctl -l status haproxy
haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled)
   Active: active (running) since Tue 2015-02-17 18:47:57 EST; 16s ago
 Main PID: 16448 (haproxy-systemd)
   CGroup: /system.slice/haproxy.service
           ├─16448 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
           ├─16449 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
           ├─16450 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
           └─16451 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds

Feb 17 18:48:10 haproxy-el7-001 haproxy[16451]: Server heat_api_cluster/mgmt-el7-001 is DOWN, reason: Layer4 timeout, check duration: 10001ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Feb 17 18:48:10 haproxy-el7-001 haproxy[16451]: backend heat_api_cluster has no server available!
Feb 17 18:48:10 haproxy-el7-001 haproxy[16450]: Server heat_api_cluster/mgmt-el7-001 is DOWN, reason: Layer4 timeout, check duration: 10001ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Feb 17 18:48:10 haproxy-el7-001 haproxy[16450]: backend heat_api_cluster has no server available!
Feb 17 18:48:12 haproxy-el7-001 haproxy[16450]: Server keystone-admin-api/mgmt-el7-001 is DOWN, reason: Layer4 timeout, check duration: 10000ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Feb 17 18:48:12 haproxy-el7-001 haproxy[16450]: backend keystone-admin-api has no server available!
Feb 17 18:48:12 haproxy-el7-001 haproxy[16451]: Server keystone-admin-api/mgmt-el7-001 is DOWN, reason: Layer4 timeout, check duration: 10001ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Feb 17 18:48:12 haproxy-el7-001 haproxy[16451]: backend keystone-admin-api has no server available!
Feb 17 18:48:13 haproxy-el7-001 haproxy[16451]: Server keystone-public-api/mgmt-el7-001 is DOWN, reason: Layer4 timeout, check duration: 10001ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Feb 17 18:48:13 haproxy-el7-001 haproxy[16451]: backend keystone-public-api has no server available!

이것은 출력이지만 ip aVIP 10.29.103.39가 나열되어 있지 않습니다.

[root@haproxy-el7-001 haproxy]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:50:56:a4:77:2b brd ff:ff:ff:ff:ff:ff
    inet 10.29.103.37/26 brd 10.29.103.63 scope global ens160
       valid_lft forever preferred_lft forever
    inet6 fe80::250:56ff:fea4:772b/64 scope link 
       valid_lft forever preferred_lft forever

내가 여기서 뭘 잘못하고 있는 걸까?

답변1

저는 Puppetlabs HAProxy 모듈을 사용하는 내부 Puppet 모듈로 작업하고 있습니다. 꼭두각시 코드는 다음과 같습니다 ...

  keepalived::instance { 'haproxy-vip':
    advert_int        => '1',
    priority          => "$priority",
    state             => "$state",
    virtual_router_id => "$vrouter_id",
    interface         => 'eth0',
    virtual_ips       => [ $controller_vip, $swift_vip ],
    track_script      => [ 'check_haproxy' ],
  }

...이 코드는 RHEL7에서 테스트되지 않았습니다. RHEL7 인터페이스 이름은 약간 다를 수 있습니다. 내 RHEL7 시스템에서 기본 네트워크 카드는 "ens160"입니다. 이렇게 "인터페이스"라는 사실을 사용하기 위해 꼭두각시 코드를 변경했습니다.

  $allnics = split( $interfaces, "," )
  $interface = $allnics[0]

  keepalived::instance { 'haproxy-vip':
    advert_int        => '1',
    priority          => "$priority",
    state             => "$state",
    virtual_router_id => "$vrouter_id",
    interface         => "$interface",
    virtual_ips       => [ $controller_vip, $swift_vip ],
    track_script      => [ 'check_haproxy' ],
  }

관련 정보