CnOps 智能运维与可观测社区
首页开源项目实践文章视频课程常见问答开发者工具STAROps 专题
导航菜单
首页开源项目实践文章视频课程常见问答开发者工具STAROps 专题

CnOps 智能运维与可观测社区

愿景

CnOps 智能运维与可观测社区是一个以"智能运维与可观测"为核心的开放、包容、分享的技术社区,旨在聚集运维专家、开发者和爱好者,共同探讨、学习和分享可观测最佳实践与最新技术,与众多技术社区合作互动,共同探讨交叉领域的技术挑战,推动可观测领域的创新与进步。

内容社区

  • 实践文章
  • 视频课程
  • 开源项目
  • 常见问答
  • 开发者工具

友情链接

  • Prometheus
  • Grafana Lab
  • OpenTelemetry
  • LoongCollector

关注我们

阿里云云原生公众号阿里云云原生
阿里云可观测公众号阿里云可观测

Copyright © 2026 CnOps 社区. All rights reserved.

首页/开源项目/OpenTelemetry/安装 Collector
文档目录
文档开始手动插桩使用插桩库导出器资源采样什么是 OpenTelemetry?
API 参考文档示例
快速入门安装 Collector
管理发行版故障排查Collector 扩容转换遥测数据架构定制 Collector
基准测试自适应性
支持库列表

OpenTelemetry

安装 Collector

你可以在多种操作系统和多种架构上部署 OpenTelemetry Collector。 以下说明展示了如何下载并安装 Collector 的最新稳定版本。 如果你还不熟悉 OpenTelemetry Collector 的部署模型、组件和相关代码库, 请先查阅[数据收集][Data Collection]和[部署方法][Deployment Methods]页面。 以下命令会拉取一个...

你可以在多种操作系统和多种架构上部署 OpenTelemetry Collector。
以下说明展示了如何下载并安装 Collector 的最新稳定版本。

如果你还不熟悉 OpenTelemetry Collector 的部署模型、组件和相关代码库,
请先查阅数据收集和部署方法页面。

Docker

以下命令会拉取一个 Docker 镜像,并在容器中运行 Collector。
将 `` 替换为你想要运行的 Collector 版本。

docker pull otel/opentelemetry-collector-contrib:
docker run otel/opentelemetry-collector-contrib:
docker pull ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:
docker run ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:

要从你的工作目录加载一个自定义配置文件,将该文件挂载为卷:

docker run -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml otel/opentelemetry-collector-contrib:
docker run -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:

Docker Compose

你可以像以下示例那样,将 OpenTelemetry Collector 添加到你现有的 docker-compose.yaml 文件中:

otel-collector:
  image: otel/opentelemetry-collector-contrib
  volumes:
    - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
  ports:
    - 1888:1888 # pprof 扩展
    - 8888:8888 # Collector 暴露的 Prometheus 指标
    - 8889:8889 # Prometheus 导出器指标
    - 13133:13133 # health_check 扩展
    - 4317:4317 # OTLP gRPC 接收器
    - 4318:4318 # OTLP HTTP 接收器
    - 55679:55679 # zpages 扩展

Kubernetes

以下命令将部署一个以 DaemonSet 形式运行的代理和一个网关实例:

kubectl apply -f https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/v/examples/k8s/otel-config.yaml

上述示例旨在作为起点,在实际生产使用前需要进行扩展和定制。
有关生产环境的定制和安装,请参阅 OpenTelemetry Helm Chart。

你也可以使用 OpenTelemetry Operator 来配置和维护一个 OpenTelemetry Collector 实例,
其功能包括自动升级处理、基于 OpenTelemetry 配置的 Service 配置、自动将边车注入 Deployment 等。

有关如何在 Kubernetes 中使用 Collector 的指南,请参阅
Kubernetes 入门指南。

Nomad

你可以在 HashiCorp Nomad 上开始使用 OpenTelemetry中找到将
Collector 作为代理、网关以及完整演示部署的参考作业文件。

Linux

每个 Collector 发布版本都包含适用于 Linux amd64/arm64/i386 系统的 APK、DEB 和
RPM 安装包。安装后你可以在 /etc/otelcol/config.yaml 中找到默认配置。

注意:需要 systemd 才能进行自动服务配置。

DEB 安装 {#deb-installation}

要在 Debian 系统上开始使用,请运行以下命令:

sudo apt-get update
sudo apt-get -y install wget
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_amd64.deb
sudo dpkg -i otelcol__linux_amd64.deb
sudo apt-get update
sudo apt-get -y install wget
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_arm64.deb
sudo dpkg -i otelcol__linux_arm64.deb
sudo apt-get update
sudo apt-get -y install wget
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_386.deb
sudo dpkg -i otelcol__linux_386.deb

RPM 安装 {#rpm-installation}

要在 Red Hat 系统上开始使用,请运行以下命令:

sudo yum update
sudo yum -y install wget systemctl
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_amd64.rpm
sudo rpm -ivh otelcol__linux_amd64.rpm
sudo yum update
sudo yum -y install wget systemctl
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_arm64.rpm
sudo rpm -ivh otelcol__linux_arm64.rpm
sudo yum update
sudo yum -y install wget systemctl
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_386.rpm
sudo rpm -ivh otelcol__linux_386.rpm

Linux 手动安装 {#manual-linux-installation}

Linux 版本提供了多种架构版本供下载。你可以下载包含可执行文件的压缩包并手动安装:

curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_amd64.tar.gz
tar -xvf otelcol__linux_amd64.tar.gz
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_arm64.tar.gz
tar -xvf otelcol__linux_arm64.tar.gz
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_386.tar.gz
tar -xvf otelcol__linux_386.tar.gz
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__linux_ppc64le.tar.gz
tar -xvf otelcol__linux_ppc64le.tar.gz

自动服务配置 {#automatic-service-configuration}

默认情况下,otelcol systemd 服务在安装后会以 --config=/etc/otelcol/config.yaml 选项启动。

要使用不同的设置,请在 /etc/otelcol/otelcol.conf systemd 环境文件中设置 OTELCOL_OPTIONS
变量为相应的命令行选项。你可以运行 /usr/bin/otelcol --help 来查看所有可用选项。
你还可以通过将其他环境变量添加到该文件中来传递给 otelcol 服务。

如果你修改了 Collector 的配置文件或 /etc/otelcol/otelcol.conf,请通过以下命令重启 otelcol 服务以应用更改:

sudo systemctl restart otelcol

要查看 otelcol 服务的输出,请运行:

sudo journalctl -u otelcol

macOS

macOS 发布版本 适用于 Intel 和 ARM 系统。发布包为
gzip 压缩的 tarball(.tar.gz)。要解压它们,请运行以下命令:

curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__darwin_amd64.tar.gz
tar -xvf otelcol__darwin_amd64.tar.gz
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v/otelcol__darwin_arm64.tar.gz
tar -xvf otelcol__darwin_arm64.tar.gz

每个 Collector 发布版本都包含一个解压后可运行的 otelcol 可执行文件。

Windows

Windows 发布版本被打包为 gzip 压缩的 tarball(.tar.gz)。每个
Collector 发布版本都包含一个可运行的 otelcol.exe 可执行文件。

从源码构建 {#build-from-source}

你可以使用以下命令基于本地操作系统构建最新版本的 Collector:

git clone https://github.com/open-telemetry/opentelemetry-collector.git
cd opentelemetry-collector
make install-tools
make otelcorecol

文章大纲