Apigee-Monit로 자가 복구

프라이빗 클라우드용 Apigee Edge에는 오픈소스 기반의 도구인 apigee-monit가 포함되어 있습니다. monit 유틸리티가 있습니다. 주기적으로 apigee-monit 에지 서비스를 폴링합니다. 서비스를 사용할 수 없는 경우 apigee-monit에서 다시 시작을 시도합니다.

apigee-monit를 사용하려면 수동으로 설치해야 합니다. Kubernetes API는 표준 설치로 이동합니다

기본적으로 apigee-monit는 60초마다 Edge 서비스의 상태를 확인합니다.

빠른 시작

이 섹션에서는 apigee-monit를 빠르게 준비하고 실행하는 방법을 설명합니다.

Amazon Linux를 사용하는 경우 먼저 Fedora를 통해 monit을 설치합니다. 그렇지 않으면 이 단계를 건너뛰세요.

sudo yum install -y https://kojipkgs.fedoraproject.org/packages/monit/5.25.1/1.el6/x86_64/monit-5.25.1-1.el6.x86_64.rpm

apigee-monit를 설치하려면 다음 단계를 따르세요.

  apigee-monit 설치
/opt/apigee/apigee-service/bin/apigee-service apigee-monit install
/opt/apigee/apigee-service/bin/apigee-service apigee-monit configure
/opt/apigee/apigee-service/bin/apigee-service apigee-monit start

그러면 기본적으로 apigee-monit가 설치되고 노드의 모든 구성요소가 모니터링되기 시작합니다.

  구성요소 모니터링 중지
/opt/apigee/apigee-service/bin/apigee-service apigee-monit unmonitor -c component_name
/opt/apigee/apigee-service/bin/apigee-service apigee-monit unmonitor -c all
  구성요소 모니터링 시작
/opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor -c component_name
/opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor -c all
  요약 상태 정보 가져오기
/opt/apigee/apigee-service/bin/apigee-service apigee-monit report
/opt/apigee/apigee-service/bin/apigee-service apigee-monit summary
  apigee-monit 로그 파일 보기
cat /opt/apigee/var/log/apigee-monit/apigee-monit.log

각 주제와 기타 주제는 다음 섹션에서 자세히 설명합니다.

apigee-monit 정보

apigee-monit는 노드의 모든 구성요소가 계속 실행되도록 합니다. 다음을 수행합니다. 다음을 포함한 다양한 서비스 제공:

  • 실패한 서비스 다시 시작
  • 요약 정보 표시
  • 로깅 모니터링 상태
  • 알림 전송
  • 에지 외 서비스 모니터링

Apigee에서는 apigee-monit를 모니터링하여 실행 중인지 확인할 것을 권장합니다. 자세한 내용은 Apigee-monit 모니터링을 참조하세요.

Apigee-monit 아키텍처

Private Cloud용 Apigee Edge 설치 및 구성 중에 원하는 경우 별도의 인스턴스를 설치합니다. apigee-monit를 제공합니다 이러한 개별 apigee-monit 인스턴스는 하나와 독립적으로 작동합니다. 다른 노드에 구성 요소의 상태를 다른 노드에 전달하지 않으며 모니터링 유틸리티 자체의 고장을 중앙 서비스에 전달합니다.

다음 이미지는 5노드 클러스터의 apigee-monit 아키텍처를 보여줍니다.

<ph type="x-smartling-placeholder">
</ph> 건축
  노드 5개 클러스터의 Apigee 수익
그림 1: 별도의 apigee-monit 인스턴스는 클러스터의 각 노드에서 개별적으로 실행 클러스터

구성요소 구성

apigee-monit구성요소 구성을 사용하여 모니터링할 구성요소와 확인해야 할 구성요소의 측면과 실패 시 취해야 할 조치에 대한 결정입니다.

기본적으로 apigee-monit에서는 사전 정의된 구성요소를 사용하여 노드의 모든 Edge 구성요소를 모니터링합니다. 구성할 수 있습니다 기본 설정을 보려면 apigee-monit 구성요소 구성을 확인하세요. 할 수 있습니다. 기본 구성요소 구성은 변경할 수 없습니다.

apigee-monit는 검사 중인 구성요소에 따라 구성요소의 다양한 측면을 확인합니다. 이 다음 표에는 apigee-monit에서 각 구성요소에서 확인하는 항목과 구성요소의 위치가 나와 있습니다. 각 구성요소에 대한 것입니다 일부 구성요소는 단일 구성으로 정의됩니다. 파일이 있으며, 다른 파일에는 자체 구성이 있습니다.

구성요소 구성 위치 모니터링 대상
관리 서버 /opt/apigee/edge-management-server/monit/default.conf apigee-monit 검사: <ph type="x-smartling-placeholder">
    </ph>
  • 지정된 포트가 열려 있으며 요청을 수락하고 있습니다.
  • 지정된 프로토콜이 지원됨
  • 응답 상태

또한 apigee-monit 구성요소의 경우:

  • 조치를 취하기 전에 지정된 주기 내에서 여러 번 실패해야 함
  • 커스텀 요청 경로를 설정합니다.
메시지 프로세서 /opt/apigee/edge-message-processor/monit/default.conf
Postgres 서버 /opt/apigee/edge-postgres-server/monit/default.conf
Qpid 서버 /opt/apigee/edge-qpid-server/monit/default.conf
라우터 /opt/apigee/edge-router/monit/default.conf
카산드라
Edge UI
OpenLDAP
Postgres
Qpid
동물원 사육사
/opt/apigee/data/apigee-monit/monit.conf apigee-monit 검사: <ph type="x-smartling-placeholder">
    </ph>
  • 서비스 실행 중

다음 예는 edge-router의 기본 구성요소 구성을 보여줍니다. 구성요소:

check host edge-router with address localhost
  restart program = "/opt/apigee/apigee-service/bin/apigee-service edge-router monitrestart"
  if failed host 10.1.1.0 port 8081 and protocol http
    and request "/v1/servers/self/uuid"
    with timeout 15 seconds
    for 2 times within 3 cycles
  then restart

  if failed port 15999 and protocol http
    and request "/v1/servers/self"
    and status < 600
    with timeout 15 seconds
    for 2 times within 3 cycles
  then restart

다음 예시는 기본 UI의 기본 구성 (edge-ui)을 보여줍니다. 구성요소:

check process edge-ui
 with pidfile /opt/apigee/var/run/edge-ui/edge-ui.pid
 start program = "/opt/apigee/apigee-service/bin/apigee-service edge-ui start" with timeout 55 seconds
 stop program = "/opt/apigee/apigee-service/bin/apigee-service edge-ui stop"

이는 기본 UI에 적용되며, 구성요소 이름이 edge-management-ui

프라이빗 클라우드용 Apigee Edge 구성요소의 기본 구성요소 구성은 변경할 수 없습니다. 할 수 있습니다. 그러나 대상 엔드포인트와 같은 외부 서비스에 대한 자체 구성 요소 구성을 추가해야 합니다. 또는 httpd 서비스 자세한 내용은 Apigee가 아닌 구성요소 구성.

기본적으로 apigee-monit는 실행 중인 노드의 모든 구성요소를 모니터링합니다. GCP 콘솔에서 모든 구성요소 또는 개별 구성요소에 대해 사용 중지할 수 있습니다. 자세한 내용은 다음을 참고하세요.

Apigee-monit 설치

apigee-monit가 기본적으로 설치되어 있지 않습니다. 업그레이드하거나 설치한 후에 수동으로 설치할 수 있습니다. Private Cloud용 Apigee Edge 버전 4.19.01 이상

이 섹션에서는 apigee-monit 설치 방법을 설명합니다.

apigee-monit 제거에 관한 자세한 내용은 다음을 참조하세요. apigee-monit를 제거합니다.

Apigee-monit 설치

이 섹션에서는 apigee-monit 설치 방법을 설명합니다.

apigee-monit 설치 방법:

  1. 다음 명령어를 사용하여 apigee-monit를 설치합니다.
    /opt/apigee/apigee-service/bin/apigee-service apigee-monit install
  2. 다음 명령어로 apigee-monit를 구성합니다.
    /opt/apigee/apigee-service/bin/apigee-service apigee-monit configure
  3. 다음 명령어를 사용하여 apigee-monit를 시작합니다.
    /opt/apigee/apigee-service/bin/apigee-service apigee-monit start
  4. 클러스터의 각 노드에서 이 절차를 반복합니다.

구성요소 모니터링 중지 및 시작

어떤 이유로든 서비스가 중지되면 apigee-monit에서 서비스를 다시 시작하려고 시도합니다.

구성요소를 고의로 중지하려는 경우 문제가 발생할 수 있습니다. 예를 들어 중지하려는 경우 다시 사용할 수 있습니다. 백업 또는 업그레이드 중에 apigee-monit에서 서비스를 다시 시작하는 경우 유지보수 절차는 다음과 같을 수 있습니다. 장애를 일으킬 수 있습니다

다음 섹션에서는 구성요소 모니터링을 중지하는 옵션을 보여줍니다.

구성요소 중지 및 모니터링 취소

구성요소를 중지하고 모니터링을 취소하려면 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit stop-component -c component_name
드림 component_name는 다음 중 하나일 수 있습니다.
  • apigee-cassandra (Cassandra)
  • apigee-openldap (OpenLDAP)
  • apigee-postgresql (PostgreSQL 데이터베이스)
  • apigee-qpidd (Qpidd)
  • apigee-sso (Edge SSO)
  • apigee-zookeeper (ZooKeeper)
  • edge-management-server (관리 서버)
  • edge-management-ui (새 Edge UI)
  • edge-message-processor (메시지 프로세서)
  • edge-postgres-server (Postgres 서버)
  • edge-qpid-server (Qpid 서버)
  • edge-router (에지 라우터)
  • edge-ui (기본 UI)

'all'은 stop-component에 유효한 옵션이 아닙니다. kubectl 명령어 stop-component를 사용하여 한 번에 하나의 구성요소만 모니터링 취소합니다.

구성요소를 다시 시작하고 모니터링을 재개하려면 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit start-component -c component_name

'all'은 start-component에 유효한 옵션이 아닙니다.

모든 구성요소를 중지하고 모니터링을 취소하는 방법에 대한 안내는 모든 구성요소를 중지하고 모니터링을 취소합니다.

구성요소 모니터링 취소 (중지하지는 않음)

구성요소 모니터링을 취소하려면 (중지하지는 않음) 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit unmonitor -c component_name
드림 component_name는 다음 중 하나일 수 있습니다.
  • apigee-cassandra (Cassandra)
  • apigee-openldap (OpenLDAP)
  • apigee-postgresql (PostgreSQL 데이터베이스)
  • apigee-qpidd (Qpidd)
  • apigee-sso (Edge SSO)
  • apigee-zookeeper (ZooKeeper)
  • edge-management-server (관리 서버)
  • edge-management-ui (새 Edge UI)
  • edge-message-processor (메시지 프로세서)
  • edge-postgres-server (Postgres 서버)
  • edge-qpid-server (Qpid 서버)
  • edge-router (에지 라우터)
  • edge-ui (기본 UI)

구성요소 모니터링을 재개하려면 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor -c component_name

모든 구성요소 모니터링 취소 (중지하지는 않음)

모든 구성요소의 모니터링을 취소하려면 (중지하지는 않음) 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit unmonitor -c all

모든 구성요소의 모니터링을 재개하려면 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor -c all

모든 구성요소를 중지하고 모니터링 취소

모든 구성요소를 중지하고 모니터링을 취소하려면 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit unmonitor -c all
/opt/apigee/apigee-service/bin/apigee-all stop

모든 구성요소를 다시 시작하고 모니터링을 재개하려면 다음 명령어를 실행합니다.

/opt/apigee/apigee-service/bin/apigee-all start
/opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor -c all

모든 구성요소의 모니터링을 중지하려면 다음에 설명된 대로 apigee-monit를 사용 중지하면 됩니다. Apigee-monit을 중지, 시작, 사용 중지합니다.

apigee-monit 중지, 시작, 사용 중지

다른 서비스와 마찬가지로 apigee-service를 사용하여 apigee-monit를 중지하고 시작할 수 있습니다. 명령어와 함께 사용하면 됩니다 또한 apigee-monitunmonitor 명령어를 지원하므로 구성요소 모니터링을 일시적으로 중지합니다.

Apigee-monit 중지

apigee-monit를 중지하려면 다음 명령어를 사용합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit stop

Apigee-monit 시작

apigee-monit를 시작하려면 다음 명령어를 사용합니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit start

Apigee-monit 사용 중지

다음 명령어를 사용하여 노드의 모든 구성요소 모니터링을 정지할 수 있습니다.

/opt/apigee/apigee-service/bin/apigee-service apigee-monit unmonitor -c all

또는 설명된 대로 노드에서 제거하여 apigee-monit를 영구적으로 사용 중지할 수 있습니다. apigee-monit 제거에서 제거하세요.

apigee-monit 제거

apigee-monit 제거 방법:

<ph type="x-smartling-placeholder">
    </ph> conf_monit_httpd_port httpd 데몬의 포트 apigee-monit에서 대시보드에 httpd 사용 보고서/요약을 사용 설정할 수 있습니다. 기본값은 2812입니다. conf_monit_httpd_allow httpd 데몬에 대한 요청 제약 조건 apigee-monit 사용 httpd: 대시보드 앱을 실행하고 보고서/요약을 사용 설정합니다. 이 값은 localhost (httpd가 실행 중인 호스트)를 가리킵니다.

    요청에 사용자 이름과 비밀번호를 포함하도록 요청하려면 다음 구문을 사용합니다.

    conf_monit_httpd_allow=allow username:"password"\nallow 127.0.0.1

    사용자 이름과 비밀번호를 추가할 때 "\n" 기호를 삽입하세요. 바꾸어야 합니다 금지사항 값에 실제 줄바꿈이나 캐리지 리턴을 삽입합니다.

    conf_monit_monit_datadir 이벤트 세부정보가 저장되는 디렉터리입니다. conf_monit_monit_delay_time apigee-monit가 메모리에 처음 로드된 후 대기하는 시간입니다. 실행할 수도 있습니다 이는 apigee-monit의 첫 번째 프로세스 검사에만 영향을 미칩니다. conf_monit_monit_logdir apigee-monit 로그 파일의 위치입니다. conf_monit_monit_retry_time apigee-monit가 각 프로세스를 확인하려는 빈도입니다. 기본값은 60입니다. 초입니다. conf_monit_monit_rundir PID 및 상태 파일의 위치로, apigee-monit가 프로세스를 확인하는 데 사용합니다.

    기본 apigee-monit 컨트롤 설정을 맞춤설정하려면 다음 단계를 따르세요.

    1. 다음 파일을 수정합니다.
      /opt/apigee/customer/application/monit.properties

      파일이 존재하지 않으면 파일을 만들고 소유자를 'apigee'로 설정합니다. 사용자:

      chown apigee:apigee /opt/apigee/customer/application/monit.properties

      파일이 이미 존재하면 추가로 정의된 구성 속성이 있을 수 있습니다. 위의 표에 나열된 것 이상으로 확장될 수 있습니다. 다음을 제외한 속성은 수정하면 안 됩니다. 선택할 수 있습니다

    2. 속성 값을 새 값으로 설정하거나 대체합니다.

      예를 들어 로그 파일의 위치를 /tmp로 변경하려면 다음 속성을 사용합니다.

      conf_monit_monit_logdir=/tmp/apigee-monit.log
    3. 변경 사항을 monit.properties 파일에 저장합니다.
    4. 다음 명령어를 사용하여 apigee-monit를 새로고침합니다.
      /opt/apigee/apigee-service/bin/apigee-service apigee-monit reload

      apigee-monit가 다시 시작되지 않으면 apigee-monit 로그 파일에 액세스합니다.

    5. 클러스터의 각 노드에 이 절차를 반복합니다.

    Edge 외 구성요소에만 적용됩니다. 구성요소 구성은 맞춤설정할 수 없습니다. 살펴보겠습니다

    apigee-monit 로그 파일에 액세스

    apigee-monit는 이벤트, 다시 시작, 구성 변경, 알림 등 모든 활동을 로그에 기록합니다. 파일에서 참조됩니다.

    로그 파일의 기본 위치는 다음과 같습니다.

    /opt/apigee/var/log/apigee-monit/apigee-monit.log

    apigee-monit 컨트롤을 맞춤설정하여 기본 위치를 변경할 수 있습니다. 설정을 선택합니다.

    로그 파일 항목의 형식은 다음과 같습니다.

    'edge-message-processor' trying to restart
    [UTC Dec 14 16:20:42] info     : 'edge-message-processor' trying to restart
    'edge-message-processor' restart: '/opt/apigee/apigee-service/bin/apigee-service edge-message-processor monitrestart'

    apigee-monit 로그 파일 항목의 형식은 맞춤설정할 수 없습니다.

    Apigee-monit으로 집계 상태 보기

    apigee-monit에는 구성 요소를 구성해야 합니다

    명령어 사용
    report
    /opt/apigee/apigee-service/bin/apigee-service apigee-monit report
    summary
    /opt/apigee/apigee-service/bin/apigee-service apigee-monit summary

    이러한 각 명령어는 다음 섹션에서 더 자세히 설명합니다.

    보고서

    report 명령어는 실행 중인 구성요소 수와 현재 초기화 중이거나 노드에서 현재 모니터링되지 않는 상태입니다. 이 다음 예시에서는 report 명령어를 호출합니다.

    /opt/apigee/apigee-service/bin/apigee-service apigee-monit report

    다음 예는 AIO (올인원)의 report 출력을 보여줍니다. 구성:

    /opt/apigee/apigee-service/bin/apigee-service apigee-monit report
    up:            11 (100.0%)
    down:           0 (0.0%)
    initialising:   0 (0.0%)
    unmonitored:    1 (8.3%)
    total:         12 services

    이 예에서는 서비스 12개 중 11개가 작동 중인 것으로 apigee-monit에 의해 보고됩니다. 하나의 서비스는 있습니다

    다음을 처음 실행할 때 Connection refused 오류가 발생할 수 있습니다. report 명령어. 이 경우에는 conf_monit_monit_delay_time 속성을 설정한 후 다시 시도하세요.

    요약

    summary 명령어는 각 구성요소를 나열하고 상태를 제공합니다. 다음 예시는 summary 명령어를 호출합니다.

    /opt/apigee/apigee-service/bin/apigee-service apigee-monit summary

    다음 예는 AIO (올인원)의 summary 출력을 보여줍니다. 구성:

    /opt/apigee/apigee-service/bin/apigee-service apigee-monit summary
    Monit 5.25.1 uptime: 4h 20m
     Service Name                     Status                      Type
     host_name                        OK                          System
     apigee-zookeeper                 OK                          Process
     apigee-cassandra                 OK                          Process
     apigee-openldap                  OK                          Process
     apigee-qpidd                     OK                          Process
     apigee-postgresql                OK                          Process
     edge-ui                          OK                          Process
     edge-qpid-server                 OK                          Remote Host
     edge-postgres-server             OK                          Remote Host
     edge-management-server           OK                          Remote Host
     edge-router                      OK                          Remote Host
     edge-message-processor           OK                          Remote Host

    다음을 처음 실행할 때 Connection refused 오류가 발생하면 summary 명령어를 사용하는 경우 conf_monit_monit_delay_time 속성을 설정한 후 다시 시도하세요.

    Apigee-monit 모니터링

    apigee-monit가 각 노드에서 실행 중인지 정기적으로 확인하는 것이 좋습니다.

    apigee-monit가 실행 중인지 확인하려면 다음 명령어를 사용합니다.

    /opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor_monit

    Apigee는 apigee-monit를 실행하는 각 노드에서 이 명령어를 주기적으로 실행하는 것이 좋습니다. 이렇게 하는 한 가지 방법은 다음 위치에서 예약된 작업을 실행하는 cron와 같은 유틸리티를 사용하는 것입니다. 사전 정의된 간격을 사용합니다.

    cron를 사용하여 apigee-monit를 모니터링하려면 다음 안내를 따르세요.

    1. apigee-monit.cron를 복사하여 cron 지원을 추가합니다. 디렉터리를 /etc/cron.d 디렉터리로 이동합니다.
      cp /opt/apigee/apigee-monit/cron/apigee-monit.cron /etc/cron.d/
    2. apigee-monit.cron 파일을 열어 수정합니다.

      apigee-monit.cron 파일은 실행할 cron 작업을 정의합니다. 해당 작업을 실행하는 빈도에 따라 결정됩니다. 다음 예는 kubectl run을 사용하여 값:

      # Cron entry to check if monit process is running. If not start it
      */2 * * * * root /opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor_monit

      이 파일은 다음 구문을 사용하며 처음 다섯 개의 필드는 apigee-monit는 작업을 실행합니다.

      min hour day_of_month month day_of_week task_to_execute

      예를 들어 기본 실행 시간은 */2 * * * *이며 cron: 2분마다 apigee-monit 프로세스를 확인합니다.

      cron 작업을 1분에 한 번 이상 실행할 수 없습니다.

      cron 사용에 관한 자세한 내용은 서버 OS 문서 또는 매뉴얼을 참조하세요. 있습니다.

    3. 조직의 정책에 맞게 cron 설정을 변경합니다. 예를 들어 실행 빈도를 5분마다로 변경하고 작업 정의를 다음과 같이 설정합니다.
      */5 * * * * root /opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor_monit
    4. apigee-monit.cron 파일을 저장합니다.
    5. 클러스터의 각 노드에 이 절차를 반복합니다.

    cronapigee-monit 시청을 시작하지 않는 경우 다음을 확인하세요.

    • cron 작업 정의 뒤에 빈 줄이 있습니다.
    • 파일에 정의된 cron 작업이 하나만 있습니다. (주석 처리된 행은 count.)

    apigee-monit를 중지하거나 일시적으로 사용 중지하려면 이 cron 작업을 사용 중지해야 합니다. 그러지 않으면 cronapigee-monit를 다시 시작합니다.

    cron를 사용 중지하려면 다음 중 하나를 실행합니다.

    • /etc/cron.d/apigee-monit.cron 파일을 삭제합니다.
      sudo rm /etc/cron.d/apigee-monit.cron

      복사해야 하는 경우 나중에 cron를 다시 사용 설정하여 apigee-monit 동영상을 시청하려고 합니다.

      또는

    • /etc/cron.d/apigee-monit.cron 파일을 수정하고 작업을 주석 처리합니다. '#'을 추가하여 정의에 줄의 시작으로 예를 들면 다음과 같습니다.
      # 10 * * * * root /opt/apigee/apigee-service/bin/apigee-service apigee-monit monitor_monit