このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Connecting Redis Exporter

Updated on 2024-09-06 GMT+08:00

Application Scenario

When using Redis, you need to monitor Redis running and locate their faults in a timely manner. The Prometheus monitoring function monitors Redis running using Exporter in the CCE container scenario. This section describes how to monitor Redis.

NOTE:

You are advised to use CCE for unified Exporter management.

Prerequisites

Deploying Redis Exporter

  1. Log in to the CCE console.
  2. Click the connected cluster. The cluster management page is displayed.
  3. Perform the following operations to deploy Exporter:

    1. In the navigation pane, choose ConfigMaps and Secrets. Switch to the Secrets tab. Then click Create from YAML in the upper right corner of the page. The following shows a YAML configuration example:
      apiVersion: v1
      kind: Secret
      metadata:
          name: redis-secret-test
          namespace: default # Must be the same as the namespace where Exporter is deployed.
      type: Opaque
      stringData:
          password: redis123  # Redis password.
      NOTE:
      • The password has been encrypted based on Opaque requirements.
      • For details about how to configure a secret, see Creating a Secret.
    2. Deploy Redis Exporter.

      In the navigation pane, choose Workloads. On the displayed page, click the Deployments tab, click Create from YAML in the upper right corner, and select a namespace. You can deploy Exporter through the console or using a YAML file. The following shows a YAML configuration example:

      apiVersion: apps/v1
      kind: Deployment
      metadata:
        labels:
          k8s-app: redis-exporter # Change the value based on service requirements. You are advised to add the Redis instance information, for example, crs-66e112fp-redis-exporter.
        name: redis-exporter # Change the value based on service requirements. You are advised to add the Redis instance information, for example, crs-66e112fp-redis-exporter.
        namespace: default #Select a proper namespace to deploy Exporter. If no namespace is available, create one.
      spec:
        replicas: 1
        selector:
          matchLabels:
            k8s-app: redis-exporter # Change the name based on service requirements. You are advised to add the Redis instance information, for example, crs-66e112fp-redis-exporter.
        template:
          metadata:
            labels:
              k8s-app: redis-exporter # Change the name based on service requirements. You are advised to add the Redis instance information, for example, crs-66e112fp-redis-exporter.
          spec:
            containers:
            - env:
              - name: REDIS_ADDR
                value: 120.46.215.4:30379 # IP address:port number of Redis
              - name: REDIS_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: redis-secret-test # Secret name specified in the previous step.
                    key: password  # Secret key specified in the previous step.
              image: swr.cn-north-4.myhuaweicloud.com/mall-swarm-demo/redis-exporter:v1.32.0  # Replace the value with the address of the image you uploaded to SWR.
              imagePullPolicy: IfNotPresent
              name: redis-exporter
              ports:
              - containerPort: 9121
                name: metric-port # Required when you configure a collection task.
              securityContext:
                privileged: false
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
            dnsPolicy: ClusterFirst
            imagePullSecrets:
            - name: default-secret
            restartPolicy: Always
            schedulerName: default-scheduler
            securityContext: {}
            terminationGracePeriodSeconds: 30
      ---
      apiVersion: v1
      kind: Service
      metadata:
        name: redis-exporter
        name-space: default # Must be the same as the namespace where Exporter is deployed.
      spec:
        type: NodePort
        selector:
          k8s-app: redis-exporter
        ports:
          - protocol: TCP
            nodePort: 30378
            port: 9121
            targetPort: 9121
      NOTE:

      For more details about Exporter parameters, see redis_exporter.

    3. Check whether Redis Exporter is successfully deployed.
      1. On the Deployments tab page, click the Deployment created in 3.b. In the pod list, choose More > View Logs in the Operation column. The Exporter is successfully started and its access address is exposed.
      2. Perform verification using one of the following methods:
        • Log in to a cluster node and run either of the following commands:
          curl http://{Cluster IP address}:9121/metrics
          curl http://{Private IP address of any node in the cluster}:30378/metrics
        • Access http://{Public IP address of any node in the cluster}:30378/metrics.
          If no data is obtained, check whether the values of "REDIS_ADDR" and "REDIS_PASSWORD" in the YAML file set during Redis Exporter deployment are correct. The following shows an example:
          Figure 1 Accessing a cluster node
        • In the instance list, choose More > Remote Login in the Operation column and run the following command:
          curl http://localhost:9121/metrics
          Figure 2 Executing the command

Adding a Collection Task

Add PodMonitor to configure a collection rule for monitoring the service data of applications deployed in the CCE cluster.
NOTE:

In the following example, metrics are collected every 30s. Therefore, you can check the reported metrics on the AOM page about 30s later.

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: redis-exporter
  namespace: default
spec:
  namespaceSelector: # Select the namespace where the target Exporter pod is located.
    matchNames:
      - default # Namespace where Exporter is located.
  podMetricsEndpoints:
  - interval: 30s # Set the metric collection period.
    path: /metrics # Enter the path corresponding to Prometheus Exporter. Default: /metrics.
    port: metric-port# Enter the name of "ports" in the YAML file corresponding to Prometheus Exporter.
  selector: # Enter the label of the target Exporter pod.
    matchLabels:
      k8s-app: redis-exporter

Verifying that Metrics Can Be Reported to AOM

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane on the left, choose Prometheus Monitoring > Instances.
  3. Click the Prometheus instance connected to the CCE cluster. The instance details page is displayed.
  4. On the Metrics tab page of the Metric Management page, select your target cluster.
  5. Enter redis in the search box to search. If metrics starting with redis are displayed, the metrics are successfully connected to AOM.

Setting a Dashboard and Alarm Rule on AOM

By setting a dashboard, you can monitor CCE cluster data on the same screen. By setting an alarm rule, you can detect cluster faults and implement warning in a timely manner.

  • Setting a dashboard
    1. Log in to the AOM 2.0 console.
    2. In the navigation pane, choose Dashboard. On the displayed page, click Add Dashboard to add a dashboard. For details, see Creating a Dashboard.
    3. On the Dashboard page, select a Prometheus instance for CCE and click Add Graph. For details, see Adding a Graph to a Dashboard.
  • Setting an alarm rule
    1. Log in to the AOM 2.0 console.
    2. In the navigation pane, choose Alarm Management > Alarm Rules.
    3. On the Metric/Event Alarm Rules tab page, click Create to create an alarm rule. For details, see Creating a Metric Alarm Rule.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback