-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,79 @@ | ||
# LoongCollector 的 Logtail 兼容模式使用指南 | ||
|
||
目录结构改造说明请参考 [LoongCollector 的 目录结构说明](loongcollector-dir.md) | ||
LoongCollector 提供了 Logtail 兼容模式,可以让您在升级到 LoongCollector 后继续使用原有的 Logtail 配置和数据,实现平滑迁移。本文将详细介绍如何配置和使用这个兼容模式。 | ||
|
||
## 兼容模式配置说明 | ||
> 在开始之前,请先了解 [LoongCollector 的目录结构说明](loongcollector-dir.md)。 | ||
为确保现有 Logtail 用户能够平滑升级到 LoongCollector,我们提供了完整的兼容模式支持,在兼容模式下,LoongCollector会按照旧的目录结构进行启动: | ||
## 为什么需要兼容模式? | ||
|
||
### 主机环境配置 | ||
由于 LoongCollector 采用了新的目录结构和配置体系,与原有 Logtail 存在差异,如果您相关的目录文件升级迁移困难,可以选择使用 Logtail 兼容模式。启用兼容模式后,LoongCollector 将: | ||
|
||
启用兼容模式有两种方式: | ||
- 保持与 Logtail 相同的目录结构 | ||
|
||
1. 命令行参数方式: | ||
- 继续使用 Logtail 的自定义目录配置方式 | ||
|
||
- 继续使用 Logtail 的文件命名格式 | ||
|
||
## 配置方法 | ||
|
||
### 1. 主机环境配置 | ||
|
||
您可以通过以下两种方式之一启用兼容模式: | ||
|
||
**方式一:命令行参数** | ||
|
||
```bash | ||
./loongcollector --logtail_mode=true | ||
``` | ||
|
||
2. 环境变量方式: | ||
**方式二:环境变量** | ||
|
||
```bash | ||
export logtail_mode=true | ||
./loongcollector | ||
``` | ||
|
||
### 容器环境配置 | ||
### 2. 容器环境配置 | ||
|
||
此前的 Logtail 容器镜像中,Logtail 运行时目录为 `/usr/local/ilogtail`,而 LoongCollector 运行时目录为 `/usr/local/loongcollector`。 | ||
|
||
在容器环境中使用时,需要: | ||
因此,在容器环境中,除了启用兼容模式外,还需要调整目录映射。请按照以下步骤操作: | ||
|
||
1. 添加环境变量: | ||
1. 需要给LoongCollector容器添加环境变量: | ||
|
||
```bash | ||
logtail_mode=true | ||
``` | ||
|
||
2. 调整挂载路径映射: | ||
2. 需要调整LoongCollector挂载路径映射: | ||
|
||
- 原路径:`/usr/local/ilogtail` | ||
- 新路径:`/usr/local/loongcollector` | ||
|
||
示例配置调整: | ||
将所有 `/usr/local/ilogtail` 路径替换为 `/usr/local/loongcollector`: | ||
|
||
```plaintext | ||
# 检查点目录 | ||
旧路径: /usr/local/ilogtail/checkpoint | ||
新路径: /usr/local/loongcollector/checkpoint | ||
# 常用目录映射示例 | ||
数据检查点: | ||
/usr/local/ilogtail/checkpoint → /usr/local/loongcollector/checkpoint | ||
# 配置目录 | ||
旧路径: /usr/local/ilogtail/config/local | ||
新路径: /usr/local/loongcollector/config/local | ||
采集配置目录: | ||
/usr/local/ilogtail/config → /usr/local/loongcollector/config | ||
``` | ||
|
||
通过以上配置,您可以确保现有的 Logtail 配置和数据在升级到 LoongCollector 后能够继续正常运行。 | ||
3. 修改容器镜像地址为LoongCollector镜像地址 | ||
|
||
`sls-opensource-registry-vpc.cn-shanghai.cr.aliyuncs.com/loongcollector-community-edition/loongcollector:版本号` | ||
|
||
## 迁移建议 | ||
|
||
为确保平稳迁移,我们建议您: | ||
|
||
1. 先在测试环境进行充分验证 | ||
|
||
2. 选择业务低峰期进行升级 | ||
|
||
3. 做好配置和数据的备份 | ||
|
||
4. 逐步迁移,避免一次性升级所有实例 | ||
|
||
5. 密切监控日志采集状态 | ||
|
||
> **注意**: 迁移过程中请确保数据完整性,建议先在测试环境中进行测试,并非高峰期进行升级操作。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters