openstack lbaas 에러 커스터 마이징

| 2018년 12월 27일 | 0 Comments

오픈스택 로드밸런서 서비스를 운영하는 경우 여러가지 이유로 웹에서 에러를 출력합니다.

대표적인 에러가 503 에러로 로드 밸런서에 멤버가 없을 경우와 로드 밸런서에 연결된 멤버가 health check가 되지 않을 경우 입니다.

또한 로드 밸런서를 운영하는 서버의 내부 에러로 인해 발생하기도 합니다.

이런 경우에는 웹에서 바로 503에러가 발생하여 클라이언트가 접하기에 다소 당황 스러운 부분이 있기에 에러가 출력시 원하는 페이지로 바꿔 보도록 하겠습니다.

 


  1. mitaka 버전
    # cat /usr/lib/python2.7/dist-packages/neutron_lbaas/services/loadbalancer/drivers/haproxy/templates/haproxy_base.j2

    {# # Copyright 2014 OpenStack Foundation
    #
    # Licensed under the Apache License, Version 2.0 (the “License”); you may
    # not use this file except in compliance with the License. You may obtain
    # a copy of the License at
    #
    # http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
    # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    # License for the specific language governing permissions and limitations
    # under the License.
    #
    #}
    # Configuration for {{ loadbalancer_name }}
    global
    daemon
    user nobody
    group {{ usergroup }}
    log /dev/log local0
    log /dev/log local1 notice
    stats socket {{ sock_path }} mode 0666 level user

    defaults
    log global
    retries 3
    option redispatch
    timeout connect 5000
    timeout client 50000
    timeout server 50000
    errorfile 503 /etc/haproxy/errors/renewal_503.http

    {% block proxies %}{% endblock proxies %}

    2. qeens 버전
    # cat /usr/lib/python2.7/dist-packages/neutron_lbaas/drivers/haproxy/templates/haproxy_base.j2

    {# # Copyright 2014 OpenStack Foundation
    #
    # Licensed under the Apache License, Version 2.0 (the “License”); you may
    # not use this file except in compliance with the License. You may obtain
    # a copy of the License at
    #
    # http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
    # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    # License for the specific language governing permissions and limitations
    # under the License.
    #
    #}
    # Configuration for {{ loadbalancer_name }}
    global
    daemon
    user nobody
    group {{ usergroup }}
    log /dev/log local0
    log /dev/log local1 notice
    maxconn {{ connection_limit }}
    stats socket {{ sock_path }} mode 0666 level user

    defaults
    log global
    retries 3
    option redispatch
    timeout connect 5000
    timeout client 50000
    timeout server 50000
    errorfile 503 /etc/haproxy/errors/renewal_503.http

    {% block proxies %}{% endblock proxies %}

 

Category: 가상화/클라우드

장영호

About the Author ()