• /
  • EnglishEspañolFrançais日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

호스트에서 레디스 모니터링(OpenTelemetry)

서버 또는 가상 머신에 직접 OpenTelemetry Collector를 설치하여 자체 호스팅 레디스 인스턴스를 모니터링하세요. 이 가이드는 수집기를 설정하여 레디스 메트릭을 스크랩하고, 로그를 수집하며, OTLP 프로토콜을 사용하여 모든 텔레메트리를 뉴렐릭으로 전송하는 과정을 안내합니다.

시작하기 전에

수집기를 설정하기 전에 다음이 필요합니다:

각 경로의 설정 단계는 NRDOT 수집기, otelcol-contrib 또는 redis_exporter 등 여전히 필요한 모든 설치를 다룹니다.

설치 옵션

환경에 맞는 수집기 배포판을 선택하세요:

레디스 모니터링 설정

이 설정은 수집기에게 레디스 메트릭을 수집하고 뉴렐릭으로 보내는 방법을 알려줍니다. 세 가지 주요 작업을 처리합니다:

  • redis 수신기를 통해 레디스에서 메트릭을 수집 합니다.

  • 데이터 가공 ― 카디널리티를 줄이고, 카운터를 델타로 변환하며, 엔티티 합성을 위해 태그를 지정합니다.

  • 처리된 메트릭을 OTLP를 통해 뉴렐릭으로 내보내기

    수집기 설정 파일을 만듭니다:

    bash
    $
    sudo nano /etc/nrdot-collector/redis-collector-config.yaml

    다음 설정을 붙여넣고, 레디스 endpoint 이(가) localhost:6379이(가) 아닌 경우 업데이트합니다:

    extensions:
    health_check:
    endpoint: "0.0.0.0:13133"
    receivers:
    redis:
    endpoint: "localhost:6379" # Update with your Redis host:port
    collection_interval: 10s
    metrics:
    redis.maxmemory:
    enabled: true
    redis.role:
    enabled: false
    redis.cmd.calls:
    enabled: true
    redis.cmd.usec:
    enabled: true
    redis.clients.max_input_buffer:
    enabled: false
    redis.clients.max_output_buffer:
    enabled: false
    redis.replication.backlog_first_byte_offset:
    enabled: false
    resource_attributes:
    server.address:
    enabled: true
    server.port:
    enabled: true
    processors:
    memory_limiter:
    check_interval: 5s
    limit_mib: 512
    spike_limit_mib: 128
    resource_detection:
    detectors: [env, system]
    timeout: 5s
    override: false
    system:
    resource_attributes:
    host.name:
    enabled: true
    host.id:
    enabled: true
    # Uncomment the section below to use a custom human-readable name for your
    # Redis entity instead of the default server.address:server.port identifier.
    # resource/redis:
    # attributes:
    # - key: redis.instance.id
    # value: "my-redis-instance"
    # action: upsert
    attributes/entity_tags:
    actions:
    - key: instrumentation.provider
    value: opentelemetry
    action: upsert
    cumulativetodelta:
    include:
    match_type: regexp
    metrics:
    - redis\.commands\.processed
    - redis\.connections\.received
    - redis\.connections\.rejected
    - redis\.keys\.evicted
    - redis\.keys\.expired
    - redis\.keyspace\.hits
    - redis\.keyspace\.misses
    - redis\.net\.input
    - redis\.net\.output
    - redis\.cpu\.time
    - redis\.cmd\.calls
    - redis\.cmd\.usec
    - redis\.uptime
    filter/cardinality:
    metrics:
    datapoint:
    - 'metric.name == "redis.cpu.time" and attributes["state"] != "sys" and attributes["state"] != "user"'
    - 'metric.name == "redis.cmd.calls" and attributes["cmd"] != "get" and attributes["cmd"] != "set" and attributes["cmd"] != "del" and attributes["cmd"] != "hget" and attributes["cmd"] != "hset" and attributes["cmd"] != "hgetall" and attributes["cmd"] != "lpush" and attributes["cmd"] != "rpop" and attributes["cmd"] != "zadd" and attributes["cmd"] != "expire"'
    - 'metric.name == "redis.cmd.usec" and attributes["cmd"] != "get" and attributes["cmd"] != "set" and attributes["cmd"] != "del" and attributes["cmd"] != "hget" and attributes["cmd"] != "hset" and attributes["cmd"] != "hgetall" and attributes["cmd"] != "lpush" and attributes["cmd"] != "rpop" and attributes["cmd"] != "zadd" and attributes["cmd"] != "expire"'
    transform/metadata_nullify:
    metric_statements:
    - context: metric
    statements:
    - set(description, "")
    - set(unit, "")
    batch:
    send_batch_size: 2048
    send_batch_max_size: 4096
    timeout: 10s
    exporters:
    otlp_http:
    endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT}
    headers:
    api-key: ${env:NEW_RELIC_LICENSE_KEY}
    compression: gzip
    service:
    extensions: [health_check]
    pipelines:
    metrics/redis:
    receivers: [redis]
    # If using resource/redis for custom name, add it to the processors list:
    # processors: [memory_limiter, resource_detection, resource/redis, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
    processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
    exporters: [otlp_http]

    이 설정의 역할

    파이프라인의 각 구성 요소에는 특정 작업이 있습니다:

    요소설명
    health_check수집기가 실행 중인지 확인할 수 있도록 0.0.0.0:13133 에 상태 엔드포인트를 노출합니다.
    redis 수신기10초마다 레디스 엔드포인트에 연결하고 레디스 INFO 명령에서 메트릭을 읽습니다. server.addressserver.port 가 엔티티의 ID가 됩니다.
    memory_limiter호스트를 보호하기 위해 수집기 메모리 사용량을 제한합니다(512 MiB 소프트 제한, 128 MiB 스파이크).
    resource_detection호스트를 감지하고 host.namehost.id을(를) 추가하여 레디스 메트릭을 기본 호스트 엔티티에 연결합니다.
    attributes/entity_tags쿼리 범위를 OpenTelemetry 경로로 지정할 수 있도록 모든 메트릭에 instrumentation.provider: opentelemetry 을(를) 찍습니다.
    cumulativetodelta뉴렐릭이 비율을 올바르게 차트로 표시할 수 있도록 레디스의 누적 카운터 ― 명령, 키스페이스 적중, 축출 등 ― 를 델타 값으로 변환합니다.
    filter/cardinality수집 비용을 제어하기 위해 높은 카디널리티 데이터 포인트(usersys 이외의 CPU 상태, 일반적이지 않은 명령에 대한 명령별 메트릭)를 삭제합니다.
    transform/metadata_nullify페이로드 크기를 줄이기 위해 메트릭 설명 및 단위를 지웁니다.
    batch네트워크 오버헤드를 줄이기 위해 내보내기 전에 데이터 포인트를 그룹화(배치당 2,048개, 최대 4,096개)하고 최소 10초마다 플러시합니다.
    otlp_http라이선스 키로 인증되고 gzip 압축을 사용하여 OTLP를 통해 처리된 메트릭을 뉴렐릭으로 내보냅니다.

    사용자 친화적인 엔티티 이름을 원하시나요? 기본적으로 레디스 엔티티의 이름은 server.address:server.port 조합을 사용하여 지정됩니다. 대신 사람이 읽을 수 있는 사용자 지정 이름을 사용하려면, 위의 구성에서 resource/redis 섹션의 주석 처리를 제거하고, redis.instance.id 값에 원하는 이름을 설정한 다음, 프로세서 파이프라인에 resource/redis 을(를) 추가하세요.

선택 사항: 인증 설정

기본적으로 수집기는 자격 증명 없이 레디스에 연결합니다. 레디스 인스턴스에 인증이 필요한 경우, 일치하는 자격 증명을 redis 수신기에 추가하세요. 설정에 맞는 옵션을 선택하세요:

선택 사항: 레디스 로그 수집

메트릭 외에도 수집기는 레디스의 로그 파일을 뉴렐릭으로 전달할 수 있으므로 로그 이벤트 ― 재시작, 지속성 이벤트 또는 오류 ― 를 동일한 엔티티의 메트릭 스파이크와 연관시킬 수 있습니다. 레디스 로그를 추적하려면 filelog 수신자를 추가합니다:

receivers:
# ... existing redis receiver ...
file_log/redis:
include:
- /var/log/redis/redis-server.log
start_at: end
operators:
- type: regex_parser
regex: '^\d+:[XCSM] \d+ \w+ \d+ \d+:\d+:\d+\.\d+ (?P<level>.) '
on_error: send
resource:
db.system: redis

파일의 로그 줄에는 자체적인 레디스 연결 컨텍스트가 없습니다 ― 뉴렐릭이 로그를 레디스 엔티티와 연결하도록 명시적으로 ID 속성을 추가해야 합니다. 레디스 엔티티의 ID와 일치하는 하드코딩된 값을 사용하여 resource/redis_logs 프로세서를 추가합니다:

processors:
# ... existing processors ...
resource/redis_logs:
attributes:
- key: server.address
value: "localhost" # Must match your redis receiver endpoint host
action: upsert
- key: server.port
value: 6379 # Must match your redis receiver endpoint port
action: upsert
- key: instrumentation.provider
value: opentelemetry
action: upsert

사용자 지정 인스턴스 ID를 사용하시나요? 사용자 지정 엔티티 명명에 resource/redis 프로세서를 활성화한 경우, 위의 server.addressserver.portredis.instance.id(으)로 바꿉니다:

resource/redis_logs:
attributes:
- key: redis.instance.id
value: "my-redis-instance" # Must match the value in resource/redis
action: upsert
- key: instrumentation.provider
value: opentelemetry
action: upsert

서비스 섹션에 별도의 로그 파이프라인을 추가합니다:

service:
pipelines:
metrics/redis:
receivers: [redis]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]
logs/redis:
receivers: [file_log/redis]
processors: [memory_limiter, resource/redis_logs, batch]
exporters: [otlp_http]

중요

수집기는 레디스 로그 파일과 그 상위 디렉터리 모두에 대한 읽기 액세스 권한이 있어야 합니다. 실행:

bash
$
sudo chmod 755 /var/log/redis
$
sudo chmod 644 /var/log/redis/redis-server.log

선택 사항: 호스트 메트릭 수집

레디스 성능은 종종 호스트 리소스 압박 ― CPU 포화, 메모리 고갈 또는 디스크 I/O 경합을 추적합니다. 뉴렐릭에서 두 가지를 상호 연관시킬 수 있도록 호스트에서 레디스와 함께 시스템 메트릭을 수집하는 hostmetrics 수신기를 추가합니다:

receivers:
# ... existing receivers ...
host_metrics:
collection_interval: 10s
scrapers:
cpu:
metrics:
system.cpu.utilization: {enabled: true}
system.cpu.time: {enabled: true}
load:
metrics:
system.cpu.load_average.1m: {enabled: true}
system.cpu.load_average.5m: {enabled: true}
system.cpu.load_average.15m: {enabled: true}
memory:
metrics:
system.memory.usage: {enabled: true}
system.memory.utilization: {enabled: true}
disk:
metrics:
system.disk.io: {enabled: true}
system.disk.operations: {enabled: true}
filesystem:
metrics:
system.filesystem.usage: {enabled: true}
system.filesystem.utilization: {enabled: true}
network:
metrics:
system.network.io: {enabled: true}
system.network.packets: {enabled: true}

호스트 메트릭을 위한 별도의 metrics/host 파이프라인을 추가합니다(레디스 파이프라인에 hostmetrics 을(를) 추가하지 마십시오):

service:
pipelines:
metrics/redis:
receivers: [redis]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]
metrics/host:
receivers: [host_metrics]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, batch]
exporters: [otlp_http]

선택 사항: 커스텀 메타데이터 추가

사용자 지정 리소스 속성은 모든 레디스 메트릭에 컨텍스트 ― 환경, 팀 또는 티어 ― 를 태그로 지정하여 뉴렐릭에서 데이터를 필터링하고 그룹화할 수 있도록 합니다. 원하는 태그가 있는 resource/custom 프로세서를 추가합니다:

processors:
# ... existing processors ...
resource/custom:
attributes:
- key: environment
value: "production"
action: upsert
- key: team
value: "platform"
action: upsert
- key: redis.cluster
value: "cache-tier-1"
action: upsert

파이프라인에 프로세서를 포함하세요:

service:
pipelines:
metrics/redis:
receivers: [redis]
processors: [memory_limiter, resource_detection, resource/custom, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]

선택 사항: 레디스 Cluster 모니터링 활성화

레디스 Cluster 모니터링은 현재 Prometheus 수신기 방식(redis_exporter 사용)이 필요합니다. NRDOT Collector의 기본 레디스 수신기는 클러스터 메트릭에 필요한 CLUSTER INFO 명령을 아직 지원하지 않습니다. 클러스터 모니터링 설정을 위해 Prometheus 수신기 탭을 사용하세요.

환경 변수 설정

수집기는 환경 파일에서 배포별 값 ― 라이선스 키, OTLP 엔드포인트, 구성(config) 경로 ― 을 읽어 구성(config) YAML에 시크릿이 노출되지 않도록 합니다. 환경 파일을 생성합니다:

bash
$
sudo tee /etc/nrdot-collector/nrdot-collector.conf > /dev/null <<'EOF'
$
NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY
$
OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTLP_ENDPOINT
$
# Set the New Relic OTLP endpoint for your region.
$
# See https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp
$
OTELCOL_OPTIONS="--config=/etc/nrdot-collector/redis-collector-config.yaml"
$
EOF
$
sudo chmod 600 /etc/nrdot-collector/nrdot-collector.conf

플레이스홀더를 자체 값으로 바꿉니다:

변하기 쉬운필수의설명
NEW_RELIC_LICENSE_KEY귀하의 뉴렐릭 수집 라이선스 키.
OTEL_EXPORTER_OTLP_ENDPOINT해당 리전의 뉴렐릭 OTLP 엔드포인트. 자세한 내용은 뉴렐릭 OTLP 엔드포인트를 참조하세요.
OTELCOL_OPTIONS수집기가 레디스 구성 파일을 가리키도록 합니다.

이 설정은 기본 NRDot 설정을 대체합니다. 레디스 모니터링과 함께 기본 NRDot 파이프라인을 유지해야 하는 경우, 기본 설정 파일도 추가하세요:

bash
$
OTELCOL_OPTIONS="--config=/etc/nrdot-collector/config.yaml --config=/etc/nrdot-collector/redis-collector-config.yaml"

여러 구성(config) 파일을 사용할 때 파일 간에 충돌하는 구성 요소 이름이 없는지 확인합니다. 접미사를 추가하여 레디스 구성(config)에서 중복되는 프로세서의 이름을 바꿉니다(예: memory_limiter 대신 memory_limiter/redis).

다시 시작 및 확인

수집기를 다시 시작하여 새 설정을 로드합니다:

bash
$
sudo systemctl daemon-reload
$
sudo systemctl restart nrdot-collector
$
sudo systemctl status nrdot-collector

status 명령은 Active: active (running)을(를) 표시해야 합니다. Active: failed가 표시되면 journalctl -u nrdot-collector -n 100 --no-pager 을(를) 사용하여 로그를 확인합니다 ― 가장 일반적인 원인은 YAML 들여쓰기 오류와 연결할 수 없는 레디스 엔드포인트입니다.

그런 다음 메트릭이 뉴렐릭에 도달하는지 확인합니다. 다시 시작한 후 약 1분 정도 기다렸다가 쿼리 빌더에서 다음 쿼리를 실행합니다:

SELECT count(*) FROM Metric WHERE metricName LIKE 'redis.%' AND instrumentation.provider = 'opentelemetry' SINCE 5 minutes ago

0이 아닌 개수는 레디스 메트릭이 전송되고 있음을 확인합니다. 0을(를) 반환하는 경우, 레디스 문제 해결(OpenTelemetry)을 참조하세요.

수집기 설치

아직 없는 경우 OpenTelemetry Collector Contrib 를 설치합니다:

설치 후 수집기는 otelcol-contrib.service이라는 systemd 서비스로 사용할 수 있습니다.

레디스 모니터링 설정

이 설정은 수집기에게 레디스 메트릭을 수집하고 뉴렐릭으로 보내는 방법을 알려줍니다. 세 가지 주요 작업을 처리합니다:

  • redis 수신기를 통해 레디스에서 메트릭을 수집 합니다.

  • 데이터 가공 ― 카디널리티를 줄이고, 카운터를 델타로 변환하며, 엔티티 합성을 위해 태그를 지정합니다.

  • 처리된 메트릭을 OTLP를 통해 뉴렐릭으로 내보내기

    수집기 설정 파일을 만듭니다:

    bash
    $
    sudo nano /etc/otelcol-contrib/redis-collector-config.yaml

    다음 설정을 붙여넣고, 레디스 endpoint 이(가) localhost:6379이(가) 아닌 경우 업데이트합니다:

    extensions:
    health_check:
    endpoint: "0.0.0.0:13133"
    receivers:
    redis:
    endpoint: "localhost:6379" # Update with your Redis host:port
    collection_interval: 10s
    metrics:
    redis.maxmemory:
    enabled: true
    redis.role:
    enabled: false
    redis.cmd.calls:
    enabled: true
    redis.cmd.usec:
    enabled: true
    redis.clients.max_input_buffer:
    enabled: false
    redis.clients.max_output_buffer:
    enabled: false
    redis.replication.backlog_first_byte_offset:
    enabled: false
    resource_attributes:
    server.address:
    enabled: true
    server.port:
    enabled: true
    processors:
    memory_limiter:
    check_interval: 5s
    limit_mib: 512
    spike_limit_mib: 128
    resource_detection:
    detectors: [env, system]
    timeout: 5s
    override: false
    system:
    resource_attributes:
    host.name:
    enabled: true
    host.id:
    enabled: true
    # Uncomment the section below to use a custom human-readable name for your
    # Redis entity instead of the default server.address:server.port identifier.
    # resource/redis:
    # attributes:
    # - key: redis.instance.id
    # value: "my-redis-instance"
    # action: upsert
    attributes/entity_tags:
    actions:
    - key: instrumentation.provider
    value: opentelemetry
    action: upsert
    cumulativetodelta:
    include:
    match_type: regexp
    metrics:
    - redis\.commands\.processed
    - redis\.connections\.received
    - redis\.connections\.rejected
    - redis\.keys\.evicted
    - redis\.keys\.expired
    - redis\.keyspace\.hits
    - redis\.keyspace\.misses
    - redis\.net\.input
    - redis\.net\.output
    - redis\.cpu\.time
    - redis\.cmd\.calls
    - redis\.cmd\.usec
    - redis\.uptime
    filter/cardinality:
    metrics:
    datapoint:
    - 'metric.name == "redis.cpu.time" and attributes["state"] != "sys" and attributes["state"] != "user"'
    - 'metric.name == "redis.cmd.calls" and attributes["cmd"] != "get" and attributes["cmd"] != "set" and attributes["cmd"] != "del" and attributes["cmd"] != "hget" and attributes["cmd"] != "hset" and attributes["cmd"] != "hgetall" and attributes["cmd"] != "lpush" and attributes["cmd"] != "rpop" and attributes["cmd"] != "zadd" and attributes["cmd"] != "expire"'
    - 'metric.name == "redis.cmd.usec" and attributes["cmd"] != "get" and attributes["cmd"] != "set" and attributes["cmd"] != "del" and attributes["cmd"] != "hget" and attributes["cmd"] != "hset" and attributes["cmd"] != "hgetall" and attributes["cmd"] != "lpush" and attributes["cmd"] != "rpop" and attributes["cmd"] != "zadd" and attributes["cmd"] != "expire"'
    transform/metadata_nullify:
    metric_statements:
    - context: metric
    statements:
    - set(description, "")
    - set(unit, "")
    batch:
    send_batch_size: 2048
    send_batch_max_size: 4096
    timeout: 10s
    exporters:
    otlp_http:
    endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT}
    headers:
    api-key: ${env:NEW_RELIC_LICENSE_KEY}
    compression: gzip
    service:
    extensions: [health_check]
    pipelines:
    metrics/redis:
    receivers: [redis]
    # If using resource/redis for custom name, add it to the processors list:
    # processors: [memory_limiter, resource_detection, resource/redis, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
    processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
    exporters: [otlp_http]

    이 설정의 역할

    파이프라인의 각 구성 요소에는 특정 작업이 있습니다:

    요소설명
    health_check수집기가 실행 중인지 확인할 수 있도록 0.0.0.0:13133 에 상태 엔드포인트를 노출합니다.
    redis 수신기10초마다 레디스 엔드포인트에 연결하고 레디스 INFO 명령에서 메트릭을 읽습니다. server.addressserver.port 가 엔티티의 ID가 됩니다.
    memory_limiter호스트를 보호하기 위해 수집기 메모리 사용량을 제한합니다(512 MiB 소프트 제한, 128 MiB 스파이크).
    resource_detection호스트를 감지하고 host.namehost.id을(를) 추가하여 레디스 메트릭을 기본 호스트 엔티티에 연결합니다.
    attributes/entity_tags쿼리 범위를 OpenTelemetry 경로로 지정할 수 있도록 모든 메트릭에 instrumentation.provider: opentelemetry 을(를) 찍습니다.
    cumulativetodelta뉴렐릭이 비율을 올바르게 차트로 표시할 수 있도록 레디스의 누적 카운터 ― 명령, 키스페이스 적중, 축출 등 ― 를 델타 값으로 변환합니다.
    filter/cardinality수집 비용을 제어하기 위해 높은 카디널리티 데이터 포인트(usersys 이외의 CPU 상태, 일반적이지 않은 명령에 대한 명령별 메트릭)를 삭제합니다.
    transform/metadata_nullify페이로드 크기를 줄이기 위해 메트릭 설명 및 단위를 지웁니다.
    batch네트워크 오버헤드를 줄이기 위해 내보내기 전에 데이터 포인트를 그룹화(배치당 2,048개, 최대 4,096개)하고 최소 10초마다 플러시합니다.
    otlp_http라이선스 키로 인증되고 gzip 압축을 사용하여 OTLP를 통해 처리된 메트릭을 뉴렐릭으로 내보냅니다.

    사용자 친화적인 엔티티 이름을 원하시나요? 기본적으로 레디스 엔티티의 이름은 server.address:server.port 조합을 사용하여 지정됩니다. 대신 사람이 읽을 수 있는 사용자 지정 이름을 사용하려면, 위의 구성에서 resource/redis 섹션의 주석 처리를 제거하고, redis.instance.id 값에 원하는 이름을 설정한 다음, 프로세서 파이프라인에 resource/redis 을(를) 추가하세요.

선택 사항: 인증 설정

기본적으로 수집기는 자격 증명 없이 레디스에 연결합니다. 레디스 인스턴스에 인증이 필요한 경우, 일치하는 자격 증명을 redis 수신기에 추가하세요. 설정에 맞는 옵션을 선택하세요:

선택 사항: 레디스 로그 수집

메트릭 외에도 수집기는 레디스의 로그 파일을 뉴렐릭으로 전달할 수 있으므로 로그 이벤트 ― 재시작, 지속성 이벤트 또는 오류 ― 를 동일한 엔티티의 메트릭 스파이크와 연관시킬 수 있습니다. 레디스 로그를 추적하려면 filelog 수신자를 추가합니다:

receivers:
# ... existing redis receiver ...
file_log/redis:
include:
- /var/log/redis/redis-server.log
start_at: end
operators:
- type: regex_parser
regex: '^\d+:[XCSM] \d+ \w+ \d+ \d+:\d+:\d+\.\d+ (?P<level>.) '
on_error: send
resource:
db.system: redis

파일의 로그 줄에는 자체적인 레디스 연결 컨텍스트가 없습니다 ― 뉴렐릭이 로그를 레디스 엔티티와 연결하도록 명시적으로 ID 속성을 추가해야 합니다. 레디스 엔티티의 ID와 일치하는 하드코딩된 값을 사용하여 resource/redis_logs 프로세서를 추가합니다:

processors:
# ... existing processors ...
resource/redis_logs:
attributes:
- key: server.address
value: "localhost" # Must match your redis receiver endpoint host
action: upsert
- key: server.port
value: 6379 # Must match your redis receiver endpoint port
action: upsert
- key: instrumentation.provider
value: opentelemetry
action: upsert

사용자 지정 인스턴스 ID를 사용하시나요? 사용자 지정 엔티티 명명에 resource/redis 프로세서를 활성화한 경우, 위의 server.addressserver.portredis.instance.id(으)로 바꿉니다:

resource/redis_logs:
attributes:
- key: redis.instance.id
value: "my-redis-instance" # Must match the value in resource/redis
action: upsert
- key: instrumentation.provider
value: opentelemetry
action: upsert

서비스 섹션에 별도의 로그 파이프라인을 추가합니다:

service:
pipelines:
metrics/redis:
receivers: [redis]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]
logs/redis:
receivers: [file_log/redis]
processors: [memory_limiter, resource/redis_logs, batch]
exporters: [otlp_http]

중요

수집기는 레디스 로그 파일과 그 상위 디렉터리 모두에 대한 읽기 액세스 권한이 있어야 합니다. 실행:

bash
$
sudo chmod 755 /var/log/redis
$
sudo chmod 644 /var/log/redis/redis-server.log

선택 사항: 호스트 메트릭 수집

레디스 성능은 종종 호스트 리소스 압박 ― CPU 포화, 메모리 고갈 또는 디스크 I/O 경합을 추적합니다. 뉴렐릭에서 두 가지를 상호 연관시킬 수 있도록 호스트에서 레디스와 함께 시스템 메트릭을 수집하는 hostmetrics 수신기를 추가합니다:

receivers:
# ... existing receivers ...
host_metrics:
collection_interval: 10s
scrapers:
cpu:
metrics:
system.cpu.utilization: {enabled: true}
system.cpu.time: {enabled: true}
load:
metrics:
system.cpu.load_average.1m: {enabled: true}
system.cpu.load_average.5m: {enabled: true}
system.cpu.load_average.15m: {enabled: true}
memory:
metrics:
system.memory.usage: {enabled: true}
system.memory.utilization: {enabled: true}
disk:
metrics:
system.disk.io: {enabled: true}
system.disk.operations: {enabled: true}
filesystem:
metrics:
system.filesystem.usage: {enabled: true}
system.filesystem.utilization: {enabled: true}
network:
metrics:
system.network.io: {enabled: true}
system.network.packets: {enabled: true}

호스트 메트릭을 위한 별도의 metrics/host 파이프라인을 추가합니다(레디스 파이프라인에 host_metrics 을(를) 추가하지 마십시오):

service:
pipelines:
metrics/redis:
receivers: [redis]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]
metrics/host:
receivers: [host_metrics]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, batch]
exporters: [otlp_http]

선택 사항: 레디스 Cluster 모니터링 활성화

레디스 Cluster 모니터링은 현재 Prometheus 수신기 방식(redis_exporter 사용)이 필요합니다. OpenTelemetry Collector Contrib의 기본 레디스 수신기는 클러스터 메트릭에 필요한 CLUSTER INFO 명령을 아직 지원하지 않습니다. 클러스터 모니터링 설정을 위해 Prometheus 수신기 탭을 사용하세요.

환경 변수 설정

수집기는 환경 파일에서 배포별 값 ― 라이선스 키, OTLP 엔드포인트, 구성(config) 경로 ― 을 읽어 구성(config) YAML에 시크릿이 노출되지 않도록 합니다. 환경 파일을 생성합니다:

bash
$
sudo tee /etc/otelcol-contrib/otelcol-contrib.conf > /dev/null <<'EOF'
$
NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY
$
OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTLP_ENDPOINT
$
# Set the New Relic OTLP endpoint for your region.
$
# See https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp
$
OTELCOL_OPTIONS="--config=/etc/otelcol-contrib/redis-collector-config.yaml"
$
EOF
$
sudo chmod 600 /etc/otelcol-contrib/otelcol-contrib.conf

플레이스홀더를 자체 값으로 바꿉니다:

변하기 쉬운필수의설명
NEW_RELIC_LICENSE_KEY귀하의 뉴렐릭 수집 라이선스 키.
OTEL_EXPORTER_OTLP_ENDPOINT해당 리전의 뉴렐릭 OTLP 엔드포인트. 자세한 내용은 뉴렐릭 OTLP 엔드포인트를 참조하세요.
OTELCOL_OPTIONS수집기가 레디스 구성 파일을 가리키도록 합니다.

이 설정은 기본 OTel Collector Contrib 설정을 대체합니다. 레디스 모니터링과 함께 기본 구성(config)을 유지해야 하는 경우 기본 구성(config) 파일도 추가합니다:

bash
$
OTELCOL_OPTIONS="--config=/etc/otelcol-contrib/config.yaml --config=/etc/otelcol-contrib/redis-collector-config.yaml"

여러 구성(config) 파일을 사용할 때 파일 간에 충돌하는 구성 요소 이름이 없는지 확인합니다. 접미사를 추가하여 레디스 구성(config)에서 중복되는 프로세서의 이름을 바꿉니다(예: memory_limiter 대신 memory_limiter/redis).

다시 시작 및 확인

수집기를 다시 시작하여 새 설정을 로드합니다:

bash
$
sudo systemctl daemon-reload
$
sudo systemctl restart otelcol-contrib
$
sudo systemctl status otelcol-contrib

status 명령은 Active: active (running)을(를) 표시해야 합니다. Active: failed가 표시되면 journalctl -u otelcol-contrib -n 100 --no-pager 을(를) 사용하여 로그를 확인합니다 ― 가장 일반적인 원인은 YAML 들여쓰기 오류와 연결할 수 없는 레디스 엔드포인트입니다.

그런 다음 메트릭이 뉴렐릭에 도달하는지 확인합니다. 다시 시작한 후 약 1분 정도 기다렸다가 쿼리 빌더에서 다음 쿼리를 실행합니다:

SELECT count(*) FROM Metric WHERE metricName LIKE 'redis.%' AND instrumentation.provider = 'opentelemetry' SINCE 5 minutes ago

0이 아닌 개수는 레디스 메트릭이 전송되고 있음을 확인합니다. 0을(를) 반환하는 경우, 레디스 문제 해결(OpenTelemetry)을 참조하세요.

redis_exporter 설치

redis_exporter 는 포트 9121에서 Prometheus 형식으로 레디스 메트릭을 노출합니다.

redis_exporter에 대한 systemd 서비스를 생성합니다:

bash
$
sudo tee /etc/systemd/system/redis_exporter.service > /dev/null <<'EOF'
$
[Unit]
$
Description=Redis Exporter
$
After=network.target
$
$
[Service]
$
ExecStart=/usr/local/bin/redis_exporter --redis.addr=redis://localhost:6379
$
Restart=always
$
User=nobody
$
$
[Install]
$
WantedBy=multi-user.target
$
EOF
$
$
sudo systemctl daemon-reload
$
sudo systemctl enable --now redis_exporter

익스포터가 실행 중인지 확인합니다:

bash
$
curl -s http://localhost:9121/metrics | grep redis_up

redis_up 1이(가) 표시되어야 합니다.

수집기 설정 생성

이 설정은 redis_exporter 에서 메트릭을 스크랩하여 뉴렐릭으로 보냅니다. 다음과 같은 주요 작업을 처리합니다:

  • prometheus 수신기를 통해 redis_exporter Prometheus 엔드포인트를 스크랩 합니다.

  • Prometheus 메트릭을 뉴렐릭의 레디스 메트릭 이름으로 이름 바꾸기

  • 데이터 가공 ― 카디널리티를 줄이고, 카운터를 델타로 변환하며, 엔티티 합성을 위해 태그를 지정합니다.

  • 처리된 메트릭을 OTLP를 통해 뉴렐릭으로 내보내기

    구성(config) 파일을 생성합니다. 수집기에 적합한 경로를 사용합니다:

  • NRDOT: /etc/nrdot-collector/redis-prometheus-config.yaml

  • OTel Contrib: /etc/otelcol-contrib/redis-prometheus-config.yaml

    extensions:
    health_check:
    endpoint: "0.0.0.0:13133"
    receivers:
    prometheus:
    config:
    scrape_configs:
    - job_name: 'redis'
    scrape_interval: 10s
    static_configs:
    - targets: ['localhost:9121'] # Update with your Redis exporter host:port
    metric_relabel_configs:
    - source_labels: [__name__]
    regex: '(go_|process_|promhttp_|redis_exporter_).*'
    action: drop
    processors:
    memory_limiter:
    check_interval: 5s
    limit_mib: 512
    spike_limit_mib: 128
    resource_detection:
    detectors: [env, system]
    timeout: 5s
    override: false
    system:
    resource_attributes:
    host.name:
    enabled: true
    host.id:
    enabled: true
    # Required: Set a unique identifier for your Redis entity.
    # The Prometheus receiver does not provide server.address/server.port,
    # so redis.instance.id is required for entity creation in New Relic.
    resource/redis_identity:
    attributes:
    - key: redis.instance.id
    value: "my-redis-instance:6379" # Update with a unique name for this Redis instance
    action: upsert
    attributes/entity_tags:
    actions:
    - key: instrumentation.provider
    value: opentelemetry
    action: upsert
    metricstransform:
    transforms:
    - include: redis_uptime_in_seconds
    action: update
    new_name: redis.uptime
    - include: redis_connected_clients
    action: update
    new_name: redis.clients.connected
    - include: redis_blocked_clients
    action: update
    new_name: redis.clients.blocked
    - include: redis_memory_used_bytes
    action: update
    new_name: redis.memory.used
    - include: redis_memory_max_bytes
    action: update
    new_name: redis.maxmemory
    - include: redis_mem_fragmentation_ratio
    action: update
    new_name: redis.memory.fragmentation_ratio
    - include: redis_memory_used_rss_bytes
    action: update
    new_name: redis.memory.rss
    - include: redis_memory_used_peak_bytes
    action: update
    new_name: redis.memory.peak
    - include: redis_memory_used_lua_bytes
    action: update
    new_name: redis.memory.lua
    - include: redis_connections_received_total
    action: update
    new_name: redis.connections.received
    - include: redis_rejected_connections_total
    action: update
    new_name: redis.connections.rejected
    - include: redis_commands_processed_total
    action: update
    new_name: redis.commands.processed
    - include: redis_keyspace_hits_total
    action: update
    new_name: redis.keyspace.hits
    - include: redis_keyspace_misses_total
    action: update
    new_name: redis.keyspace.misses
    - include: redis_evicted_keys_total
    action: update
    new_name: redis.keys.evicted
    - include: redis_expired_keys_total
    action: update
    new_name: redis.keys.expired
    - include: redis_net_input_bytes_total
    action: update
    new_name: redis.net.input
    - include: redis_net_output_bytes_total
    action: update
    new_name: redis.net.output
    - include: redis_connected_slaves
    action: update
    new_name: redis.slaves.connected
    - include: redis_db_keys
    action: update
    new_name: redis.db.keys
    - include: redis_db_keys_expiring
    action: update
    new_name: redis.db.expires
    - include: redis_rdb_changes_since_last_save
    action: update
    new_name: redis.rdb.changes_since_last_save
    - include: redis_db_avg_ttl_seconds
    action: update
    new_name: redis.db.avg_ttl
    - include: redis_latest_fork_seconds
    action: update
    new_name: redis.latest_fork
    - include: redis_master_repl_offset
    action: update
    new_name: redis.replication.offset
    - include: redis_repl_backlog_first_byte_offset
    action: update
    new_name: redis.replication.backlog_first_byte_offset
    - include: redis_commands_total
    action: update
    new_name: redis.cmd.calls
    - include: redis_commands_duration_seconds_total
    action: update
    new_name: redis.cmd.usec
    - include: redis_cpu_sys_seconds_total
    action: update
    new_name: redis.cpu.time
    operations:
    - action: add_label
    new_label: state
    new_value: sys
    - include: redis_cpu_user_seconds_total
    action: update
    new_name: redis.cpu.time
    operations:
    - action: add_label
    new_label: state
    new_value: user
    cumulativetodelta:
    include:
    match_type: regexp
    metrics:
    - redis\.commands\.processed
    - redis\.connections\.received
    - redis\.connections\.rejected
    - redis\.keys\.evicted
    - redis\.keys\.expired
    - redis\.keyspace\.hits
    - redis\.keyspace\.misses
    - redis\.net\.input
    - redis\.net\.output
    - redis\.cpu\.time
    - redis\.cmd\.calls
    - redis\.cmd\.usec
    - redis\.uptime
    filter/cardinality:
    metrics:
    datapoint:
    - 'metric.name == "redis.cpu.time" and attributes["state"] != "sys" and attributes["state"] != "user"'
    - 'metric.name == "redis.cmd.calls" and attributes["cmd"] != "get" and attributes["cmd"] != "set" and attributes["cmd"] != "del" and attributes["cmd"] != "hget" and attributes["cmd"] != "hset" and attributes["cmd"] != "hgetall" and attributes["cmd"] != "lpush" and attributes["cmd"] != "rpop" and attributes["cmd"] != "zadd" and attributes["cmd"] != "expire"'
    - 'metric.name == "redis.cmd.usec" and attributes["cmd"] != "get" and attributes["cmd"] != "set" and attributes["cmd"] != "del" and attributes["cmd"] != "hget" and attributes["cmd"] != "hset" and attributes["cmd"] != "hgetall" and attributes["cmd"] != "lpush" and attributes["cmd"] != "rpop" and attributes["cmd"] != "zadd" and attributes["cmd"] != "expire"'
    transform/metadata_nullify:
    metric_statements:
    - context: metric
    statements:
    - set(description, "")
    - set(unit, "")
    batch:
    send_batch_size: 2048
    send_batch_max_size: 4096
    timeout: 10s
    exporters:
    otlp_http:
    endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT}
    headers:
    api-key: ${env:NEW_RELIC_LICENSE_KEY}
    compression: gzip
    service:
    extensions: [health_check]
    pipelines:
    metrics/redis:
    receivers: [prometheus]
    processors: [memory_limiter, resource_detection, resource/redis_identity, attributes/entity_tags, metricstransform, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
    exporters: [otlp_http]

    이 설정의 역할

    파이프라인의 각 구성 요소에는 특정 작업이 있습니다:

    요소설명
    health_check수집기가 실행 중인지 확인할 수 있도록 0.0.0.0:13133 에 상태 엔드포인트를 노출합니다.
    prometheus 수신기10초마다 redis_exporter 엔드포인트(기본값 localhost:9121)를 스크랩하고 익스포터 자체의 go_*, process_*, promhttp_*redis_exporter_* 메트릭을 삭제합니다.
    memory_limiter호스트를 보호하기 위해 수집기 메모리 사용량을 제한합니다(512 MiB 소프트 제한, 128 MiB 스파이크).
    resource_detection호스트를 감지하고 host.namehost.id을(를) 추가하여 레디스 메트릭을 기본 호스트 엔티티에 연결합니다.
    resource/redis_identity뉴렐릭에서 레디스 엔티티를 식별하는 redis.instance.id을(를) 설정합니다. Prometheus 수신기는 server.address 또는 server.port을(를) 제공하지 않으므로 여기에 필요합니다.
    attributes/entity_tags쿼리 범위를 OpenTelemetry 경로로 지정할 수 있도록 모든 메트릭에 instrumentation.provider: opentelemetry 을(를) 찍습니다.
    metricstransform익스포터의 Prometheus 메트릭(예: redis_uptime_in_seconds)의 이름을 뉴렐릭의 레디스 이름(redis.uptime)으로 바꾸고 CPU 메트릭에 state 레이블을 추가합니다.
    cumulativetodelta뉴렐릭이 비율을 올바르게 차트로 표시할 수 있도록 누적 카운터 ― 명령, 키스페이스 적중, 축출 등 ― 를 델타 값으로 변환합니다.
    filter/cardinality수집 비용을 제어하기 위해 높은 카디널리티 데이터 포인트(usersys 이외의 CPU 상태, 일반적이지 않은 명령에 대한 명령별 메트릭)를 삭제합니다.
    transform/metadata_nullify페이로드 크기를 줄이기 위해 메트릭 설명 및 단위를 지웁니다.
    batch네트워크 오버헤드를 줄이기 위해 내보내기 전에 데이터 포인트를 그룹화(배치당 2,048개, 최대 4,096개)하고 최소 10초마다 플러시합니다.
    otlp_http라이선스 키로 인증되고 gzip 압축을 사용하여 OTLP를 통해 처리된 메트릭을 뉴렐릭으로 내보냅니다.

    중요

    Prometheus 수신기 접근 방식에는 redis.instance.id 이(가) 있는 resource/redis_identity 프로세서가 필수 입니다. 네이티브 레디스 수신기와 달리 Prometheus 수신기는 server.address 또는 server.port 을(를) 제공하지 않습니다 ― 따라서 redis.instance.id 은(는) 뉴렐릭에서 레디스 엔티티를 식별할 수 있는 유일한 방법입니다. 각 인스턴스에 대해 고유하고 기술적인 이름으로 설정합니다(예: prod-redis-cache:6379).

선택 사항: 레디스 Cluster 모니터링 활성화

레디스가 Cluster 모드로 실행 중인 경우 모든 노드에서 클러스터 상태 메트릭을 자동으로 수집하려면 --is-cluster 플래그와 함께 redis_exporter 을(를) 시작합니다:

bash
$
redis_exporter --redis.addr=redis://localhost:7000 --is-cluster

위의 Prometheus 수신기 설정은 이미 클러스터 메트릭의 이름을 변경합니다(예: redis_cluster_stateredis.cluster.state). 뉴렐릭에 별도의 클러스터 엔티티를 생성하려면 redis.instance.id이(가) 포함되지 않은 별도의 파이프라인redis.cluster.name 리소스 속성을 추가합니다:

resource/cluster:
attributes:
- key: redis.cluster.name
value: "my-redis-cluster" # Update with your cluster name
action: upsert

서비스 섹션에 클러스터 파이프라인을 추가합니다:

metrics/cluster:
receivers: [prometheus]
processors: [memory_limiter, resource_detection, resource/cluster, attributes/entity_tags, metricstransform, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]

중요

클러스터 엔티티는 redis.cluster.name 이(가) 존재하고 redis.instance.id 이(가) 없어야 합니다. 동일한 메트릭에 두 가지가 모두 설정된 경우 인스턴스 엔티티만 생성됩니다. 인스턴스 및 클러스터 메트릭에 별도의 파이프라인을 사용하세요.

선택 사항: 레디스 로그 수집

메트릭 외에도 수집기는 레디스의 로그 파일을 뉴렐릭으로 전달할 수 있으므로 로그 이벤트 ― 재시작, 지속성 이벤트 또는 오류 ― 를 동일한 엔티티의 메트릭 스파이크와 연관시킬 수 있습니다. 레디스 로그를 추적하려면 filelog 수신자를 추가합니다:

receivers:
# ... existing prometheus receiver ...
file_log/redis:
include:
- /var/log/redis/redis-server.log
start_at: end
operators:
- type: regex_parser
regex: '^\d+:[XCSM] \d+ \w+ \d+ \d+:\d+:\d+\.\d+ (?P<level>.) '
on_error: send
resource:
db.system: redis

파일의 로그 줄에는 자체적인 레디스 연결 컨텍스트가 없습니다 ― 뉴렐릭이 로그를 레디스 엔티티와 연결하도록 명시적으로 ID 속성을 추가해야 합니다. 레디스 엔티티의 ID와 일치하는 하드코딩된 값을 사용하여 resource/redis_logs 프로세서를 추가합니다:

processors:
# ... existing processors ...
resource/redis_logs:
attributes:
- key: redis.instance.id
value: "my-redis-instance:6379" # Must match the value in resource/redis_identity
action: upsert
- key: instrumentation.provider
value: opentelemetry
action: upsert

서비스 섹션에 별도의 로그 파이프라인을 추가합니다:

service:
pipelines:
metrics/redis:
receivers: [prometheus]
processors: [memory_limiter, resource_detection, resource/redis_identity, attributes/entity_tags, metricstransform, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]
logs/redis:
receivers: [file_log/redis]
processors: [memory_limiter, resource/redis_logs, batch]
exporters: [otlp_http]

중요

수집기는 레디스 로그 파일과 그 상위 디렉터리 모두에 대한 읽기 액세스 권한이 있어야 합니다. 실행:

bash
$
sudo chmod 755 /var/log/redis
$
sudo chmod 644 /var/log/redis/redis-server.log

선택 사항: 호스트 메트릭 수집

레디스 성능은 종종 호스트 리소스 압박 ― CPU 포화, 메모리 고갈 또는 디스크 I/O 경합을 추적합니다. 뉴렐릭에서 두 가지를 상호 연관시킬 수 있도록 호스트에서 레디스와 함께 시스템 메트릭을 수집하는 hostmetrics 수신기를 추가합니다:

receivers:
# ... existing receivers ...
host_metrics:
collection_interval: 10s
scrapers:
cpu:
metrics:
system.cpu.utilization: {enabled: true}
system.cpu.time: {enabled: true}
load:
metrics:
system.cpu.load_average.1m: {enabled: true}
system.cpu.load_average.5m: {enabled: true}
system.cpu.load_average.15m: {enabled: true}
memory:
metrics:
system.memory.usage: {enabled: true}
system.memory.utilization: {enabled: true}
disk:
metrics:
system.disk.io: {enabled: true}
system.disk.operations: {enabled: true}
filesystem:
metrics:
system.filesystem.usage: {enabled: true}
system.filesystem.utilization: {enabled: true}
network:
metrics:
system.network.io: {enabled: true}
system.network.packets: {enabled: true}

호스트 메트릭을 위한 별도의 metrics/host 파이프라인을 추가합니다(레디스 파이프라인에 host_metrics 을(를) 추가하지 마십시오):

service:
pipelines:
metrics/redis:
receivers: [prometheus]
processors: [memory_limiter, resource_detection, resource/redis_identity, attributes/entity_tags, metricstransform, cumulativetodelta, filter/cardinality, transform/metadata_nullify, batch]
exporters: [otlp_http]
metrics/host:
receivers: [host_metrics]
processors: [memory_limiter, resource_detection, attributes/entity_tags, cumulativetodelta, batch]
exporters: [otlp_http]

환경 변수 및 구성(config) 경로 설정

수집기는 환경 파일에서 배포별 값 ― 라이선스 키, OTLP 엔드포인트, 구성(config) 경로 ― 을 읽어 구성(config) YAML에 시크릿이 노출되지 않도록 합니다. 설치한 수집기에 대해 다음을 설정합니다:

변하기 쉬운필수의설명
NEW_RELIC_LICENSE_KEY귀하의 뉴렐릭 수집 라이선스 키.
OTEL_EXPORTER_OTLP_ENDPOINT해당 리전의 뉴렐릭 OTLP 엔드포인트. 자세한 내용은 뉴렐릭 OTLP 엔드포인트를 참조하세요.
OTELCOL_OPTIONS수집기가 레디스 프로메테우스 설정 파일을 가리키도록 합니다.

NRDOT의 경우:

bash
$
sudo tee /etc/nrdot-collector/nrdot-collector.conf > /dev/null <<'EOF'
$
NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY
$
OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTLP_ENDPOINT
$
# Set the New Relic OTLP endpoint for your region.
$
# See https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp
$
OTELCOL_OPTIONS="--config=/etc/nrdot-collector/redis-prometheus-config.yaml"
$
EOF
$
sudo chmod 600 /etc/nrdot-collector/nrdot-collector.conf

이 설정은 기본 NRDot 설정을 대체합니다. 레디스 모니터링과 함께 기본 NRDot 파이프라인을 유지해야 하는 경우, 기본 설정 파일도 추가하세요:

bash
$
OTELCOL_OPTIONS="--config=/etc/nrdot-collector/config.yaml --config=/etc/nrdot-collector/redis-prometheus-config.yaml"

여러 구성(config) 파일을 사용할 때 파일 간에 충돌하는 구성 요소 이름이 없는지 확인합니다. 접미사를 추가하여 레디스 구성(config)에서 중복되는 프로세서의 이름을 바꿉니다(예: memory_limiter 대신 memory_limiter/redis).

OTel Collector Contrib의 경우:

bash
$
sudo tee /etc/otelcol-contrib/otelcol-contrib.conf > /dev/null <<'EOF'
$
NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY
$
OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTLP_ENDPOINT
$
# Set the New Relic OTLP endpoint for your region.
$
# See https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp
$
OTELCOL_OPTIONS="--config=/etc/otelcol-contrib/redis-prometheus-config.yaml"
$
EOF
$
sudo chmod 600 /etc/otelcol-contrib/otelcol-contrib.conf

다시 시작 및 확인

수집기를 다시 시작하여 새 설정을 로드합니다.

NRDOT의 경우:

bash
$
sudo systemctl daemon-reload
$
sudo systemctl restart nrdot-collector
$
sudo systemctl status nrdot-collector

OTel Collector Contrib의 경우:

bash
$
sudo systemctl daemon-reload
$
sudo systemctl restart otelcol-contrib
$
sudo systemctl status otelcol-contrib

status 명령은 Active: active (running)을(를) 표시해야 합니다. Active: failed가 표시되면 journalctl -u nrdot-collector -n 100 --no-pager (또는 otelcol-contrib)을(를) 사용하여 로그를 확인하세요 ― 가장 일반적인 원인은 YAML 들여쓰기 오류, 연결할 수 없는 redis_exporter 또는 실행되지 않는 익스포터입니다.

그런 다음 메트릭이 뉴렐릭에 도달하는지 확인합니다. 다시 시작한 후 약 1분 정도 기다렸다가 쿼리 빌더에서 다음 쿼리를 실행합니다:

SELECT count(*) FROM Metric WHERE metricName LIKE 'redis.%' AND instrumentation.provider = 'opentelemetry' SINCE 5 minutes ago

0이 아닌 개수는 레디스 메트릭이 전송되고 있음을 확인합니다. 0을(를) 반환하는 경우, 레디스 문제 해결(OpenTelemetry)을 참조하세요.

APM과 레디스 상관관계 분석: 서비스 맵에서 APM 애플리케이션과 레디스 인스턴스를 연결하려면 선택한 엔티티 식별자 패턴 ― redis.instance.id 또는 server.addressserver.port ― 과 함께 db.system="redis" 을(를) APM 메트릭의 리소스 속성으로 포함합니다. 이 값은 수집기에서 설정한 값과 일치해야 합니다. 이를 통해 뉴렐릭 내에서 서비스 간 가시성을 확보하고 더 빠른 문제 진단, 해결이 가능해집니다.

다음 단계

Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.