Edge 구성 방법

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

Apigee는 .properties 파일을 편집하는 기법을 구성이 있는 코드 (CwC라고도 함)라고 합니다. 기본적으로 구성 코드는 .properties 파일의 설정에 기반한 키/값 조회 도구입니다. config가 있는 코드에서는 키를 토큰이라고 합니다. 따라서 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 해당 사항 없음 (설치 구성 파일 사용)
OpenLDAP 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/postgressql.properties
Qpid 서버 edge-qpid-server /opt/apigee/customer/application/qpid-server.properties
큐피드 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

    에지 서비스를 실행하는 사용자를 'apigee' 사용자로부터 변경했다면 chown를 사용하여 에지 서비스를 실행하는 사용자로 소유권을 변경합니다.

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의 요청 보내기 섹션에서 보내는 요청에 전달 프록시 구성

이 섹션에서는 선택적 프록시 사용자 인증 정보를 사용하여 Trace 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 Router/Nginx에서 커스텀 로그 형식 추가

경우에 따라 기본 Apigee Router/Nginx 로그 형식을 변경하거나 변수를 추가해야 했습니다. 기본 Apigee Router/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
    파일에서 새 로그 형식을 확인합니다.