Edge 구성 방법

설치 후 Edge를 구성하려면 .properties 파일과 Edge 유틸리티를 함께 사용합니다. 예를 들어 Edge UI에서 TLS/SSL을 구성하려면 .properties 파일을 수정하여 필요한 속성을 설정합니다. .properties 파일을 변경하려면 영향을 받는 Edge 구성요소를 다시 시작해야 합니다.

Apigee는 .properties 파일을 수정하는 기법을 구성으로 코드화 (CwC로 약칭되기도 함)라고 합니다. 기본적으로 구성이 포함된 코드는 .properties 파일의 설정을 기반으로 하는 키/값 조회 도구입니다. 구성 코딩에서 키는 토큰이라고 합니다. 따라서 Edge를 구성하려면 .properties 파일에서 토큰을 설정합니다.

구성으로 코딩하면 Edge 구성요소가 제품과 함께 제공되는 기본값을 설정할 수 있고, 설치팀이 설치 토폴로지에 따라 이러한 설정을 재정의할 수 있으며, 고객이 원하는 속성을 재정의할 수 있습니다.

계층 구조로 생각하면 설정은 다음과 같이 정렬되며 고객 설정이 설치 프로그램 팀 또는 Apigee의 설정을 재정의하는 우선순위가 가장 높습니다.

  1. 고객
  2. 설치 프로그램
  3. 구성요소

토큰의 현재 값 확인

.properties 파일에서 토큰의 새 값을 설정하기 전에 먼저 다음 명령어를 사용하여 현재 값을 확인해야 합니다.

/opt/apigee/apigee-service/bin/apigee-service component_name configure -search token

여기서 component_name은 구성요소의 이름이고 token은 검사할 토큰입니다.

이 명령어는 구성요소의 .properties 파일 계층 구조를 검색하여 토큰의 현재 값을 확인합니다.

다음 예시에서는 라우터의 conf_http_HTTPRequest.line.limit 토큰의 현재 값을 확인합니다.

/opt/apigee/apigee-service/bin/apigee-service edge-router configure -search conf_http_HTTPRequest.line.limit

다음과 같은 출력이 표시됩니다.

Found key conf_http_HTTPRequest.line.limit, with value, 4k, in /opt/apigee/edge-router/token/default.properties

토큰 값이 #로 시작하면 주석 처리된 것이므로 특수 구문을 사용하여 변경해야 합니다. 자세한 내용은 현재 주석 처리된 토큰 설정을 참고하세요.

토큰의 전체 이름을 모르는 경우 grep와 같은 도구를 사용하여 속성 이름이나 키워드로 검색합니다. 자세한 내용은 토큰 찾기를 참고하세요.

속성 파일

수정 가능한 구성요소 구성 파일과 수정 불가능한 구성요소 구성 파일이 있습니다. 이 섹션에서는 이러한 파일을 설명합니다.

수정 가능한 구성요소 구성 파일

다음 표에는 Apigee 구성요소와 이러한 구성요소를 구성하기 위해 수정할 수 있는 속성 파일이 나열되어 있습니다.

구성요소 구성요소 이름 수정 가능한 구성 파일
Cassandra apigee-cassandra /opt/apigee/customer/application/cassandra.properties
Apigee SSO apigee-sso /opt/apigee/customer/application/sso.properties
관리 서버 edge-management-server /opt/apigee/customer/application/management-server.properties
메시지 프로세서 edge-message-processor /opt/apigee/customer/application/message-processor.properties
apigee-monit apigee-monit /opt/apigee/customer/application/monit.properties
기본 UI (새 Edge UI에는 영향을 미치지 않음) edge-ui /opt/apigee/customer/application/ui.properties
Edge UI (새 Edge UI만 해당, 기존 UI에는 영향을 미치지 않음) apigee-management-ui 해당 사항 없음 (설치 구성 파일 사용)
SymasLDAP apigee-openldap /opt/apigee/customer/application/openldap.properties
Postgres 서버 edge-postgres-server /opt/apigee/customer/application/postgres-server.properties
PostgreSQL 데이터베이스 apigee-postgresql /opt/apigee/customer/application/postgresql.properties
Qpid 서버 edge-qpid-server /opt/apigee/customer/application/qpid-server.properties
Qpidd apigee-qpidd /opt/apigee/customer/application/qpidd.properties
라우터 edge-router /opt/apigee/customer/application/router.properties
Zookeeper apigee-zookeeper /opt/apigee/customer/application/zookeeper.properties

이러한 구성요소 구성 파일 중 하나에서 속성을 설정하고 싶지만 속성이 없는 경우 위에 나열된 위치에 속성을 만들면 됩니다.

또한 속성 파일이 'apigee' 사용자가 소유해야 합니다.

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

수정할 수 없는 구성요소 구성 파일

수정 가능한 구성요소 구성 파일 외에도 수정할 수 없는 구성 파일이 있습니다.

정보 (수정 불가) 파일에는 다음이 포함됩니다.

소유자 파일 이름 또는 디렉터리
설치
/opt/apigee/token
구성요소
/opt/apigee/component_name/conf

여기서 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/customer/application 디렉터리의 .properties 파일만 수정할 수 있습니다. 각 구성요소에는 해당 디렉터리에 자체 .properties 파일이 있습니다. 예를 들면 router.propertiesmanagement-server.properties입니다. 속성 파일의 전체 목록은 .properties 파일의 위치를 참고하세요.

.properties 파일을 만들려면 다음 단계를 따르세요.

  1. 편집기에서 새 텍스트 파일을 만듭니다. 파일 이름은 고객 파일의 경우 위의 표에 표시된 목록과 일치해야 합니다.
  2. 다음 예시와 같이 파일의 소유자를 'apigee:apigee'로 변경합니다.
    chown apigee:apigee /opt/apigee/customer/application/router.properties

    Edge 서비스를 실행하는 사용자를 'apigee' 사용자에서 변경한 경우 chown를 사용하여 소유권을 Edge 서비스를 실행하는 사용자로 변경합니다.

Edge를 업그레이드하면 /opt/apigee/customer/application 디렉터리의 .properties 파일이 읽힙니다. 즉, 업그레이드 시 구성요소에 설정한 속성이 유지됩니다.

토큰 값을 설정하려면 다음 단계를 따르세요.

  1. 구성요소의 .properties 파일을 수정합니다.
  2. 토큰 값을 추가하거나 변경합니다. 다음 예시에서는 conf_http_HTTPRequest.line.limit 속성 값을 '10k'로 설정합니다.
    conf_http_HTTPRequest.line.limit=10k

    토큰이 여러 값을 사용하는 경우 다음 예와 같이 각 값을 쉼표로 구분합니다.

    conf_security_rbac.restricted.resources=/environments,/environments/*,/environments/*/virtualhosts,/environments/*/virtualhosts/*,/pods,/environments/*/servers,/rebuildindex,/users/*/status,/myuri/*

    이와 같은 목록에 새 값을 추가하려면 일반적으로 목록의 끝에 새 값을 추가합니다.

  3. 구성요소를 다시 시작합니다.
    /opt/apigee/apigee-service/bin/apigee-service component_name restart

    여기서 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)

    예를 들어 router.properties를 수정한 후 라우터를 다시 시작합니다.

    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
  4. (선택사항) configure -search 옵션을 사용하여 토큰 값이 새 값으로 설정되었는지 확인합니다. 예를 들면 다음과 같습니다.
    /opt/apigee/apigee-service/bin/apigee-service edge-router configure -search conf_http_HTTPRequest.line.limit

    configure -search에 대한 자세한 내용은 토큰의 현재 값 확인을 참고하세요.

토큰 찾기

대부분의 경우 설정해야 하는 토큰은 이 가이드에 나와 있습니다. 하지만 전체 이름이나 위치를 알 수 없는 기존 토큰의 값을 재정의해야 하는 경우 grep를 사용하여 구성요소의 source 디렉터리를 검색하세요.

예를 들어 이전 Edge 버전에서 session.maxAge 속성을 설정했고 이를 설정하는 데 사용된 토큰 값을 알고 싶다면 /opt/apigee/edge-ui/source 디렉터리에서 속성의 grep를 확인합니다.

grep -ri "session.maxAge" /opt/apigee/edge-ui/source

다음과 같은 형식으로 결과가 표시됩니다.

/opt/apigee/component_name/source/conf/application.conf:property_name={T}token_name{/T}

다음 예시에서는 UI의 session.maxAge 토큰 값을 보여줍니다.

/opt/apigee/edge-ui/source/conf/application.conf:session.maxAge={T}conf_application_session.maxage{/T}

{T}{/T} 태그 사이의 문자열은 UI의 .properties 파일에서 설정할 수 있는 토큰의 이름입니다.

현재 주석 처리된 토큰 설정

일부 토큰은 Edge 구성 파일에서 주석 처리되어 있습니다. 설치 또는 구성요소 구성 파일에서 주석 처리된 토큰을 설정하려고 하면 설정이 무시됩니다.

Edge 구성 파일에서 주석 처리된 토큰의 값을 설정하려면 다음 형식의 특수 구문을 사용하세요.

conf/filename+propertyName=propertyValue

예를 들어 메시지 프로세서에서 HTTPClient.proxy.host라는 속성을 설정하려면 먼저 속성의 grep를 호출하여 토큰을 확인합니다.

grep -ri /opt/apigee/edge-message-processor/ -e "HTTPClient.proxy.host"

grep 명령어는 토큰 이름이 포함된 결과를 반환합니다. # 접두사로 표시된 것처럼 속성 이름이 주석 처리되는 방식을 확인하세요.

source/conf/http.properties:#HTTPClient.proxy.host={T}conf_http_HTTPClient.proxy.host{/T}
token/default.properties:conf_http_HTTPClient.proxy.host=
conf/http.properties:#HTTPClient.proxy.host=

이 속성의 값을 설정하려면 /opt/apigee/customer/application/message-processor.properties를 수정하되 다음 예와 같이 특수 구문을 사용하세요.

conf/http.properties+HTTPClient.proxy.host=myhost.name.com

이 경우 속성 이름에 conf/http.properties+을 접두사로 붙여야 합니다. 이는 속성을 포함하는 구성 파일의 위치와 이름이며 뒤에 '+'가 붙습니다.

메시지 프로세서를 다시 시작한 후 /opt/apigee/edge-message-processor/conf/http.properties 파일을 검사합니다.

cat /opt/apigee/edge-message-processor/conf/http.properties

파일 끝에 다음과 같은 형식으로 속성 집합이 표시됩니다.

conf/http.properties:HTTPClient.proxy.host=myhost.name.com

Trace UI의 요청 보내기 섹션에서 요청에 대한 전달 프록시 구성

이 섹션에서는 선택적 프록시 사용자 인증 정보를 사용하여 추적 UI의 요청 보내기 섹션에서 요청에 대한 전달 프록시를 구성하는 방법을 설명합니다. 전달 프록시를 구성하려면 다음 단계를 따르세요.

  1. /opt/apigee/customer/application/ui.properties을 수정하고 파일이 apigee:apigee 소유인지 확인합니다.
  2. 다음 재정의를 추가합니다 (값을 특정 프록시 구성으로 변경).
    conf_application_http.proxyhost=proxy.example.com
    conf_application_http.proxyport=8080
    conf_application_http.proxyuser=apigee
    conf_application_http.proxypassword=Apigee123!
  3. 기본 UI를 저장하고 다시 시작합니다.

Apigee 라우터/Nginx에 맞춤 로그 형식 추가

경우에 따라 기본 Apigee 라우터/Nginx 로그 형식을 변경하거나 변수를 추가해야 할 수 있습니다. 기본 Apigee 라우터/Nginx 로그 형식 구성 업데이트:

  1. router.properties 파일이 없으면 아래 경로를 사용하여 파일을 만듭니다.
    /opt/apigee/customer/application/router.properties
  2. 다음 콘텐츠를 router.properties 파일에 추가하여 이름이 router_new인 새 log_format 구성을 만듭니다.
    conf_load_balancing_load.balancing.driver.nginx.global.http.parameters.template.extra=log_format router_new 'time_iso8601\\\\thostname\\\\tremote_addr:remote_port\\\\t'\\\\n\\n 'upstream_addr\\\\trequest_time\\\\t-\\\\t-\\\\t'\\\\n\\n 'status\\\\tupstream_status\\\\trequest_length\\\\t'\\\\n\\n 'body_bytes_sent\\\\t'\\\\n\\n 'request\\\\tupstream_http_x_apigee_message_id\\\\t'\\\\n\\n 'http_user_agent\\\\thost\\thostname-pid-connection-connection_requests\\\\tmy_nginx_var_xff\\t'\\\\n\\n 'upstream_http_x_apigee_fault_flag\\\\tupstream_http_x_apigee_fault_source\\\\tupstream_http_x_apigee_fault_code\\\\t'\\\\n\\n 'upstream_http_x_apigee_fault_policy\\tupstream_http_x_apigee_fault_flow\\tupstream_http_x_apigee_fault_revision\\t'\\\\n\\n 'upstream_http_x_apigee_dp_color\\\\tmy_x_apigee_target_latency\\\\t'\\\\n\\n 'upstream_http_x_apigee_proxy\\\\tupstream_http_x_apigee_proxy_basepath\\\\t'\\\\n\\n 'self_region\\\\tself_pod\\\\tself_color\\\\tssl_protocol\\\\tssl_client_verify\\\\tssl_session_id\\\\tssl_session_reused\\\\tupstream_pod\\\\tupstream_region';\\\\n\\n\n
    conf_load_balancing_load.balancing.driver.nginx.access.log={conf_load_balancing_load.balancing.driver.nginx.log.dir}/{org}~{env}.{port}_access_log router_new

    위 명령어의 변수를 적절하게 업데이트합니다. log_format의 기본 구성 값은 아래 파일에서 확인할 수 있습니다.

    /opt/apigee/edge-router/conf/load_balancing.properties

    Nginx 변수 목록은 http://nginx.org/en/docs/varindex.html에 표시됩니다.

  3. 새 구성을 적용하려면 라우터를 다시 시작합니다.
    apigee-service edge-router restart
  4. log_format 구성(router_new)이 파일 /opt/nginx/conf.d/0-default.conf에 추가되었는지 확인합니다.
        
    cat /opt/nginx/conf.d/0-default.conf | grep router_new -A 10
  5. API 프록시에 API 요청을 보내고 파일에서 새 로그 형식을 확인합니다.
    /opt/apigee/var/log/edge-router/nginx/${org}~${env}.${port}_access_log file