<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/feeds/atom-style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://critas.wang/</id>
    <title>我的技术人生</title>
    <updated>2026-04-15T06:12:26.416Z</updated>
    <generator>Astro-Theme-Retypeset with Feed for Node.js</generator>
    <author>
        <name>Critas</name>
        <uri>https://critas.wang/</uri>
    </author>
    <link rel="alternate" href="https://critas.wang/"/>
    <link rel="self" href="https://critas.wang/atom.xml"/>
    <subtitle>Critas 的个人技术博客，记录学习笔记与技术分享。</subtitle>
    <rights>Copyright © 2026 Critas</rights>
    <entry>
        <title type="html"><![CDATA[Apache IoTDB C# 客户端双版本发布：V1.3.7 与 V2.0.8 解析及版本选择指南]]></title>
        <id>https://critas.wang/posts/iotdb-client-csharp-v137-v208/</id>
        <link href="https://critas.wang/posts/iotdb-client-csharp-v137-v208/"/>
        <updated>2026-04-15T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Apache IoTDB C# 客户端 V1.3.7 与 V2.0.8 同步发布，本文梳理两个版本的核心变更、兼容性边界以及在 1.x 与 2.x 数据库下的选型建议。]]></summary>
        <content type="html"><![CDATA[<h2>写在前面</h2>
<p>2026 年 4 月 15 日，Apache IoTDB C# 客户端（<code>iotdb-client-csharp</code>）同时发布了两个版本：</p>
<ul>
<li><a href="https://github.com/apache/iotdb-client-csharp/releases/tag/v1.3.7"><strong>v1.3.7</strong></a> — 1.x 分支的维护版本，<strong>同时可用于 2.x 数据库</strong>（仅限 Tree Model）</li>
<li><a href="https://github.com/apache/iotdb-client-csharp/releases/tag/v2.0.8"><strong>v2.0.8</strong></a> — 面向 IoTDB <strong>2.x</strong> 服务端的新一代客户端，<strong>不兼容 1.x 数据库</strong></li>
</ul>
<blockquote>
<p><strong>⚠️ 重要兼容性提示</strong></p>
<p>两个版本的兼容方向是<strong>不对称</strong>的：</p>
<ul>
<li><strong>v2.0.8 无法连接 1.x 数据库</strong>。如果服务端仍在 IoTDB 1.x（例如 V1.3.6 / V1.3.7），必须使用 <strong>v1.3.7</strong> 客户端。</li>
<li><strong>v1.3.7 可以连接 2.x 数据库</strong>，但<strong>只能使用 Tree Model</strong>，无法使用 2.x 新增的 Table Model。需要 Table Model 时才升级到 v2.0.8。</li>
</ul>
<p>换句话说：<strong>v1.3.7 是兼容范围更广的"保守选择"，v2.0.8 是面向 2.x 新特性的"激进选择"</strong>。</p>
</blockquote>
<p>本文梳理以下内容：</p>
<ol>
<li>V1.3.7 的核心修复</li>
<li>V2.0.8 的新特性与改进</li>
<li>1.x ↔ 2.x 兼容性边界</li>
<li>选型与升级建议</li>
</ol>
<hr />
<h2>V1.3.7：稳定性修复，兼顾 1.x 与 2.x（Tree Model）</h2>
<p>V1.3.7 是 1.x 分支的一次"小步快跑"维护版本，主要聚焦于会话管理和数据读取链路上的若干历史缺陷。</p>
<p><strong>它的连接范围其实是两个大版本</strong>：</p>
<ul>
<li>对 IoTDB <strong>1.x</strong> 服务端 — 原生支持，推荐升级</li>
<li>对 IoTDB <strong>2.x</strong> 服务端 — <strong>可用，但只能访问 Tree Model</strong>，无法使用 2.x 新增的 Table Model</li>
</ul>
<p>对于生产环境中仍在使用 1.3.x 服务端、或者已升级到 2.x 但只需要 Tree Model 的用户，这是一次<strong>推荐升级</strong>。</p>
<h3>核心变更</h3>
<table>
<thead>
<tr>
<th>变更项</th>
<th>说明</th>
<th>影响</th>
</tr>
</thead>
<tbody>
<tr>
<td>SessionPool 客户端泄漏修复</td>
<td>修复重连失败、查询失败时连接未正确归还的资源泄漏</td>
<td>长时间运行的服务不再出现句柄/连接耗尽</td>
</tr>
<tr>
<td>服务端错误信息保留</td>
<td>将服务端返回的错误消息原样透传给调用方</td>
<td>调试更直接，不再被包装层吞掉</td>
</tr>
<tr>
<td>SessionDataSet 死锁修复</td>
<td>修复数据集操作中的同步死锁</td>
<td>高并发查询场景稳定性提升</td>
</tr>
<tr>
<td>RowRecord 构造函数升级</td>
<td>迁移到 4 参数 <code>RowRecord</code> 构造函数</td>
<td>更完整的数据结构表达</td>
</tr>
</tbody>
</table>
<h3>适用场景</h3>
<ul>
<li>服务端是 IoTDB 1.3.x（含 1.3.6 / 1.3.7）</li>
<li>服务端已是 2.x，但业务只使用 Tree Model、不需要 Table Model</li>
<li>使用 SessionPool 且长时间运行</li>
<li>需要在业务侧捕获服务端原始错误信息</li>
<li>对数据读取链路的死锁问题敏感</li>
</ul>
<p><strong>完整 Changelog</strong>：<a href="https://github.com/apache/iotdb-client-csharp/compare/v1.3.4...v1.3.7">v1.3.4...v1.3.7</a></p>
<hr />
<h2>V2.0.8：面向 2.x 的新特性与协议适配</h2>
<p>V2.0.8 是 2.x 分支的一次较大更新，既包含 V1.3.7 的全部稳定性修复，又引入了针对 IoTDB 2.x 服务端的新协议支持和安全能力。</p>
<h3>新特性（New Features）</h3>
<h4>1. 支持 V2 读接口（<code>C# Client support V2 read interface</code>）</h4>
<p>这是 V2.0.8 <strong>最关键的变更</strong>。IoTDB 2.x 服务端在读取路径上引入了 V2 接口（更高效的数据编码、改进的列式传输），V2.0.8 客户端原生支持该接口。</p>
<blockquote>
<p><strong>这也是为什么 V2.0.8 无法连接 1.x 服务端</strong> — 1.x 服务端不存在 V2 读接口的实现，协议握手阶段就会失败。</p>
</blockquote>
<h4>2. 支持 Client TLS</h4>
<p>新增客户端侧 TLS 加密能力：</p>
<ul>
<li>面向跨网络/跨云边界的部署场景</li>
<li>配合服务端 2.x 的 TLS 配置，可实现端到端的传输加密</li>
<li>对金融、能源、政企等合规要求高的行业尤为重要</li>
</ul>
<h3>改进（Improvements）</h3>
<table>
<thead>
<tr>
<th>改进项</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>NuGet 包元数据增强</td>
<td>改进在 NuGet 上的可发现性与描述信息</td>
</tr>
<tr>
<td><code>Array.Reverse</code> 替换 LINQ 反转</td>
<td>跨 .NET 运行时（.NET Framework / .NET 6+ / .NET 8+）兼容性更好，性能略优</td>
</tr>
</tbody>
</table>
<h3>Bug 修复（继承自 V1.3.7 并新增）</h3>
<ul>
<li>SessionPool 客户端资源泄漏修复</li>
<li>服务端错误信息保留</li>
<li><code>RpcDataSet</code> 死锁条件修复</li>
<li><strong>时区兼容性问题修复</strong>（2.x 独有）</li>
<li><strong>列索引问题修复</strong>（2.x 独有）</li>
<li>移除废弃代码</li>
</ul>
<h3>贡献者</h3>
<p>本次 V2.0.8 由 4 位开发者贡献，包括首次参与的 <code>thompson-tomo</code>。从 v2.0.2 到 v2.0.8，共合并了 6 个主要 PR。</p>
<p><strong>完整 Changelog</strong>：<a href="https://github.com/apache/iotdb-client-csharp/compare/v2.0.2...v2.0.8">v2.0.2...v2.0.8</a></p>
<hr />
<h2>1.x 与 2.x 的兼容性边界</h2>
<p>这是本次发布中<strong>最容易踩坑</strong>的一点，单独拎出来讲清楚。兼容方向并不对称。</p>
<h3>兼容性矩阵</h3>
<table>
<thead>
<tr>
<th>客户端版本</th>
<th>服务端 1.x (1.3.x)</th>
<th>服务端 2.x (Tree Model)</th>
<th>服务端 2.x (Table Model)</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>C# Client v1.3.7</strong></td>
<td>✅ 支持</td>
<td>✅ 支持</td>
<td>❌ 不支持</td>
</tr>
<tr>
<td><strong>C# Client v2.0.8</strong></td>
<td>❌ <strong>不支持</strong></td>
<td>✅ 支持</td>
<td>✅ 支持</td>
</tr>
</tbody>
</table>
<p>一句话概括：</p>
<ul>
<li><strong>v1.3.7 是"向上兼容"的</strong>：能连 1.x，也能连 2.x（只是用不了 Table Model）</li>
<li><strong>v2.0.8 是"只向前不向后"的</strong>：只能连 2.x，但能用 Table Model</li>
</ul>
<h3>为什么 v2.0.8 连不上 1.x？</h3>
<p>IoTDB 从 1.x 到 2.x 的演进不仅是版本号的递进，还带来了：</p>
<ol>
<li><strong>RPC 协议层的重构</strong> — 2.x 引入了 V2 读接口，是一套新的 Thrift 定义</li>
<li><strong>数据模型的扩展</strong> — 2.x 新增 Table Model（表模型），与 Tree Model 并存</li>
<li><strong>会话与元数据交互路径变化</strong> — 例如 Database 概念替代了 Storage Group</li>
</ol>
<p>V2.0.8 客户端默认走 V2 读接口和新的会话路径，而 1.x 服务端不存在这些实现，握手阶段就会失败：</p>
<pre><code>连接阶段：握手报错 / 协议版本不匹配
查询阶段：响应解析异常 / 字段错位
写入阶段：schema 校验失败
</code></pre>
<h3>为什么 v1.3.7 还能连 2.x？</h3>
<p>2.x 服务端<strong>保留了对旧版 RPC 接口和 Tree Model 的向后兼容</strong>，因此 v1.3.7 客户端发出的 1.x 风格请求仍能被正确处理。代价是：</p>
<ul>
<li><strong>Table Model 相关的 API、DDL、查询在 v1.3.7 里不存在</strong> — 客户端根本不会调用这些接口</li>
<li>无法享受 V2 读接口带来的性能优化</li>
<li>缺少 v2.0.8 独有的 Client TLS 能力</li>
</ul>
<h3>如何确认服务端版本</h3>
<p>在 CLI 或通过 SQL 查询：</p>
<pre><code>SHOW VERSION;
</code></pre>
<p>根据返回结果选择对应的 C# 客户端版本。</p>
<hr />
<h2>选型与升级建议</h2>
<h3>场景一：服务端在 1.3.x，短期不升级</h3>
<p><strong>建议</strong>：使用 <code>Apache.IoTDB</code> 的 v1.3.7。</p>
<pre><code>
&lt;PackageReference Include="Apache.IoTDB" Version="1.3.7" /&gt;
</code></pre>
<p>收益：修复了 SessionPool 泄漏与 <code>SessionDataSet</code> 死锁，长时间运行的 .NET 服务会更稳定。</p>
<h3>场景二：服务端已升级到 2.x，但业务只用 Tree Model</h3>
<p><strong>建议</strong>：<strong>依然用 v1.3.7 即可</strong>，不必强行切到 v2.0.8。</p>
<pre><code>&lt;PackageReference Include="Apache.IoTDB" Version="1.3.7" /&gt;
</code></pre>
<p>理由：</p>
<ul>
<li>v1.3.7 能正常连接 2.x 服务端并读写 Tree Model 数据</li>
<li>无需为"升级客户端"付出回归测试成本</li>
<li>只有以下情况才需要升到 v2.0.8：
<ul>
<li>需要使用 <strong>Table Model</strong></li>
<li>需要 <strong>Client TLS</strong> 加密</li>
<li>想要 V2 读接口的<strong>性能提升</strong></li>
</ul>
</li>
</ul>
<h3>场景三：服务端是 2.x，且需要 Table Model / TLS / V2 读接口</h3>
<p><strong>建议</strong>：升级到 v2.0.8。</p>
<pre><code>&lt;PackageReference Include="Apache.IoTDB" Version="2.0.8" /&gt;
</code></pre>
<p>切换时关注：TLS 配置、时区设置、V2 读接口带来的性能与行为变化。参考服务端版本解析：<a href="/posts/iotdb-v2.0.7-v1.3.7-overview/">IoTDB V2.0.7 与 V1.3.7 解析</a>、<a href="/posts/iotdb-v2.0.8-release-notes/">V2.0.8 版本解析</a>。</p>
<h3>场景四：混合集群（部分 1.x、部分 2.x）</h3>
<p><strong>建议</strong>：<strong>统一使用 v1.3.7</strong> 是最简单的做法——一套客户端即可覆盖两种服务端（Tree Model 范围内）。</p>
<p>如果 2.x 集群上必须使用 Table Model，则需按目标集群做隔离：</p>
<ul>
<li>在 DI 容器中按配置切换 <code>ISessionPool</code> 的实现版本</li>
<li>或以微服务方式将 1.x 与 2.x 的访问拆到不同服务中</li>
</ul>
<blockquote>
<p><strong>更省事的替代方案</strong>：如果你的 2.x 集群暂时还不用 Table Model，<strong>直接全量使用 v1.3.7</strong> 就能同时覆盖 1.x 和 2.x 服务端，省去上述的拆分工作。等到真的需要 Table Model 时再考虑迁移到 v2.0.8。</p>
</blockquote>
<h3>通用注意事项</h3>
<ul>
<li><strong>TLS</strong>：v2.0.8 引入 Client TLS，服务端也需启用相应证书，否则握手失败。</li>
<li><strong>时区</strong>：v2.0.8 修复了时区兼容性问题，升级后原本靠客户端"歪打正着"跑通的时区逻辑需要重新核对。</li>
<li><strong>列索引</strong>：如果此前的业务代码依赖特定列索引顺序，v2.0.8 升级后请用单元测试回归一遍。</li>
<li><strong>SessionPool</strong>：两个版本都修复了资源泄漏，但<strong>升级后也要检查业务侧是否有未 <code>Dispose</code> 的路径</strong>，修复只是让正确用法变得更稳健，并不能掩盖错误用法。</li>
</ul>
<hr />
<h2>小结</h2>
<table>
<thead>
<tr>
<th>维度</th>
<th>V1.3.7</th>
<th>V2.0.8</th>
</tr>
</thead>
<tbody>
<tr>
<td>目标服务端</td>
<td>IoTDB 1.x 和 2.x（Tree Model）</td>
<td>IoTDB 2.x（含 Table Model）</td>
</tr>
<tr>
<td>能否连接 1.x 服务端</td>
<td>✅</td>
<td>❌</td>
</tr>
<tr>
<td>能否连接 2.x 服务端</td>
<td>✅（仅 Tree Model）</td>
<td>✅（Tree + Table Model）</td>
</tr>
<tr>
<td>新特性</td>
<td>无</td>
<td>V2 读接口、Client TLS</td>
</tr>
<tr>
<td>稳定性修复</td>
<td>SessionPool / SessionDataSet / 错误透传</td>
<td>同 V1.3.7 + 时区 + 列索引</td>
</tr>
<tr>
<td>推荐升级策略</td>
<td>适用大多数场景的保守选择</td>
<td>需要 Table Model / TLS 时升级</td>
</tr>
</tbody>
</table>
<p><strong>一句话总结</strong>：<strong>v1.3.7 是兼容性最广的选择</strong>，能同时覆盖 1.x 和 2.x 服务端（Tree Model）；<strong>v2.0.8 是面向 2.x 新特性的选择</strong>，需要 Table Model 或 Client TLS 时才升级，但注意它无法连接 1.x 数据库。</p>
<hr />
<h2>参考链接</h2>
<ul>
<li><a href="https://github.com/apache/iotdb-client-csharp/releases/tag/v1.3.7">iotdb-client-csharp v1.3.7 Release</a></li>
<li><a href="https://github.com/apache/iotdb-client-csharp/releases/tag/v2.0.8">iotdb-client-csharp v2.0.8 Release</a></li>
<li><a href="/posts/iotdb-v2.0.8-release-notes/">Apache IoTDB V2.0.8 服务端版本解析</a></li>
<li><a href="/posts/iotdb-v2.0.7-v1.3.7-overview/">Apache IoTDB V2.0.7 与 V1.3.7 服务端概览</a></li>
</ul>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-04-15T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Apache IoTDB V2.0.8 版本解析：AI 推理增强与数据管理优化]]></title>
        <id>https://critas.wang/posts/iotdb-v208-release-notes/</id>
        <link href="https://critas.wang/posts/iotdb-v208-release-notes/"/>
        <updated>2026-04-14T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Apache IoTDB V2.0.8 版本深度分析，包括 Chronos-2 模型集成、并发推理能力、TIME 列自定义命名、Pipe 路径配置增强等架构决策解读。]]></summary>
        <content type="html"><![CDATA[<h2>写在前面</h2>
<p>Apache IoTDB V2.0.8 于 2026-04-14 发布。如果说 V2.0.7 的主题是"安全加固"，那么 V2.0.8 的主题就是 <strong>AI 能力扩展与数据管理精细化</strong>。</p>
<p>本次更新最引人注目的是 AI 模块的两项增强：内置 Chronos-2 时序大模型，以及为 Timer-XL、Sundial 等内置模型增加并发推理支持。在数据库核心能力上，TIME 列自定义命名和 Pipe 路径配置的灵活化也值得深入分析。</p>
<p>本文从以下几个维度进行解读：</p>
<ol>
<li><strong>Chronos-2 集成</strong> — 为什么选择 Chronos-2？对时序预测意味着什么？</li>
<li><strong>并发推理能力</strong> — 从单线程到并发，架构上做了什么改变？</li>
<li><strong>TIME 列自定义命名</strong> — 看似简单的功能背后的兼容性考量</li>
<li><strong>Pipe 数据同步全面增强</strong> — 路径过滤、速率限制、全量同步拆分</li>
<li><strong>隐藏在 commit log 中的重要变更</strong> — 性能优化、安全加固、数据加载改进</li>
<li><strong>生产环境升级建议</strong></li>
</ol>
<blockquote>
<p>本文内容参考了 <a href="https://mp.weixin.qq.com/s/wW_k9ZlxNGmVyG_rFNuYBA">Apache IoTDB 公众号发布说明</a>、<a href="https://raw.githubusercontent.com/apache/iotdb/releases/tag/v2.0.8">GitHub Release Notes</a> 以及 <a href="https://github.com/apache/iotdb/compare/v2.0.7...v2.0.8">v2.0.7...v2.0.8 的 250 个 commit</a>。</p>
</blockquote>
<hr />
<h2>变更一：内置 Chronos-2 模型 — 时序预测的新选择</h2>
<h3>什么是 Chronos-2？</h3>
<p>Chronos-2 是 Amazon 开源的时序基础模型（Foundation Model），基于 T5 架构，通过将时序数据 tokenize 为离散 token 来进行预训练。它的核心思路是：<strong>把时序预测当作语言建模问题来解决</strong>。</p>
<pre><code>┌──────────────────────────────────────────────┐
│              传统时序模型                      │
│  原始数据 → 特征工程 → 模型训练 → 预测        │
│  (每个数据集都需要单独训练)                    │
├──────────────────────────────────────────────┤
│              Chronos-2                        │
│  原始数据 → Tokenize → 预训练模型 → 预测      │
│  (零样本推理，无需针对特定数据集训练)           │
└──────────────────────────────────────────────┘
</code></pre>
<h3>为什么选择 Chronos-2？</h3>
<p>IoTDB 此前已内置了 Timer-XL 和 Sundial 两个时序模型。引入 Chronos-2 的决策背后，可能有以下考量：</p>
<table>
<thead>
<tr>
<th>维度</th>
<th>Timer-XL / Sundial</th>
<th>Chronos-2</th>
</tr>
</thead>
<tbody>
<tr>
<td>推理方式</td>
<td>需要微调或适配</td>
<td>零样本推理（Zero-shot）</td>
</tr>
<tr>
<td>模型规模</td>
<td>相对轻量</td>
<td>多种规模可选（Mini → Large）</td>
</tr>
<tr>
<td>生态</td>
<td>IoTDB 社区</td>
<td>Amazon 开源，社区活跃</td>
</tr>
<tr>
<td>适用场景</td>
<td>特定领域优化</td>
<td>通用时序预测</td>
</tr>
</tbody>
</table>
<p><strong>对用户的意义：</strong> 如果你的场景是快速验证或跨域预测（例如把工业数据模型迁移到能源场景），Chronos-2 的零样本能力可以大幅降低上手成本。</p>
<h3>使用方式</h3>
<pre><code>-- 使用 Chronos-2 进行时序预测（推测性语法）
SELECT chronos2_forecast(temperature, 'steps=24') 
FROM root.factory.device1
WHERE time &gt;= 2026-04-01 AND time &lt; 2026-04-14;
</code></pre>
<hr />
<h2>变更二：并发推理能力 — 从串行到并行的架构升级</h2>
<h3>变更前的问题</h3>
<p>在 V2.0.7 及之前，内置 AI 模型（Timer-XL、Sundial）的推理是串行执行的：</p>
<pre><code>┌─────────────────────────────────────────┐
│           串行推理 (V2.0.7)              │
│                                         │
│  请求1 ──▶ [推理] ──▶ 返回              │
│                    请求2 ──▶ [推理] ──▶  │
│                              请求3 ──▶  │
│                                         │
│  总耗时 = T1 + T2 + T3                  │
└─────────────────────────────────────────┘
</code></pre>
<p>当多个客户端同时发起 AI 推理请求时，后续请求只能排队等待。在高并发场景下（如多条产线同时做预测性维护），这成为性能瓶颈。</p>
<h3>变更后</h3>
<p>V2.0.8 为内置模型增加了并发推理支持：</p>
<pre><code>┌─────────────────────────────────────────┐
│           并发推理 (V2.0.8)              │
│                                         │
│  请求1 ──▶ [推理线程1] ──▶ 返回         │
│  请求2 ──▶ [推理线程2] ──▶ 返回         │
│  请求3 ──▶ [推理线程3] ──▶ 返回         │
│                                         │
│  总耗时 ≈ max(T1, T2, T3)              │
└─────────────────────────────────────────┘
</code></pre>
<h3>架构思考</h3>
<p>并发推理不是简单地开多线程。需要考虑：</p>
<ol>
<li><strong>模型实例管理</strong> — 是共享一个模型实例加锁，还是维护模型实例池？</li>
<li><strong>内存控制</strong> — 多个推理任务并行时，GPU/CPU 内存如何管控？</li>
<li><strong>请求调度</strong> — 是 FIFO 队列还是优先级调度？</li>
<li><strong>资源隔离</strong> — AI 推理不应影响核心的读写性能</li>
</ol>
<p>这个变更标志着 IoTDB 的 AI 模块从"可用"走向"可用于生产"。</p>
<hr />
<h2>变更三：TIME 列自定义命名</h2>
<h3>变更内容</h3>
<p>在 V2.0.8 之前，时间列的名称固定为 <code>time</code>。现在支持自定义：</p>
<pre><code>-- V2.0.7：时间列名称固定
SELECT time, temperature FROM root.sg.d1;
-- 结果列: time | temperature

-- V2.0.8：支持自定义时间列名
-- 具体语法取决于表模型的 DDL 定义
</code></pre>
<h3>为什么需要这个功能？</h3>
<p>看似微小的变更，实际上解决了几个实际痛点：</p>
<p><strong>1. 与外部系统集成时的列名冲突</strong></p>
<p>很多 ETL 工具或 BI 系统对列名有约定。例如：</p>
<ul>
<li>Grafana 默认识别 <code>timestamp</code> 作为时间轴</li>
<li>某些工业协议使用 <code>ts</code> 或 <code>collect_time</code></li>
</ul>
<pre><code>┌──────────────┐     ┌──────────────┐
│   IoTDB      │     │   Grafana    │
│  time 列     │ ──▶ │  期望        │
│  "time"      │     │  "timestamp" │
│              │     │              │
│  以前：需要  │     │  现在：直接  │
│  别名转换    │     │  定义匹配   │
└──────────────┘     └──────────────┘
</code></pre>
<p><strong>2. 多时间语义场景</strong></p>
<p>在某些工业场景中，存在多个时间概念：</p>
<ul>
<li><code>event_time</code> — 事件发生时间</li>
<li><code>collect_time</code> — 数据采集时间</li>
<li><code>process_time</code> — 处理时间</li>
</ul>
<p>自定义命名让语义更加清晰。</p>
<h3>配合 SQL 查看表/视图定义</h3>
<p>V2.0.8 同时新增了通过 SQL 查看已创建表和视图完整定义语句的能力，方便确认时间列等 schema 信息：</p>
<pre><code>-- 查看表的完整定义（推测性语法）
SHOW CREATE TABLE database1.table1;
</code></pre>
<hr />
<h2>变更四：Pipe 路径配置增强 — 精细化数据同步</h2>
<h3>变更前的限制</h3>
<p>V2.0.7 的 Pipe 数据同步在路径过滤上比较单一：</p>
<pre><code>-- V2.0.7：只能用 pattern 做前缀匹配
CREATE PIPE sync_pipe
WITH SOURCE (
  'source.pattern' = 'root.factory1.**'
)
</code></pre>
<p>这在需要排除特定设备或混合匹配时很不方便。</p>
<h3>V2.0.8 的三项增强</h3>
<h4>增强一：支持排除指定设备/测点</h4>
<pre><code>-- 同步 factory1 下所有数据，但排除调试设备
CREATE PIPE sync_pipe
WITH SOURCE (
  'source.pattern' = 'root.factory1.**',
  'source.exclusion' = 'root.factory1.debug_device.**'
)
</code></pre>
<h4>增强二：支持多个精确路径</h4>
<pre><code>-- 精确同步多个指定路径
CREATE PIPE sync_pipe
WITH SOURCE (
  'source.path' = 'root.factory1.device1.temperature, root.factory2.device3.pressure'
)
</code></pre>
<h4>增强三：pattern 与 path 混合使用</h4>
<pre><code>-- 混合使用前缀匹配和精确路径
CREATE PIPE sync_pipe
WITH SOURCE (
  'source.pattern' = 'root.factory1.**',
  'source.path' = 'root.factory2.device3.temperature'
)
</code></pre>
<h3>架构意义</h3>
<pre><code>┌─────────────────────────────────────────────────┐
│              数据同步路径控制演进                  │
│                                                  │
│  V2.0.6: 全量同步                                │
│          root.** ──────────────▶ 目标集群         │
│                                                  │
│  V2.0.7: 前缀过滤                                │
│          root.factory1.** ────▶ 目标集群          │
│                                                  │
│  V2.0.8: 精细化控制                               │
│          root.factory1.**                        │
│          - root.factory1.debug.**  (排除)         │
│          + root.factory2.device3   (精确追加)     │
│          ─────────────────────▶ 目标集群          │
└─────────────────────────────────────────────────┘
</code></pre>
<p>这对于多租户、跨区域同步场景非常实用。例如：同步生产数据到分析集群时，排除调试数据和临时测点，减少不必要的带宽和存储消耗。</p>
<h3>Release Notes 之外：Pipe 的深层改进</h3>
<p>翻阅 commit log，会发现 Pipe 模块在本版本中还有几项重要但未出现在 Release Notes 中的改动：</p>
<p><strong>1. TsFile 发送速率限制器</strong>（<a href="https://github.com/apache/iotdb/pull/16288">#16288</a>）</p>
<p>为 TsFile 的跨节点传输增加了 rate limiter。在大规模数据同步场景中（如历史数据迁移），无限速的传输可能压垮目标节点或打满网络带宽。这个改动让运维可以控制同步速度，避免影响线上业务。</p>
<p><strong>2. 全量同步拆分为历史 + 实时</strong>（<a href="https://github.com/apache/iotdb/pull/16250">#16250</a>）</p>
<p>此前一个 Pipe 既负责历史数据追赶，又负责实时增量同步。V2.0.8 将全量同步 Pipe 内部拆分为 history pipe 和 realtime pipe：</p>
<pre><code>┌─────────────────────────────────────────┐
│          V2.0.7: 单一 Pipe               │
│  历史数据追赶 + 实时增量  → 目标集群      │
│  (相互竞争资源，追赶期实时延迟高)         │
├─────────────────────────────────────────┤
│          V2.0.8: 拆分 Pipe               │
│  History Pipe ─→ 历史追赶   → 目标集群   │
│  Realtime Pipe ─→ 实时增量  → 目标集群   │
│  (独立调度，实时同步不受历史追赶影响)     │
└─────────────────────────────────────────┘
</code></pre>
<p><strong>3. OOM 检测与内存管控</strong>（<a href="https://github.com/apache/iotdb/pull/16119">#16119</a>、<a href="https://github.com/apache/iotdb/pull/16123">#16123</a>）</p>
<p>ConfigNode 新增了 Pipe 内存溢出检测逻辑，同时修复了表模型下构造 TabletBatch 导致内存膨胀的问题。这两项改动联合解决了大数据量同步场景下的 OOM 风险。</p>
<p><strong>4. Pipe 启停并发 Bug 修复</strong>（<a href="https://github.com/apache/iotdb/pull/16461">#16461</a>）</p>
<p>修复了快速执行 stop/start 操作时的并发竞态条件。在运维场景中（如脚本化批量管理 Pipe），这个 Bug 可能导致 Pipe 状态不一致。</p>
<hr />
<h2>隐藏在 commit log 中的重要变更</h2>
<p>官方 Release Notes 用 <code>...</code> 省略了不少内容。通过分析 V2.0.7 到 V2.0.8 之间的 <strong>250 个 commit</strong>，以下变更值得关注：</p>
<h3>性能优化</h3>
<p><strong>AlignedTVList InsertTablet 位图操作优化</strong>（<a href="https://github.com/apache/iotdb/pull/16199">#16199</a>）</p>
<p>优化了对齐时间序列写入时的 bitmap 标记操作。对于高频写入场景（如数千个测点同时写入），这个优化可以减少内存操作开销。</p>
<p><strong>Last Cache 组合查询优化</strong></p>
<p>对 <code>SELECT last(s1), last(s1, time), last(s2), last(s2, time)</code> 这类组合查询进行了专项优化，减少重复的 cache 查找开销。</p>
<p><strong>跳过无效 TTL 检查</strong>（<a href="https://github.com/apache/iotdb/pull/16110">#16110</a>）</p>
<p>当 data region 没有设置 TTL 且无 mods 文件时，跳过 TTL 检查逻辑。对于不使用 TTL 的场景，减少了不必要的检查开销。</p>
<p><strong>Load 模块优化</strong></p>
<ul>
<li>修复加载对齐 Chunk 时的 OOM 问题（<a href="https://github.com/apache/iotdb/pull/16132">#16132</a>）</li>
<li>减少不必要的 MD5 计算（<a href="https://github.com/apache/iotdb/pull/16141">#16141</a>）</li>
<li>支持流式加载 mem chunk，并将 filter/limit/offset 下推到 MemPointIterator</li>
</ul>
<h3>安全加固</h3>
<p>除了修复三个 CVE 漏洞之外，commit log 中还有多项安全相关改进：</p>
<table>
<thead>
<tr>
<th>改进项</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>CLI 密码隐藏</strong>（<a href="https://github.com/apache/iotdb/pull/16468">#16468</a>）</td>
<td>客户端命令行不再明文显示密码</td>
</tr>
<tr>
<td><strong>连接数限制</strong>（<a href="https://github.com/apache/iotdb/pull/16462">#16462</a>）</td>
<td>新增连接数限制功能，防止连接耗尽</td>
</tr>
<tr>
<td><strong>加密密钥管理</strong>（<a href="https://github.com/apache/iotdb/pull/16176">#16176</a>）</td>
<td>支持加密密钥的生成与 DataNode 退出时自动销毁</td>
</tr>
<tr>
<td><strong>SSL 连接校验</strong>（<a href="https://github.com/apache/iotdb/pull/16504">#16504</a>）</td>
<td>SSL 客户端连接非 SSL 服务端时抛出明确异常，而非静默失败</td>
</tr>
<tr>
<td><strong>密码策略修复</strong>（<a href="https://github.com/apache/iotdb/pull/16089">#16089</a>）</td>
<td>修复密码升级失败及密码历史记录问题</td>
</tr>
</tbody>
</table>
<h3>新增功能</h3>
<ul>
<li><strong>UDFT pattern_match</strong> — 基于 sketch 的时序相似性匹配算法，可用于时序模式检索</li>
<li><strong>数据类型默认压缩配置</strong>（<a href="https://github.com/apache/iotdb/pull/16117">#16117</a>） — 支持为每种数据类型设置默认压缩方式</li>
<li><strong>数据导出/导入增强</strong>（<a href="https://github.com/apache/iotdb/pull/16252">#16252</a>） — 支持进度追踪、超时配置和 mfs 参数</li>
</ul>
<h3>查询模块增强</h3>
<ul>
<li><strong>DataNode 节点列表展示</strong> — 新增可用 DataNode 的列表查询功能，方便运维监控</li>
<li><strong>查询延迟统计系统表</strong> — 在表模型中新增系统表，用于统计查询延迟信息，为性能调优提供数据支撑</li>
<li><strong>Python SessionDataset 优化</strong> — 支持将 TsBlock 批量转换为 DataFrame，减少 Python 客户端与 IoTDB 之间的数据转换开销</li>
</ul>
<h3>系统模块</h3>
<ul>
<li><strong>DataNode 连接状态系统表</strong> — 在表模型中展示 DataNode 节点连接状态，有助于快速定位集群通信问题</li>
</ul>
<h3>安全漏洞修复</h3>
<ul>
<li><strong>CVE-2025-12183</strong> — 建议尽快升级</li>
<li><strong>CVE-2025-66566</strong> — 建议尽快升级</li>
<li><strong>CVE-2025-11226</strong> — 建议尽快升级</li>
</ul>
<hr />
<h2>问题修复亮点</h2>
<p>本版本修复了多个影响数据查询准确性的关键 Bug：</p>
<table>
<thead>
<tr>
<th>问题</th>
<th>影响</th>
<th>严重程度</th>
</tr>
</thead>
<tbody>
<tr>
<td>last cache 命中后查询结果集为空</td>
<td>最新值查询返回错误</td>
<td>高</td>
</tr>
<tr>
<td>TVList 超 20w 点后倒序查询遗漏数据</td>
<td>大数据量查询不准确</td>
<td>高</td>
</tr>
<tr>
<td>canSkip 导致对齐序列查询超时</td>
<td>查询性能严重退化</td>
<td>高</td>
</tr>
<tr>
<td>LAST 查询别名未生效</td>
<td>结果展示不符预期</td>
<td>中</td>
</tr>
<tr>
<td>写入失败后立即删除操作失败</td>
<td>数据管理操作受阻</td>
<td>中</td>
</tr>
<tr>
<td>非默认时间列 TsFile 加载 NPE</td>
<td>数据导入异常</td>
<td>中</td>
</tr>
</tbody>
</table>
<p>其中 <strong>TVList 超 20w 点倒序查询遗漏数据</strong> 尤为关键 — 在工业场景中，单个序列超过 20 万点是很常见的（例如 1 秒采集频率的传感器，约 2.3 天的数据量）。如果你的业务涉及大量数据的倒序查询（如"最近 N 条"查询），建议优先升级。</p>
<p>此外，commit log 中还有更多未列入 Release Notes 的修复：</p>
<ul>
<li><strong>Tablet 编码连续 null 值时的 NPE</strong>（<a href="https://github.com/apache/iotdb/pull/16107">#16107</a>）— 写入包含大量空值的数据时可能触发</li>
<li><strong>非对齐序列创建时的 NPE</strong>（<a href="https://github.com/apache/iotdb/pull/16128">#16128</a>）— 对不存在的视图添加列时触发</li>
<li><strong>DataNode 异常退出失败</strong>（<a href="https://github.com/apache/iotdb/pull/16254">#16254</a>）— 异常处理失败导致 DN 无法正常退出</li>
<li><strong>C++ 客户端内存泄漏与异常修复</strong>（<a href="https://github.com/apache/iotdb/pull/16293">#16293</a>、<a href="https://github.com/apache/iotdb/pull/16284">#16284</a>）— 使用 ASAN 排查并修复</li>
</ul>
<hr />
<h2>生产环境升级建议</h2>
<h3>升级前检查清单</h3>
<pre><code># 1. 检查当前版本
./sbin/start-cli.sh -e "show version"

# 2. 确认是否使用了 AI 推理功能
grep -r "model" conf/iotdb-ai.properties 2&gt;/dev/null

# 3. 检查 Pipe 同步配置（路径参数语法可能需要适配）
./sbin/start-cli.sh -e "show pipes"

# 4. 备份
cp -r data/ data.backup.$(date +%Y%m%d)
cp -r conf/ conf.backup.$(date +%Y%m%d)
</code></pre>
<h3>按场景的升级建议</h3>
<table>
<thead>
<tr>
<th>使用场景</th>
<th>升级紧迫度</th>
<th>注意事项</th>
</tr>
</thead>
<tbody>
<tr>
<td>使用 AI 推理功能</td>
<td>推荐升级</td>
<td>新增 Chronos-2 和并发推理能力</td>
</tr>
<tr>
<td>大数据量倒序查询</td>
<td>建议尽快</td>
<td>修复 20w+ 点数据遗漏 Bug</td>
</tr>
<tr>
<td>使用 Pipe 数据同步</td>
<td>推荐升级</td>
<td>检查路径配置是否需要适配新语法</td>
</tr>
<tr>
<td>使用 last cache</td>
<td>建议尽快</td>
<td>修复结果集为空的关键 Bug</td>
</tr>
<tr>
<td>稳定运行无上述场景</td>
<td>择机升级</td>
<td>常规版本跟进</td>
</tr>
</tbody>
</table>
<hr />
<h2>总结</h2>
<h3>V2.0.8 反映了什么趋势？</h3>
<ol>
<li><strong>AI 原生化</strong> — 从"支持 AI"到"AI 可用于生产"（并发推理、多模型选择）</li>
<li><strong>Pipe 架构成熟化</strong> — 速率限制、历史/实时拆分、OOM 防护，数据同步从"能用"走向"好用"</li>
<li><strong>数据管理精细化</strong> — TIME 列命名、Pipe 路径排除，都是面向真实生产场景的打磨</li>
<li><strong>安全纵深防御</strong> — CVE 修复之外，密码隐藏、连接限制、密钥管理、SSL 校验形成多层防线</li>
<li><strong>可观测性增强</strong> — 新增多个系统表，让运维和性能调优有据可依</li>
</ol>
<h3>与 V2.0.7 的对比</h3>
<table>
<thead>
<tr>
<th>维度</th>
<th>V2.0.7</th>
<th>V2.0.8</th>
</tr>
</thead>
<tbody>
<tr>
<td>主题</td>
<td>安全加固</td>
<td>AI 增强 + Pipe 架构升级 + 数据管理优化</td>
</tr>
<tr>
<td>commit 数量</td>
<td>~120</td>
<td>250</td>
</tr>
<tr>
<td>破坏性变更</td>
<td>RPC 地址默认值变更</td>
<td>无明显破坏性变更</td>
</tr>
<tr>
<td>升级风险</td>
<td>中（需检查网络配置）</td>
<td>低（向后兼容）</td>
</tr>
<tr>
<td>重点关注</td>
<td>集群部署配置</td>
<td>AI 功能、Pipe 稳定性、查询准确性修复</td>
</tr>
</tbody>
</table>
<hr />
<h2>参考资料</h2>
<ul>
<li><a href="https://github.com/apache/iotdb/releases/tag/v2.0.8">IoTDB V2.0.8 Release Notes</a></li>
<li><a href="https://github.com/apache/iotdb/compare/v2.0.7...v2.0.8">V2.0.7 → V2.0.8 完整 Changelog</a>（250 commits）</li>
<li><a href="https://iotdb.apache.org/Download/">IoTDB 官网下载页</a></li>
<li><a href="https://mp.weixin.qq.com/s/wW_k9ZlxNGmVyG_rFNuYBA">IoTDB 公众号发布说明</a></li>
<li><a href="https://github.com/amazon-science/chronos-forecasting">Chronos-2 论文与代码</a></li>
<li><a href="https://hub.docker.com/r/apache/iotdb">Docker 镜像</a></li>
<li><a href="https://search.maven.org/search?q=3Dg:org.apache.iotdb">Maven 仓库</a></li>
<li><a href="https://pypi.org/project/apache-iotdb/">Python API</a></li>
</ul>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-04-14T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[除了 OpenClaw，你还有另外一种选择]]></title>
        <id>https://critas.wang/posts/chatcc-alternative-to-openclaw/</id>
        <link href="https://critas.wang/posts/chatcc-alternative-to-openclaw/"/>
        <updated>2026-03-12T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[ChatCC：通过飞书远程操控 Claude Code 的轻量开发工具，与 OpenClaw 的定位对比和使用指南。]]></summary>
        <content type="html"><![CDATA[<blockquote>
<p>项目地址：<a href="https://github.com/CritasWang/chat-cc">https://github.com/CritasWang/chat-cc</a></p>
</blockquote>
<hr />
<h2>AI 编程工具的两种思路</h2>
<p>当我们谈论 AI 辅助编程工具时，大多数人第一时间想到的是 IDE 插件——安装、授权、在编辑器里调用。这条路线已经相当成熟：GitHub Copilot、Cursor、Windsurf，都是典型代表。</p>
<p>但还有另一种思路：<strong>不动 IDE，通过即时通讯工具远程操控 AI 编程助手</strong>。</p>
<p>你在会议室开会，手机弹出一条飞书消息，随手输入 <code>/ask 帮我把用户登录接口改成 JWT 认证</code>，几十秒后，Claude Code 已经在你的服务器上完成了修改。你甚至不需要打开笔记本电脑。</p>
<p>这两种思路没有高下之分，解决的是不同场景下的不同问题。今天，我们来聊聊第二种思路的一个具体实现——<strong>ChatCC</strong>。</p>
<hr />
<h2>OpenClaw 是什么</h2>
<p>在展开 ChatCC 之前，先简单说说 OpenClaw。</p>
<p><a href="https://github.com/openclaw/openclaw">OpenClaw</a> 是一个运行在本地设备上的通用个人 AI 助手，支持 20+ 消息平台（WhatsApp、Telegram、Slack、Discord、飞书等），可接入 ChatGPT、Claude、Gemini 等多个模型，提供日常 AI 对话、语音交互、技能系统扩展等能力。</p>
<p>如果你需要一个跨平台的统一 AI 助手，OpenClaw 是一个不错的选择。</p>
<p>但如果你的需求是：<strong>远程控制本地 Claude Code、移动端操作、不依赖特定 IDE、与团队飞书工作流深度整合</strong>——那么 ChatCC 可能更适合你。</p>
<hr />
<h2>ChatCC 是什么</h2>
<p><a href="https://github.com/CritasWang/chat-cc">ChatCC</a> 是一个用 Go 编写的飞书机器人服务。<strong>Chat</strong>（聊天）+ <strong>CC</strong>（Claude Code + Command），名字本身就概括了它的核心理念：</p>
<blockquote>
<p><strong>通过飞书消息远程操控 Claude Code 和本地程序。</strong></p>
</blockquote>
<p>ChatCC 运行在你本地或服务器上，通过飞书开放平台的 WebSocket 长连接与飞书云端保持实时通信。当你在飞书中 @机器人 或发送命令消息时，ChatCC 接收到请求，调用本地安装的 Claude Code 执行任务，再将结果回复给你。</p>
<p>整个过程<strong>不需要公网 IP</strong>，不需要开放任何防火墙端口，WebSocket 长连接从内网主动发出，对网络环境没有特殊要求。</p>
<hr />
<h2>核心特性详解</h2>
<h3>1. 双模式 Claude Code 集成</h3>
<p>ChatCC 提供两种截然不同的交互模式，满足不同场景需求：</p>
<p><strong>无状态模式（<code>/ask</code>）</strong></p>
<pre><code>/ask 解释一下这个项目的目录结构
/ask --cwd /path/to/project 帮我写单元测试
/ask @server 查看最近的错误日志
</code></pre>
<p>每次调用独立执行，底层使用 <code>claude -p</code> 一次性调用。适合快速查询、代码解释、单次任务。默认超时 50 分钟，足以处理复杂的代码分析任务。</p>
<p><strong>持久会话模式（<code>/session</code> + <code>/s</code>）</strong></p>
<pre><code>/session start @myproject    # 启动 tmux 持久会话
/s 先看看 README              # 发送消息到活跃会话
/s 现在帮我重构 auth 模块      # 继续上下文对话
/session status               # 查看当前会话详情
/session list                 # 列出所有活跃会话
/session stop                 # 关闭会话
</code></pre>
<p>持久会话模式基于 tmux，Claude Code 在 tmux 窗格中持续运行，保留完整的对话上下文。适合需要多轮交互的复杂开发任务。</p>
<p>两种模式可以灵活切换，非命令消息会自动路由：有活跃 tmux 会话时发给会话，否则作为 <code>/ask</code> 处理。</p>
<h3>2. 交互式输入智能处理</h3>
<p>当 Claude Code 在会话中遇到交互式提示（如确认操作、yes/no 问题等）时，ChatCC 会自动检测并提示你：</p>
<pre><code>⚠️ 检测到交互式提示，Claude Code 正在等待输入。
💡 请使用 /s 命令发送您的响应。
</code></pre>
<p>系统能识别 <code>(y/n)</code>、<code>[yes/no]</code>、<code>continue?</code>、<code>press enter</code> 等常见交互模式，你只需通过 <code>/s yes</code> 或 <code>/s n</code> 回应即可。这个功能让远程操控 Claude Code 变得更加顺畅——你不会因为错过一个确认提示而导致任务卡住。</p>
<h3>3. Claude Code Hooks 双向回调</h3>
<p>ChatCC 在 9876 端口启动一个 HTTP 服务，提供 <code>/notify</code> 和 <code>/health</code> 端点。</p>
<p>这意味着 Claude Code 在执行过程中可以主动向飞书推送消息——文件修改、任务完成、重要决策点……你不需要盯着终端，飞书消息会主动告诉你 Claude Code 正在做什么。</p>
<p>在 Claude Code 配置 Hooks：</p>
<pre><code>{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "curl -sS http://localhost:9876/notify -H 'Content-Type: application/json' -d '{\"event\":\"file_changed\",\"message\":\"Claude 修改了文件\",\"chat_id\":\"oc_xxx\"}'"
          }
        ]
      }
    ]
  }
}
</code></pre>
<p>Hook HTTP API 支持 POST 通知和 GET 健康检查：</p>
<pre><code>POST http://localhost:9876/notify
Content-Type: application/json

{
  "event": "task_complete",
  "message": "任务已完成: 重构了认证模块",
  "chat_id": "oc_xxx"       // 可选，指定推送到哪个飞书聊天
}
</code></pre>
<p>这是真正的双向通信：你控制 Claude Code，Claude Code 也能主动汇报进度。</p>
<h3>4. 安全控制体系</h3>
<p>对于一个能远程执行代码的工具，安全设计至关重要。ChatCC 提供了多层安全控制：</p>
<ul>
<li><strong>用户白名单</strong>：只有配置中列出的飞书用户 ID 才能使用机器人</li>
<li><strong>群组白名单</strong>：可限制机器人只在指定群聊中响应</li>
<li><strong>Shell 命令白名单</strong>：<code>/shell</code> 命令只能执行预先配置的允许命令</li>
<li><strong>危险模式开关</strong>：<code>/danger on|off</code> 动态控制 Claude Code 的权限绕过行为</li>
<li><strong>嵌套会话保护</strong>：自动过滤 <code>CLAUDECODE</code>、<code>ANTHROPIC_*</code> 等环境变量，避免在 Claude Code 环境中启动子进程时出现嵌套检测错误</li>
</ul>
<p>即便机器人 Token 泄露，未授权用户也无法通过机器人执行任何操作。</p>
<h3>5. 长消息智能分块</h3>
<p>Claude Code 的输出经常很长。ChatCC 会自动将超过 3500 字符的消息分块发送，避免消息截断导致信息丢失。分块时会智能选择段落、句子边界，确保内容完整性，每条分块消息标注序号（如 [1/3], [2/3], [3/3]）。</p>
<p>分块大小可自定义：</p>
<pre><code>max_chunk_size: 3500    # 默认 3500 字符
</code></pre>
<h3>6. 后台运行与日志管理</h3>
<p>ChatCC 编译为单个二进制文件，内置完整的守护进程支持：</p>
<pre><code>chatcc start --config config.local.yaml    # 后台启动
chatcc stop                                 # 停止
chatcc restart --config config.local.yaml   # 重启
chatcc status                               # 查看状态
chatcc console --config config.local.yaml   # 前台运行（调试用）
</code></pre>
<p>日志按天滚动，自动 gzip 压缩历史日志（<code>logs/chatcc-YYYY-MM-DD.log.gz</code>），不需要额外配置 logrotate。<code>console</code> 模式日志直接输出到终端，方便调试。</p>
<h3>7. 热重载与项目别名</h3>
<p>修改配置文件后，发送 <code>/reload</code> 命令，配置立即生效，无需重启服务、无需重连飞书。</p>
<p>项目别名让你不需要记忆绝对路径：</p>
<pre><code>projects:
  server: "/home/user/projects/backend"
  devops: "/home/user/infrastructure"
  web: "/home/user/projects/frontend"
</code></pre>
<p>配置好后，直接用 <code>/ask @server</code> 或 <code>/session start @devops</code> 即可。使用 <code>/project</code>（或 <code>/p</code>）命令可以随时查看所有已配置的项目别名。</p>
<hr />
<h2>完整命令列表</h2>
<table>
<thead>
<tr>
<th>命令</th>
<th>说明</th>
<th>示例</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/ask &lt;提示词&gt;</code></td>
<td>Claude Code 无状态问答</td>
<td><code>/ask 帮我看看有什么文件</code></td>
</tr>
<tr>
<td><code>/ask --cwd &lt;目录&gt; &lt;提示词&gt;</code></td>
<td>指定工作目录</td>
<td><code>/ask --cwd /path/to/project 分析结构</code></td>
</tr>
<tr>
<td><code>/ask @别名 &lt;提示词&gt;</code></td>
<td>用项目别名</td>
<td><code>/ask @server 看看迁移方案</code></td>
</tr>
<tr>
<td><code>/session start [目录]</code></td>
<td>启动 tmux 持久会话</td>
<td><code>/session start @webapp</code></td>
</tr>
<tr>
<td><code>/session status</code></td>
<td>查看当前会话详情</td>
<td><code>/session status</code></td>
</tr>
<tr>
<td><code>/session list</code></td>
<td>列出所有活跃会话</td>
<td><code>/session list</code></td>
</tr>
<tr>
<td><code>/session kill &lt;会话名&gt;</code></td>
<td>终止指定会话</td>
<td><code>/session kill cc-chat-xxx</code></td>
</tr>
<tr>
<td><code>/session stop</code></td>
<td>关闭当前会话</td>
<td><code>/session stop</code></td>
</tr>
<tr>
<td><code>/s &lt;消息&gt;</code></td>
<td>发送到活跃会话</td>
<td><code>/s 帮我重构这个函数</code></td>
</tr>
<tr>
<td><code>/shell &lt;命令&gt;</code></td>
<td>执行白名单 shell 命令</td>
<td><code>/shell docker ps</code></td>
</tr>
<tr>
<td><code>/project</code> 或 <code>/p</code></td>
<td>查看已配置的项目别名</td>
<td><code>/project</code></td>
</tr>
<tr>
<td><code>/status</code></td>
<td>查看系统状态和活跃会话</td>
<td><code>/status</code></td>
</tr>
<tr>
<td><code>/danger on|off</code></td>
<td>切换权限绕过模式</td>
<td><code>/danger on</code></td>
</tr>
<tr>
<td><code>/reload</code></td>
<td>热重载配置文件</td>
<td><code>/reload</code></td>
</tr>
<tr>
<td><code>/help [命令]</code></td>
<td>帮助信息</td>
<td><code>/help ask</code></td>
</tr>
</tbody>
</table>
<p><strong>非命令消息</strong>：如有活跃 tmux 会话则发送到会话，否则等同 <code>/ask</code>。</p>
<hr />
<h2>ChatCC vs OpenClaw 对比</h2>
<p>理解两个工具各自的定位和优势，有助于做出正确选择。</p>
<table>
<thead>
<tr>
<th>维度</th>
<th>OpenClaw</th>
<th>ChatCC</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>定位</strong></td>
<td>通用个人 AI 助手，支持多平台</td>
<td>专注飞书的 Claude Code 远程控制网关</td>
</tr>
<tr>
<td><strong>核心功能</strong></td>
<td>多模型 AI 对话（ChatGPT/Claude/Gemini）</td>
<td>Claude Code 专用执行环境（本地开发工具）</td>
</tr>
<tr>
<td><strong>消息平台</strong></td>
<td>20+ 平台（WhatsApp/Telegram/Slack 等）</td>
<td>仅飞书（深度集成）</td>
</tr>
<tr>
<td><strong>技术栈</strong></td>
<td>Node.js</td>
<td>Go（单二进制部署）</td>
</tr>
<tr>
<td><strong>本地执行</strong></td>
<td>主要调用 AI API</td>
<td>直接在本地执行 Claude Code（tmux 持久会话）</td>
</tr>
<tr>
<td><strong>配置复杂度</strong></td>
<td>多平台 + 多模型认证</td>
<td>仅需飞书 app_id/app_secret</td>
</tr>
<tr>
<td><strong>目标用户</strong></td>
<td>需要跨平台 AI 助手的个人用户</td>
<td>需要远程控制开发环境的开发者</td>
</tr>
</tbody>
</table>
<h3>选择 ChatCC 的场景</h3>
<ul>
<li>你需要通过飞书<strong>远程控制本地 Claude Code</strong>，访问本地文件系统，执行代码分析和自动化任务</li>
<li>你的团队深度使用飞书作为协作工具，希望<strong>开发工作流与飞书打通</strong></li>
<li>你在<strong>企业内网环境</strong>工作，需要从外部安全访问内网开发机</li>
<li>你希望在移动端或非编码场景（会议、外出）也能操控 Claude Code</li>
<li>你追求<strong>轻量部署</strong>——单平台、单二进制、5 分钟部署完成</li>
<li>你管理多个服务器/项目，希望通过统一的飞书界面远程控制</li>
</ul>
<h3>选择 OpenClaw 的场景</h3>
<ul>
<li>你需要<strong>跨平台统一 AI 助手</strong>——在 WhatsApp、Telegram、Slack 等多平台使用同一个 AI</li>
<li>你需要<strong>多模型 AI 对话</strong>——同时使用 OpenAI、Claude、Gemini，支持故障转移和自动切换</li>
<li>你需要<strong>语音和多模态</strong>交互能力</li>
<li>团队熟悉 Node.js/TypeScript 生态，希望二次开发</li>
</ul>
<p>两者并不互斥。完全可以用 OpenClaw 做日常 AI 助手处理通用对话，同时在服务器上运行 ChatCC 处理 Claude Code 相关的开发任务：</p>
<pre><code>WhatsApp/Telegram ──→ OpenClaw ──→ 日常 AI 对话
飞书             ──→ ChatCC   ──→ 远程控制 Claude Code
</code></pre>
<p>各司其职，互不干扰。</p>
<hr />
<h2>快速上手</h2>
<h3>第一步：创建飞书自建应用</h3>
<ol>
<li>登录<a href="https://open.feishu.cn/">飞书开放平台</a>，创建一个企业自建应用</li>
<li>添加「机器人」能力</li>
<li>在「权限管理」中开启以下权限：
<ul>
<li><code>im:message</code>（接收消息）</li>
<li><code>im:message:send_as_bot</code>（发送消息）</li>
<li><code>im:message:patch</code>（更新消息）</li>
</ul>
</li>
<li>在「事件订阅」中选择 <strong>WebSocket 模式</strong>，订阅 <code>im.message.receive_v1</code> 事件</li>
<li>发布应用版本</li>
<li>获取 App ID 和 App Secret</li>
</ol>
<h3>第二步：安装 Claude Code</h3>
<pre><code>npm install -g @anthropic-ai/claude-code
</code></pre>
<p>确保 <code>claude</code> 命令可在 PATH 中访问。</p>
<h3>第三步：安装 ChatCC</h3>
<pre><code>git clone https://github.com/CritasWang/chat-cc.git
cd chat-cc
go build -o chatcc .
</code></pre>
<p>或直接下载发布版二进制文件。</p>
<h3>第四步：配置</h3>
<pre><code>cp config.yaml config.local.yaml
</code></pre>
<p>编辑 <code>config.local.yaml</code>：</p>
<pre><code>feishu:
  app_id: "cli_xxxxxxxxxxxxxxxx"
  app_secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

security:
  allowed_users:
    - "your_feishu_user_id"
  allowed_shells:
    - "git status"
    - "git log --oneline -10"
    - "docker ps"

# 超时配置（分钟）
claude_ask_timeout: 50
claude_session_timeout: 50

projects:
  server: "/home/user/backend"
  web: "/home/user/frontend"
</code></pre>
<p>也支持环境变量方式配置：</p>
<pre><code>export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"
</code></pre>
<h3>第五步：启动</h3>
<pre><code>./chatcc start --config config.local.yaml
./chatcc status
</code></pre>
<p>在飞书中找到你的机器人，发送 <code>/help</code>，开始使用。</p>
<hr />
<h2>进阶用法</h2>
<h3>配置 Claude Code Hooks 回调</h3>
<p>在 <code>~/.claude/settings.json</code> 中配置 Hooks，让 Claude Code 主动回报进度：</p>
<pre><code>{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit|Bash",
        "hooks": [
          {
            "type": "command",
            "command": "curl -sS http://localhost:9876/notify -H 'Content-Type: application/json' -d '{\"event\":\"file_changed\",\"message\":\"Claude 修改了文件\",\"chat_id\":\"oc_xxx\"}'"
          }
        ]
      }
    ]
  }
}
</code></pre>
<p>每次 Claude Code 完成文件写入或执行命令后，你的飞书会收到通知。</p>
<h3>群聊协作模式</h3>
<p>将机器人加入团队群聊，配置群聊 ID 到白名单，团队成员都可以 @机器人 发起任务。任务执行过程和结果对整个群组可见——这在结对编程或代码 Review 场景中非常有用。</p>
<h3>结合 tmux 调试</h3>
<p>ChatCC 的会话模式本质上管理的是 tmux 会话，你也可以直接登录服务器查看 tmux 中 Claude Code 的实时输出，双向调试非常方便：</p>
<pre><code># 通过 /session list 查看会话名
tmux attach -t cc-chat-xxx
</code></pre>
<p>同时 ChatCC 支持 <code>console</code> 前台模式，日志直接输出到终端，便于排查问题。</p>
<hr />
<h2>总结</h2>
<p>OpenClaw 和 ChatCC 代表了两种不同的设计哲学：</p>
<ul>
<li><strong>OpenClaw</strong>：通用 AI 助手，跨平台统一入口，覆盖多种模型和交互方式</li>
<li><strong>ChatCC</strong>：专注开发者场景，让飞书成为 Claude Code 的远程控制台</li>
</ul>
<p>如果你的工作流已经深度整合飞书，如果你需要远程控制开发环境，如果你想让 AI 编程任务变得可观测、可协作——不妨试试 ChatCC。</p>
<p>它的安装部署只需 5 分钟，单二进制文件、零依赖（除了 Go 和 Claude Code），代码完全开源可审计，WebSocket 架构意味着你不需要改动任何网络配置。对于个人开发者和小团队来说，这是一个轻量、灵活、实用的选择。</p>
<blockquote>
<p>项目地址：<a href="https://github.com/CritasWang/chat-cc">https://github.com/CritasWang/chat-cc</a></p>
</blockquote>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-03-12T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Apache IoTDB 新版本发布：V2.0.7 与 V1.3.7 功能解析与升级注意事项]]></title>
        <id>https://critas.wang/posts/iotdb-v207-v137-overview/</id>
        <link href="https://critas.wang/posts/iotdb-v207-v137-overview/"/>
        <updated>2026-03-11T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Apache IoTDB V2.0.7 和 V1.3.7 同步发布，本文梳理核心变更、升级踩坑点和版本选择建议。]]></summary>
        <content type="html"><![CDATA[<h2>概览</h2>
<p>2026 年 3 月 4 日，Apache IoTDB 同时发布了 V2.0.7 和 V1.3.7。两个版本共享了一组相同的安全加固措施，但 V1.3.7 还额外包含了大量 bug 修复和性能优化（48 个提交 vs V2.0.7 的 16 个）。</p>
<p>本文从实际 <a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">GitHub Release</a> 和提交记录出发，梳理以下内容：</p>
<ol>
<li>两个版本的核心变更</li>
<li><strong>RPC 地址变更</strong> — 升级最大的坑</li>
<li>其他值得关注的改动</li>
<li>版本选择与升级建议</li>
</ol>
<blockquote>
<p>参考来源：<a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">Apache IoTDB 公众号发布说明</a>、<a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">V2.0.7 Release Notes</a>、<a href="https://github.com/apache/iotdb/releases/tag/v1.3.7">V1.3.7 Release Notes</a></p>
</blockquote>
<hr />
<h2>两个版本共享的核心变更</h2>
<p>V2.0.7 和 V1.3.7 包含相同的安全加固和配置调整：</p>
<table>
<thead>
<tr>
<th>变更项</th>
<th>说明</th>
<th>影响</th>
</tr>
</thead>
<tbody>
<tr>
<td>RPC 默认地址改为 127.0.0.1</td>
<td>客户端 RPC 服务默认只监听本地回环</td>
<td><strong>集群部署必须修改配置</strong></td>
</tr>
<tr>
<td>移除高风险 RPC 接口</td>
<td>删除存在安全隐患的 RPC 接口</td>
<td>提升安全性</td>
</tr>
<tr>
<td>移除 JEXL 函数</td>
<td>移除 Tree 模式下的内置 JEXL 函数</td>
<td>使用 JEXL 的查询需改写</td>
</tr>
<tr>
<td>内部服务绑定优化</td>
<td>内部服务绑定到 <code>dn_internal_address</code> 而非默认地址</td>
<td>网络分层更安全</td>
</tr>
<tr>
<td>Pipe 命名检查</td>
<td>创建 Pipe 时增加命名合法性校验</td>
<td>防止非法字符导致运行时错误</td>
</tr>
<tr>
<td>分区表 TTL 删除修复</td>
<td>修复仅 DB 级别 TTL 生效且使用最大值的问题</td>
<td>Tree 模式下的 TTL 行为更准确</td>
</tr>
</tbody>
</table>
<hr />
<h2>RPC 地址变更：升级最大的坑</h2>
<p>这是本次升级<strong>最需要注意的变更</strong>。</p>
<h3>变更内容</h3>
<pre><code># V2.0.6 / V1.3.6 及之前
dn_rpc_address=0.0.0.0    # 监听所有网络接口

# V2.0.7 / V1.3.7
dn_rpc_address=127.0.0.1  # 仅监听本地回环
</code></pre>
<p>对应的 PR：<a href="https://github.com/apache/iotdb/pull/17060">#17060 Change default dn rpc address</a></p>
<h3>为什么要改</h3>
<p>这是一个 <strong>Secure by Default</strong> 设计决策。当 <code>rpcAddress=0.0.0.0</code> 时，数据库会监听所有网络接口（包括公网接口），在未配置防火墙的环境下存在安全风险。改为 <code>127.0.0.1</code> 后，用户需要显式配置才能开放外部访问。</p>
<h3>对不同部署场景的影响</h3>
<p><strong>单机部署</strong> — 无影响，本地 CLI 连接 <code>127.0.0.1:6667</code> 正常工作。</p>
<p><strong>集群部署</strong> — <strong>必须修改配置</strong>，否则其他节点和远程客户端无法连接。</p>
<pre><code># 错误配置（升级后远程无法连接）
dn_rpc_address=127.0.0.1

# 正确配置（绑定实际 IP）
dn_rpc_address=192.168.1.10
dn_internal_address=192.168.1.10
</code></pre>
<p><strong>Docker 部署</strong> — 容器内需要保持监听所有接口：</p>
<pre><code>services:
  iotdb:
    image: apache/iotdb:2.0.7
    environment:
      - IOTDB_DN_RPC_ADDRESS=0.0.0.0
</code></pre>
<h3>常见故障现象</h3>
<p>升级后如果出现以下错误，大概率是 RPC 地址配置问题：</p>
<pre><code>Error: Connection refused
</code></pre>
<p>从其他机器执行 <code>./sbin/start-cli.sh -h &lt;目标IP&gt;</code> 无法连接。</p>
<p><strong>排查方法：</strong></p>
<pre><code># 检查实际监听地址
ss -tlnp | grep 6667

# 如果显示 127.0.0.1:6667，说明需要修改配置
# 如果显示 0.0.0.0:6667 或实际IP:6667，说明配置正确
</code></pre>
<hr />
<h2>内部服务绑定优化</h2>
<p>对应 PR：<a href="https://github.com/apache/iotdb/pull/16717">#16717 Bind real config address for Thrift and Raft services</a></p>
<p>此前内部 Thrift 和 Raft 服务可能绑定到默认地址（如 <code>0.0.0.0</code>），导致内部通信接口暴露在不必要的网络接口上。修改后，这些服务会绑定到 <code>dn_internal_address</code> 指定的地址，实现客户端流量与内部集群通信的网络分层：</p>
<ul>
<li><code>dn_rpc_address</code> — 客户端连接入口</li>
<li><code>dn_internal_address</code> — 集群节点间通信</li>
</ul>
<hr />
<h2>移除 JEXL 函数</h2>
<p>对应 PR：<a href="https://github.com/apache/iotdb/pull/17092">#17092 Remove built-in jexl function in tree mode</a></p>
<p>JEXL（Java Expression Language）曾用于动态执行表达式，但存在代码注入风险且使用率低。移除后，原有的 JEXL 查询需要改写：</p>
<table>
<thead>
<tr>
<th>原 JEXL 用法</th>
<th>替代方案</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>JEXL('value * 2')</code></td>
<td>内置算术：<code>value * 2</code></td>
</tr>
<tr>
<td><code>JEXL('sin(value)')</code></td>
<td>内置函数：<code>sin(value)</code></td>
</tr>
<tr>
<td>复杂业务逻辑</td>
<td>自定义 UDF（Java 编译）</td>
</tr>
</tbody>
</table>
<p><strong>升级前建议检查</strong>：</p>
<pre><code># 扫描查询日志中的 JEXL 使用
grep -i "JEXL" /path/to/query/logs/*.log
</code></pre>
<hr />
<h2>V1.3.7 额外的改进</h2>
<p>V1.3.7 除了上述共享变更外，还包含大量 bug 修复和性能优化：</p>
<h3>内存管理改进</h3>
<ul>
<li>修复加载大量 TsFile 时的 GC 问题（<a href="https://github.com/apache/iotdb/pull/16853">#16853</a>）— 改为分批加载，避免同时加载所有文件资源</li>
<li>修复 IoTConsensus 队列中的内存泄漏（<a href="https://github.com/apache/iotdb/pull/16966">#16966</a>）</li>
<li>修复查询排序索引的内存预留问题（<a href="https://github.com/apache/iotdb/pull/16959">#16959</a>）</li>
<li>修复 TVList 所有权转移时的内存释放异常（<a href="https://github.com/apache/iotdb/pull/16943">#16943</a>）</li>
</ul>
<h3>查询引擎修复</h3>
<ul>
<li>修复 Last 查询排序问题（<a href="https://github.com/apache/iotdb/pull/16956">#16956</a>）</li>
<li>修复 MemTable 查询 bug（<a href="https://github.com/apache/iotdb/pull/16970">#16970</a>）</li>
<li>修复插入全 null 对齐 Tablet 并 flush 后的查询错误（<a href="https://github.com/apache/iotdb/pull/17041">#17041</a>）</li>
<li>修复 overlap unpack 在 endTime 为哨兵值时的错误（<a href="https://github.com/apache/iotdb/pull/16993">#16993</a>）</li>
</ul>
<h3>性能优化</h3>
<ul>
<li>优化 MemTable Region Scan 效率（<a href="https://github.com/apache/iotdb/pull/16891">#16891</a>, <a href="https://github.com/apache/iotdb/pull/16979">#16979</a>）</li>
<li>优化 DeviceViewIntoOperator 为 Pipeline 风格（<a href="https://github.com/apache/iotdb/pull/16980">#16980</a>）</li>
<li>移除 Schema Cache 中无用的 first key（<a href="https://github.com/apache/iotdb/pull/16881">#16881</a>）</li>
</ul>
<h3>Pipe 功能改进</h3>
<ul>
<li>支持 Pattern Pruning 和冗余路径移除（<a href="https://github.com/apache/iotdb/pull/17059">#17059</a>）</li>
<li>修复批量内存对 Pipe 内存管理不可见的 bug（<a href="https://github.com/apache/iotdb/pull/16962">#16962</a>）</li>
<li>优化 Pipe 性能，禁用部分无用逻辑（<a href="https://github.com/apache/iotdb/pull/16916">#16916</a>）</li>
<li>DataNode 首次启动时清理 Active Load 监听目录（<a href="https://github.com/apache/iotdb/pull/16854">#16854</a>）</li>
</ul>
<hr />
<h2>V2.0.6 中已修复的 CVE</h2>
<p>以下安全漏洞已在 <strong>V2.0.6/V1.3.6</strong> 中修复（非本次版本）：</p>
<ul>
<li><strong>CVE-2025-12183</strong> — 安全漏洞修复</li>
<li><strong>CVE-2025-66566</strong> — 安全漏洞修复</li>
<li><strong>CVE-2025-11226</strong> — 安全漏洞修复</li>
</ul>
<p>如果你还在使用 V2.0.5/V1.3.5 或更早版本，建议直接升级到最新版本以同时获得 CVE 修复和本次安全加固。</p>
<hr />
<h2>版本选择建议</h2>
<table>
<thead>
<tr>
<th>场景</th>
<th>推荐版本</th>
<th>理由</th>
</tr>
</thead>
<tbody>
<tr>
<td>新项目</td>
<td><strong>V2.0.7</strong></td>
<td>1.3.x 已停止新功能开发</td>
</tr>
<tr>
<td>1.3.x 生产环境</td>
<td><strong>V1.3.7</strong>（过渡）+ 规划迁移 2.x</td>
<td>获取安全修复，同时准备迁移</td>
</tr>
<tr>
<td>需要 Table 模型</td>
<td><strong>V2.0.7</strong></td>
<td>仅 2.x 支持 Tree + Table 双模型</td>
</tr>
<tr>
<td>需要 MATCH RECOGNIZE</td>
<td><strong>V2.0.7</strong></td>
<td>仅 2.x 支持</td>
</tr>
<tr>
<td>测试/开发环境</td>
<td><strong>V2.0.7</strong></td>
<td>使用最新版本</td>
</tr>
</tbody>
</table>
<p><strong>核心建议：</strong> 1.3.x 已进入维护模式，仅接收安全和关键 bug 修复。除非有无法克服的限制，否则应该选择 2.x 或规划迁移。</p>
<hr />
<h2>升级检查清单</h2>
<h3>升级前</h3>
<pre><code># 1. 检查当前 RPC 配置
grep -E "rpc_address|internal_address" conf/iotdb-conf.properties

# 2. 检查 JEXL 使用情况
grep -i "JEXL" /path/to/query/logs/*.log

# 3. 检查集群状态
./sbin/start-cli.sh
&gt; show datanodes;
&gt; show confignodes;

# 4. 备份配置和数据
cp -r conf/ conf.backup.$(date +%Y%m%d)
cp -r data/ data.backup.$(date +%Y%m%d)
</code></pre>
<h3>升级时</h3>
<pre><code># 1. 先修改配置（集群部署必做）
vim conf/iotdb-conf.properties
# dn_rpc_address=&lt;本机实际IP&gt;
# dn_internal_address=&lt;本机实际IP&gt;

# 2. 停止服务
./sbin/stop-datanode.sh

# 3. 替换二进制文件

# 4. 启动服务
./sbin/start-datanode.sh
</code></pre>
<h3>升级后</h3>
<pre><code># 1. 验证连接
./sbin/start-cli.sh -h &lt;实际IP&gt;

# 2. 检查集群节点状态
&gt; show datanodes;

# 3. 检查日志
tail -100 log/iotdb.log | grep -E "ERROR|WARN"
</code></pre>
<hr />
<h2>延伸阅读</h2>
<ul>
<li><a href="/posts/iotdb-v2.0.7-release-notes/">深度解析 Apache IoTDB V2.0.7：安全加固与架构优化</a> — V2.0.7 架构决策深度分析</li>
<li><a href="/posts/iotdb-v1.3.7-lts-analysis/">Apache IoTDB V1.3.7 版本解析</a> — 1.3.x 用户的升级指南</li>
<li><a href="/posts/iotdb-migration-1.3-to-2.x/">Apache IoTDB 从 1.3.x 迁移到 2.x 完整指南</a> — 迁移实战步骤</li>
</ul>
<h2>参考资料</h2>
<ul>
<li><a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">IoTDB V2.0.7 Release Notes</a></li>
<li><a href="https://github.com/apache/iotdb/releases/tag/v1.3.7">IoTDB V1.3.7 Release Notes</a></li>
<li><a href="https://github.com/apache/iotdb/compare/v2.0.6...v2.0.7">V2.0.6 vs V2.0.7 完整变更对比</a></li>
<li><a href="https://github.com/apache/iotdb/compare/v1.3.6...v1.3.7">V1.3.6 vs V1.3.7 完整变更对比</a></li>
<li><a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">IoTDB 公众号发布说明</a></li>
</ul>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-03-11T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Apache IoTDB 从 1.3.x 迁移到 2.x 完整指南]]></title>
        <id>https://critas.wang/posts/iotdb-migration-13-to-2x/</id>
        <link href="https://critas.wang/posts/iotdb-migration-13-to-2x/"/>
        <updated>2026-03-05T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Apache IoTDB 从 1.3.x 迁移到 2.x 的完整实战指南，包括迁移评估、方案选择、数据迁移、应用适配和验证流程。]]></summary>
        <content type="html"><![CDATA[<h2>为什么必须迁移到 2.x？</h2>
<p><strong>先说结论：1.3.x 已进入维护模式，2.x 才是 IoTDB 的未来。</strong></p>
<h3>版本现状对比</h3>
<table>
<thead>
<tr>
<th>维度</th>
<th>1.3.x</th>
<th>2.x</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>开发状态</strong></td>
<td>维护模式</td>
<td>活跃开发</td>
</tr>
<tr>
<td><strong>新功能</strong></td>
<td>无</td>
<td>持续更新</td>
</tr>
<tr>
<td><strong>数据模型</strong></td>
<td>Tree only</td>
<td>Tree + Table</td>
</tr>
<tr>
<td><strong>查询能力</strong></td>
<td>基础 SQL</td>
<td>MATCH RECOGNIZE、窗口函数等</td>
</tr>
<tr>
<td><strong>社区支持</strong></td>
<td>逐渐减少</td>
<td>全力投入</td>
</tr>
<tr>
<td><strong>建议</strong></td>
<td>临时过渡</td>
<td><strong>长期选择</strong></td>
</tr>
</tbody>
</table>
<h3>1.3.x 用户面临的现实问题</h3>
<pre><code>问题一：功能停滞
├─ 没有 Table 模型（关系型查询）
├─ 没有 MATCH RECOGNIZE（流式分析）
├─ 没有最新的 UDF 和函数库
└─ 无法享受社区新功能

问题二：生态脱节
├─ 新工具优先支持 2.x
├─ 新文档以 2.x 为主
└─ 社区问题解答偏向 2.x

问题三：长期风险
├─ 1.3.x 最终会停止维护
├─ 迟早要迁移，越晚成本越高
└─ 团队技术栈落后
</code></pre>
<hr />
<h2>迁移评估：你的情况适合哪种方案？</h2>
<h3>方案一：直接迁移（推荐 80% 用户）</h3>
<p><strong>适合场景：</strong></p>
<pre><code>□ 1.3.x 生产环境，但可以安排维护窗口
□ 查询逻辑以标准 SQL 为主
□ 团队有测试和验证能力
□ 希望尽快获得 2.x 新功能
</code></pre>
<p><strong>迁移难度：</strong> 中等</p>
<p><strong>预计时间：</strong> 2-4 周（含测试）</p>
<hr />
<h3>方案二：渐进迁移（保守选择）</h3>
<p><strong>适合场景：</strong></p>
<pre><code>□ 超大规模集群（100+ 节点）
□ 业务不能有任何中断
□ 有充足的测试资源
□ 可以接受较长的迁移周期
</code></pre>
<p><strong>迁移难度：</strong> 较低</p>
<p><strong>预计时间：</strong> 1-3 个月</p>
<hr />
<h3>方案三：并行部署（特殊场景）</h3>
<p><strong>适合场景：</strong></p>
<pre><code>□ 新旧业务隔离
□ 需要 A/B 测试
□ 迁移风险极高
□ 有充足的硬件资源
</code></pre>
<p><strong>迁移难度：</strong> 较高</p>
<p><strong>预计时间：</strong> 1-2 个月</p>
<hr />
<h2>迁移前评估清单</h2>
<h3>1. 数据模型兼容性检查</h3>
<p><strong>Tree 模型（100% 兼容）：</strong></p>
<pre><code>-- 1.3.x 的查询在 2.x 完全兼容
SELECT * FROM root.sg.d1;
SELECT count(*) FROM root.** WHERE time &gt; now() - 1h;
</code></pre>
<p><strong>需要检查的场景：</strong></p>
<pre><code>-- 1.3.x 特有功能（2.x 已移除）
SELECT JEXL('value * 2') FROM root.sg.d1;  -- JEXL 已移除，需改为内置算术或 UDF
</code></pre>
<p><strong>检查命令：</strong></p>
<pre><code># 扫描查询日志中的 JEXL 使用
grep -i "JEXL" /path/to/query/logs/*.log

# 统计使用频率
grep -c "JEXL" /path/to/query/logs/*.log | awk -F: '{sum+=$2} END {print sum}'
</code></pre>
<hr />
<h3>2. 配置注意事项</h3>
<p>迁移到 2.x 时，配置文件格式基本兼容，但需要注意以下几点：</p>
<ul>
<li><strong><code>dn_rpc_address</code> 和 <code>dn_internal_address</code></strong>：集群部署时必须显式配置为本机实际 IP，不能使用默认值 <code>127.0.0.1</code></li>
<li>部分新增配置项需要手动合并，建议 <code>diff</code> 对比新旧配置文件</li>
<li>详细的配置变更参见 <a href="/posts/iotdb-v207-v137-overview/">V2.0.7 与 V1.3.7 功能解析</a> 中的 RPC 地址变更章节</li>
</ul>
<hr />
<h3>3. 客户端兼容性</h3>
<p><strong>需要升级的客户端：</strong></p>
<table>
<thead>
<tr>
<th>客户端</th>
<th>1.3.x 版本</th>
<th>2.x 版本</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>JDBC</td>
<td>1.3.x</td>
<td>2.0.x</td>
<td>升级依赖</td>
</tr>
<tr>
<td>Session (Java)</td>
<td>1.3.x</td>
<td>2.0.x</td>
<td>升级依赖</td>
</tr>
<tr>
<td>Python SDK</td>
<td>1.3.x</td>
<td>2.0.x</td>
<td>升级依赖</td>
</tr>
<tr>
<td>Go SDK</td>
<td>1.3.x</td>
<td>2.0.x</td>
<td>升级依赖</td>
</tr>
<tr>
<td>CLI</td>
<td>内置</td>
<td>内置</td>
<td>使用对应版本</td>
</tr>
</tbody>
</table>
<p><strong>依赖升级示例：</strong></p>
<pre><code>
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.iotdb&lt;/groupId&gt;
    &lt;artifactId&gt;iotdb-session&lt;/artifactId&gt;
    
    &lt;version&gt;1.3.7&lt;/version&gt;
    
    &lt;version&gt;2.0.7&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<pre><code># Python
# 1.3.x 版本
pip install apache-iotdb==1.3.7

# 升级到 2.x
pip install apache-iotdb==2.0.7
</code></pre>
<hr />
<h2>方案一：直接迁移实战（推荐）</h2>
<h3>迁移架构</h3>
<pre><code>┌─────────────────────────────────────────────────────┐
│                  迁移前 (1.3.x)                      │
│                                                      │
│  应用层 → JDBC/Session → IoTDB 1.3.x 集群            │
│                                                      │
└─────────────────────────────────────────────────────┘
                      ↓ 迁移
┌─────────────────────────────────────────────────────┐
│                  迁移后 (2.x)                        │
│                                                      │
│  应用层 → JDBC/Session → IoTDB 2.x 集群              │
│              ↑                                        │
│          升级客户端依赖                               │
└─────────────────────────────────────────────────────┘
</code></pre>
<h3>步骤一：准备阶段（Week 1）</h3>
<pre><code># 1. 搭建测试环境（与生产配置一致）
$ cp -r /path/to/prod/config /path/to/test/config

# 2. 部署 2.0.7 测试集群
$ wget https://dlcdn.apache.org/iotdb/2.0.7/apache-iotdb-2.0.7-bin.tar.gz
$ tar -xzf apache-iotdb-2.0.7-bin.tar.gz
$ cd apache-iotdb-2.0.7

# 3. 修改配置（关键！）
$ vim conf/iotdb-conf.properties
dn_rpc_address=192.168.1.10      # 实际 IP
dn_internal_address=192.168.1.10

# 4. 启动测试集群
$ ./sbin/start-confignode.sh
$ ./sbin/start-datanode.sh
</code></pre>
<h3>步骤二：数据迁移（Week 2）</h3>
<h4>方式一：Cross-Cluster Sync（推荐）</h4>
<pre><code>-- 在 2.x 集群上创建 Pipe
CREATE PIPE pipe_from_13x
WITH EXTRACTOR (
    'extractor' = 'iotdb-extractor',
    'ip' = '192.168.1.10',  -- 1.3.x 集群 IP
    'port' = '6667',
    'user' = 'root',
    'password' = 'xxx'
)
WITH PROCESSOR (
    'processor' = 'do-nothing-processor'
)
WITH SINK (
    'sink' = 'iotdb-sink',
    'ip' = '192.168.1.20',  -- 2.x 集群 IP
    'port' = '6667',
    'user' = 'root',
    'password' = 'xxx'
);

-- 启动 Pipe
START PIPE pipe_from_13x;
</code></pre>
<h4>方式二：TsFile 拷贝导入</h4>
<pre><code># 1. 停止 1.3.x 集群
$ ./sbin/stop-datanode.sh

# 2. 拷贝数据目录中的 TsFile 文件
$ cp -r /path/to/iotdb-1.3.x/data/datanode/data /tmp/tsfile_backup

# 3. 在 2.x 集群上使用 LOAD 命令导入
$ ./sbin/start-cli.sh -h 192.168.1.20
IoTDB&gt; LOAD '/tmp/tsfile_backup';
</code></pre>
<h4>方式三：原地升级（适合单机或小集群）</h4>
<p>原地升级是最简单的方式，直接在现有节点上替换二进制文件：</p>
<pre><code># 1. 停止服务
$ ./sbin/stop-datanode.sh
$ ./sbin/stop-confignode.sh

# 2. 全量备份（关键！不可跳过）
$ cp -r data/ /backup/data.$(date +%Y%m%d)
$ cp -r conf/ /backup/conf.$(date +%Y%m%d)

# 3. 下载 2.x 版本
$ wget https://dlcdn.apache.org/iotdb/2.0.7/apache-iotdb-2.0.7-bin.tar.gz
$ tar -xzf apache-iotdb-2.0.7-bin.tar.gz

# 4. 替换 lib 和 sbin 目录
$ cp -r apache-iotdb-2.0.7/lib/* /path/to/iotdb/lib/
$ cp -r apache-iotdb-2.0.7/sbin/* /path/to/iotdb/sbin/

# 5. 合并配置文件（注意：不要直接覆盖 conf，需手动合并）
$ diff conf/iotdb-conf.properties apache-iotdb-2.0.7/conf/iotdb-conf.properties
# 将新增的配置项合并到现有配置中
# 特别注意修改 dn_rpc_address 和 dn_internal_address

# 6. 启动服务
$ ./sbin/start-confignode.sh
$ ./sbin/start-datanode.sh

# 7. 验证
$ ./sbin/start-cli.sh -h &lt;实际IP&gt;
IoTDB&gt; show datanodes;
IoTDB&gt; SELECT count(*) FROM root.**;
</code></pre>
<h3>步骤三：应用迁移（Week 2-3）</h3>
<pre><code># 1. 升级客户端依赖
# Java (Maven)
$ mvn versions:use-dep-version -Dincludes=org.apache.iotdb -DdepVersion=2.0.7

# Python
$ pip install --upgrade apache-iotdb==2.0.7

# 2. 修改连接配置（如果 IP 变化）
# 旧配置
jdbc:iotdb://192.168.1.10:6667
# 新配置
jdbc:iotdb://192.168.1.20:6667

# 3. 运行测试用例
$ mvn test
$ pytest tests/
</code></pre>
<h3>步骤四：验证与切换（Week 3-4）</h3>
<pre><code># 1. 数据一致性验证
$ ./sbin/start-cli.sh -h 192.168.1.10  # 1.3.x
IoTDB&gt; SELECT count(*) FROM root.**;

$ ./sbin/start-cli.sh -h 192.168.1.20  # 2.x
IoTDB&gt; SELECT count(*) FROM root.**;

# 2. 灰度切换（推荐）
# 先切换 10% 流量
# 观察 1-2 天
# 逐步增加到 50% → 100%

# 3. 回滚方案（如有问题）
# 保持 1.3.x 集群运行
# 切换流量回 1.3.x
# 排查问题后重新尝试
</code></pre>
<hr />
<h2>方案二：渐进迁移（大规模集群）</h2>
<h3>架构</h3>
<pre><code>┌─────────────────────────────────────────────────────┐
│              渐进迁移（按节点分组）                   │
│                                                      │
│  应用层                                              │
│    │                                                 │
│    ├─→ 路由层（负载均衡）                            │
│    │     ├─→ 10% 流量 → 2.x 集群（新节点）           │
│    │     └─→ 90% 流量 → 1.3.x 集群（老节点）         │
│    │                                                 │
│    │              ↓ 逐步切换                         │
│    │                                                 │
│    │     ├─→ 50% 流量 → 2.x 集群                     │
│    │     └─→ 50% 流量 → 1.3.x 集群                   │
│    │                                                 │
│    │              ↓ 完全切换                         │
│    │                                                 │
│    └─→ 100% 流量 → 2.x 集群                          │
│                                                      │
└─────────────────────────────────────────────────────┘
</code></pre>
<h3>步骤详解</h3>
<pre><code>Phase 1: 部署 2.x 集群（10% 容量）
         处理 10% 的读写流量

Phase 2: 数据同步
         使用 Pipe 从 1.3.x 同步到 2.x

Phase 3: 灰度切换
         10% → 30% → 50% → 70% → 100%
         每个阶段观察 2-3 天

Phase 4: 下线 1.3.x
         确认稳定后，下线老集群
</code></pre>
<hr />
<h2>常见坑与解决方案</h2>
<h3>坑一：RPC 地址配置错误</h3>
<p><strong>现象：</strong></p>
<pre><code>Error: Connection refused
无法连接到 2.x 集群
</code></pre>
<p><strong>原因：</strong></p>
<pre><code># 使用了默认配置
dn_rpc_address=127.0.0.1  # 只监听本地
</code></pre>
<p><strong>解决：</strong></p>
<pre><code># 修改为实际 IP
dn_rpc_address=192.168.1.20
</code></pre>
<hr />
<h3>坑二：客户端版本不兼容</h3>
<p><strong>现象：</strong></p>
<pre><code>// Java 客户端报错
Exception: Protocol version mismatch
// 1.3.x 客户端无法连接 2.x 服务端
</code></pre>
<p><strong>解决：</strong></p>
<pre><code>
&lt;version&gt;2.0.7&lt;/version&gt;
</code></pre>
<hr />
<h3>坑三：JEXL 函数报错</h3>
<p><strong>现象：</strong></p>
<pre><code>-- 查询报错
SELECT JEXL('value * 2') FROM root.sg.d1;
-- Error: Function JEXL not found
</code></pre>
<p><strong>解决：</strong></p>
<pre><code>-- 改为内置函数
SELECT value * 2 FROM root.sg.d1;

-- 或自定义 UDF
SELECT my_udf(value) FROM root.sg.d1;
</code></pre>
<hr />
<h3>坑四：内存配置不合理</h3>
<p><strong>现象：</strong></p>
<pre><code>Error: Out of memory
频繁 Full GC
</code></pre>
<p><strong>解决：</strong></p>
<pre><code># 2.x 使用动态内存管理
# 建议配置：
dn_memory_allocate_proportion=0.6
dn_heap_size=4g
</code></pre>
<hr />
<h2>迁移检查清单</h2>
<h3>迁移前</h3>
<pre><code>□ 完成兼容性评估
□ 搭建测试环境
□ 准备回滚方案
□ 通知相关团队
□ 安排维护窗口
</code></pre>
<h3>迁移中</h3>
<pre><code>□ 数据同步完成
□ 应用依赖升级
□ 查询测试通过
□ 性能测试通过
□ 监控告警配置
</code></pre>
<h3>迁移后</h3>
<pre><code>□ 数据一致性验证
□ 业务功能验证
□ 性能指标达标
□ 观察 1-2 周
□ 下线老集群
</code></pre>
<hr />
<h2>参考资料</h2>
<ul>
<li><a href="https://iotdb.apache.org/zh/UserGuide/latest/QuickStart/QuickStart_apache.html">IoTDB 2.x 文档</a></li>
<li><a href="https://iotdb.apache.org/zh/UserGuide/V1.3.x/QuickStart/QuickStart_apache.html">IoTDB 1.3.x 文档</a></li>
<li><a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">IoTDB V2.0.7 Release Notes</a></li>
<li><a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">IoTDB 公众号发布说明</a></li>
</ul>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-03-05T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Apache IoTDB V1.3.7 版本解析：稳定性加固与配置变更]]></title>
        <id>https://critas.wang/posts/iotdb-v137-lts-analysis/</id>
        <link href="https://critas.wang/posts/iotdb-v137-lts-analysis/"/>
        <updated>2026-03-05T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Apache IoTDB V1.3.7 版本核心变更分析，包括安全加固措施、配置变更注意事项，以及 1.3.x 与 2.x 的版本选择建议。]]></summary>
        <content type="html"><![CDATA[<h2>写在前面</h2>
<p>Apache IoTDB V1.3.7 与 V2.0.7 于 2026-03-04 同一天发布，但这两个版本的定位和目标用户完全不同：</p>
<ul>
<li><strong>V2.0.7</strong>：推荐版本，支持 Table 模型、MATCH RECOGNIZE 等新功能</li>
<li><strong>V1.3.7</strong>：面向现有 1.3.x 用户，不需要表模型、不希望引入更多变化的场景</li>
</ul>
<p>目前社区的开发重心已转向 2.x 系列，1.3.x 主要接收 bug 修复和安全补丁。对于仍在使用 1.3.x 的用户，这篇文章回答几个关键问题：</p>
<ol>
<li>1.3.7 修复了什么？为什么必须升级？</li>
<li>1.3.x 和 2.x 的功能差距有多大？</li>
<li>是升级 1.3.7 还是直接迁移 2.x？</li>
<li>生产环境如何零停机升级？</li>
</ol>
<blockquote>
<p>本文内容参考了 <a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">Apache IoTDB 公众号发布说明</a> 及 <a href="https://github.com/apache/iotdb/releases/tag/v1.3.7">GitHub Release Notes</a>。</p>
</blockquote>
<hr />
<h2>1.3.x 系列的定位</h2>
<h3>版本定位</h3>
<pre><code>IoTDB 版本路线图

1.3.0 ──→ 1.3.4 ──→ 1.3.5 ──→ 1.3.6 ──→ 1.3.7
  │         │          │          │          │
  │         │          │          │          └── 安全加固 + RPC 变更
  │         │          │          │
  │         │          │          └─────── CVE 修复 + 性能优化
  │         │          │
  │         │          └────────────── 功能增强
  │         │
  │         └──────────────────────── 早期生产版
  │
  └───────────────────────────────── 首个稳定版


2.0.0 ──→ 2.0.5 ──→ 2.0.6 ──→ 2.0.7
  │         │          │          │
  │         │          │          └── 安全加固 + RPC 变更
  │         │          │
  │         │          └────────────── MATCH RECOGNIZE + CVE 修复
  │         │
  │         └──────────────────────── 窗口函数 + JOIN 增强
  │
  └───────────────────────────────── Tree-Table 双模型
</code></pre>
<p><strong>1.3.x 的特点：</strong></p>
<ul>
<li>纯 Tree 模型（无 Table 模型）</li>
<li>经过长期生产验证</li>
<li>API 和配置稳定</li>
<li>社区支持周期长</li>
</ul>
<p><strong>适合场景：</strong></p>
<ul>
<li>工业 IoT 数据采集（稳定优先）</li>
<li>已有大量 Tree 模型查询逻辑</li>
<li>运维团队技术栈保守</li>
<li>无法承担升级风险的生产环境</li>
</ul>
<hr />
<h2>V1.3.7 核心变更分析</h2>
<h3>变更概览</h3>
<table>
<thead>
<tr>
<th>类别</th>
<th>变更内容</th>
<th>影响等级</th>
</tr>
</thead>
<tbody>
<tr>
<td>安全加固</td>
<td>移除高风险 RPC 接口</td>
<td><strong>高</strong></td>
</tr>
<tr>
<td>配置变更</td>
<td>RPC 默认地址改为 127.0.0.1</td>
<td><strong>高（集群部署必须注意）</strong></td>
</tr>
<tr>
<td>功能移除</td>
<td>移除 JEXL 函数</td>
<td>中</td>
</tr>
<tr>
<td>服务绑定</td>
<td>内部服务绑定到 <code>dn_internal_address</code></td>
<td>中</td>
</tr>
<tr>
<td>Pipe</td>
<td>创建 Pipe 时增加命名检查</td>
<td>低</td>
</tr>
<tr>
<td>Bug 修复</td>
<td>分区表 TTL 删除逻辑</td>
<td>中</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>注意</strong>：CVE-2025-12183、CVE-2025-66566、CVE-2025-11226 已在 <strong>v1.3.6</strong> 中修复。如果你还在使用 v1.3.5 或更早版本，升级到 v1.3.7 可以同时获得 CVE 修复和本次安全加固。</p>
</blockquote>
<hr />
<h2>重点一：RPC 默认地址变更（升级必坑）</h2>
<h3>变更内容</h3>
<pre><code># 1.3.6 及之前
dn_rpc_address=0.0.0.0

# 1.3.7
dn_rpc_address=127.0.0.1  # 默认只监听本地
</code></pre>
<h3>对 1.3.x 用户的影响</h3>
<h4>场景一：单机部署（无影响）</h4>
<pre><code># 本地 CLI 连接
./sbin/start-cli.sh
# 连接 127.0.0.1:6667，没问题
</code></pre>
<h4>场景二：集群部署（必须修改配置）</h4>
<p><strong>错误示范（升级后无法连接）：</strong></p>
<pre><code># 用户直接替换二进制文件，未修改配置
$ ./sbin/stop-datanode.sh
$ # 替换为 1.3.7
$ ./sbin/start-datanode.sh

# 然后从其他机器连接
$ ./sbin/start-cli.sh -h 192.168.1.10
# Error: Connection refused!

# 原因：1.3.7 默认监听 127.0.0.1，不接受外部连接
</code></pre>
<p><strong>正确升级流程：</strong></p>
<pre><code># 1. 升级前修改配置
$ vim conf/iotdb-conf.properties

# 修改为：
dn_rpc_address=192.168.1.10      # 本机实际 IP
dn_internal_address=192.168.1.10

# 2. 停止服务
$ ./sbin/stop-datanode.sh

# 3. 替换二进制
$ wget https://dlcdn.apache.org/iotdb/1.3.7/apache-iotdb-1.3.7-bin.tar.gz
$ tar -xzf apache-iotdb-1.3.7-bin.tar.gz

# 4. 启动服务
$ ./sbin/start-datanode.sh

# 5. 验证
$ ./sbin/start-cli.sh -h 192.168.1.10
# 连接成功！
</code></pre>
<h4>场景三：Docker 部署（需更新配置）</h4>
<pre><code># docker-compose.yml
services:
  iotdb:
    image: apache/iotdb:1.3.7
    ports:
      - "6667:6667"
    environment:
      - IOTDB_DN_RPC_ADDRESS=0.0.0.0  # 容器内需要监听所有接口
      - IOTDB_DN_INTERNAL_ADDRESS=iotdb
</code></pre>
<hr />
<h2>重点二：移除 JEXL 函数</h2>
<h3>影响评估</h3>
<p>JEXL 在实际使用中并不常见。主要原因：</p>
<ol>
<li>大多数查询用内置函数就够了</li>
<li>复杂计算通常在客户端处理</li>
<li>JEXL 性能不如编译型 UDF</li>
</ol>
<h3>替代方案</h3>
<table>
<thead>
<tr>
<th>原 JEXL 用法</th>
<th>1.3.7 替代方案</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>JEXL('value * 2')</code></td>
<td>内置算术：<code>value * 2</code></td>
</tr>
<tr>
<td><code>JEXL('sin(value)')</code></td>
<td>内置函数：<code>sin(value)</code></td>
</tr>
<tr>
<td>复杂业务逻辑</td>
<td>自定义 UDF（Java 编译）</td>
</tr>
<tr>
<td>数据转换</td>
<td>客户端预处理</td>
</tr>
</tbody>
</table>
<h3>升级前检查</h3>
<pre><code># 扫描查询日志中的 JEXL 使用
grep -i "JEXL" /path/to/query/logs/*.log

# 统计使用频率
grep -c "JEXL" /path/to/query/logs/*.log | awk -F: '{sum+=$2} END {print sum}'
</code></pre>
<hr />
<h2>1.3.7 vs 2.0.7 功能对比</h2>
<table>
<thead>
<tr>
<th>特性</th>
<th>1.3.7</th>
<th>2.0.7</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>数据模型</strong></td>
<td>Tree only</td>
<td>Tree + Table</td>
</tr>
<tr>
<td><strong>查询语言</strong></td>
<td>SQL (Tree)</td>
<td>SQL (双模型)</td>
</tr>
<tr>
<td><strong>MATCH RECOGNIZE</strong></td>
<td>不支持</td>
<td>支持</td>
</tr>
<tr>
<td><strong>Table 模型聚合</strong></td>
<td>不支持</td>
<td>支持</td>
</tr>
<tr>
<td><strong>窗口函数</strong></td>
<td>基础</td>
<td>增强（v2.0.5 新增）</td>
</tr>
<tr>
<td><strong>UDF</strong></td>
<td>基础</td>
<td>增强（UDTF，v2.0.4 新增）</td>
</tr>
<tr>
<td><strong>安全加固</strong></td>
<td>本次更新</td>
<td>本次更新</td>
</tr>
<tr>
<td><strong>生产验证</strong></td>
<td>充分</td>
<td>较充分</td>
</tr>
<tr>
<td><strong>社区支持周期</strong></td>
<td>长</td>
<td>中</td>
</tr>
</tbody>
</table>
<hr />
<h2>决策指南：升级 1.3.7 还是迁移 2.x？</h2>
<h3>1.3.x 已进入维护模式</h3>
<p><strong>这是关键信息：</strong></p>
<ul>
<li>1.3.x <strong>不再有新功能</strong>（Table 模型、MATCH RECOGNIZE 等都没有）</li>
<li>仅有安全修复和关键 bug 修复</li>
<li>社区开发重心已转向 2.x</li>
</ul>
<h3>选择 1.3.7 的场景（仅限特殊情况）</h3>
<pre><code>你的情况：
□ 生产环境已稳定运行 1.3.x 多年
□ 大量查询逻辑深度绑定 Tree 模型
□ 短期内（1-2 年）无法进行任何变更
□ 仅需安全修复，不需要新功能

→ 建议：升级到 1.3.7（临时方案），但应规划 2.x 迁移
</code></pre>
<h3>选择 2.x 的场景（推荐）</h3>
<pre><code>你的情况：
□ 新建项目（100% 推荐）
□ 现有 1.3.x 项目，可安排升级计划
□ 需要 Table 模型（关系型查询）
□ 需要 MATCH RECOGNIZE（流式分析）
□ 希望获得持续的功能更新和社区支持

→ 建议：直接部署 2.0.7 或规划迁移到 2.x
</code></pre>
<h3>迁移路径建议</h3>
<table>
<thead>
<tr>
<th>场景</th>
<th>推荐</th>
<th>理由</th>
</tr>
</thead>
<tbody>
<tr>
<td>新项目</td>
<td><strong>2.0.7</strong></td>
<td>1.3.x 已停止新功能</td>
</tr>
<tr>
<td>1.3.x 生产环境</td>
<td><strong>规划迁移 2.x</strong></td>
<td>1.3.x 进入维护模式，迟早要迁移</td>
</tr>
<tr>
<td>无法立即迁移</td>
<td><strong>1.3.7 临时过渡</strong></td>
<td>仅用于安全修复，同时规划迁移</td>
</tr>
<tr>
<td>测试/开发环境</td>
<td><strong>2.0.7</strong></td>
<td>直接使用最新版本</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>核心观点：1.3.7 是"临时止痛药"，2.x 才是"长期解决方案"。</strong> 除非有无法克服的限制，否则应该选择 2.x。详细的迁移步骤请参考 <a href="/posts/iotdb-migration-1.3-to-2.x/">Apache IoTDB 从 1.3.x 迁移到 2.x 完整指南</a>。</p>
</blockquote>
<hr />
<h2>生产环境升级实战（1.3.6 → 1.3.7）</h2>
<h3>升级前检查清单</h3>
<pre><code># 1. 检查当前版本
$ ./sbin/start-cli.sh -v

# 2. 检查集群状态
IoTDB&gt; show datanodes;

# 3. 检查配置
$ grep -E "rpc_address|internal_address" conf/iotdb-conf.properties

# 4. 检查 JEXL 使用情况
$ grep -r "JEXL" /path/to/queries/

# 5. 备份
$ cp -r data/ data.backup.$(date +%Y%m%d_%H%M%S)
$ cp -r conf/ conf.backup.$(date +%Y%m%d_%H%M%S)
</code></pre>
<h3>滚动升级步骤（零停机）</h3>
<pre><code># ========== 节点 A (192.168.1.10) ==========

# 1. 修改配置（在升级前！）
$ vim conf/iotdb-conf.properties
dn_rpc_address=192.168.1.10
dn_internal_address=192.168.1.10

# 2. 停止 DataNode
$ ./sbin/stop-datanode.sh

# 3. 备份
$ cp -r data/ /backup/data.nodeA.$(date +%Y%m%d)

# 4. 替换二进制
$ wget https://dlcdn.apache.org/iotdb/1.3.7/apache-iotdb-1.3.7-bin.tar.gz
$ tar -xzf apache-iotdb-1.3.7-bin.tar.gz
$ cp -r apache-iotdb-1.3.7/* /path/to/iotdb/

# 5. 启动
$ ./sbin/start-datanode.sh

# 6. 验证
$ ./sbin/start-cli.sh -h 192.168.1.10
IoTDB&gt; show datanodes;  # 确认节点状态

# ========== 节点 B (192.168.1.11) ==========
# 重复上述步骤（一次升级一个节点）
</code></pre>
<h3>升级后验证</h3>
<pre><code># 1. 版本检查
$ ./sbin/start-cli.sh -v

# 2. 基本查询测试
IoTDB&gt; SELECT count(*) FROM root.**;

# 3. 写入测试
IoTDB&gt; INSERT INTO root.sg.d1(time, s1) VALUES (now(), 123);

# 4. 日志检查
$ tail -100 log/iotdb.log | grep -E "ERROR|WARN"
# 应无异常
</code></pre>
<hr />
<h2>参考资料</h2>
<ul>
<li><a href="https://github.com/apache/iotdb/releases/tag/v1.3.7">IoTDB V1.3.7 Release Notes</a></li>
<li><a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">IoTDB V2.0.7 Release Notes</a></li>
<li><a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">IoTDB 公众号发布说明</a></li>
<li><a href="https://iotdb.apache.org/UserGuide/V1.3.x/">IoTDB 1.x 文档</a></li>
<li><a href="https://iotdb.apache.org/UserGuide/V2.0.x/">IoTDB 2.x 文档</a></li>
</ul>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-03-05T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Apache IoTDB V2.0.7 版本解析：安全加固与架构优化]]></title>
        <id>https://critas.wang/posts/iotdb-v207-release-notes/</id>
        <link href="https://critas.wang/posts/iotdb-v207-release-notes/"/>
        <updated>2026-03-05T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Apache IoTDB V2.0.7 版本深度分析，包括 RPC 地址变更、JEXL 函数移除、内部服务绑定优化等架构决策解读。]]></summary>
        <content type="html"><![CDATA[<h2>写在前面</h2>
<p>Apache IoTDB V2.0.7/V1.3.7 于 2026-03-04 同步发布。表面上看，这是一个以安全加固为主的版本，但深入分析代码变更后，会发现这次更新背后有几个值得深思的架构决策。</p>
<p>本文不会简单罗列 Release Notes，而是从以下几个维度进行深度解析：</p>
<ol>
<li><strong>RPC 地址变更</strong> — 为什么从 <code>0.0.0.0</code> 改为 <code>127.0.0.1</code>？</li>
<li><strong>移除 JEXL 函数</strong> — 技术债的清理策略</li>
<li><strong>内部服务绑定优化</strong> — 网络分层设计</li>
<li><strong>集群部署影响</strong> — 生产环境如何平滑升级？</li>
</ol>
<blockquote>
<p>本文内容参考了 <a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">Apache IoTDB 公众号发布说明</a> 及 <a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">GitHub Release Notes</a>。</p>
</blockquote>
<hr />
<h2>变更一：RPC 默认地址变更的深度分析</h2>
<h3>变更内容</h3>
<pre><code>// V2.0.6 及之前
private String rpcAddress = "0.0.0.0";  // 监听所有网络接口

// V2.0.7
private String rpcAddress = "127.0.0.1";  // 仅监听本地回环
</code></pre>
<h3>为什么要改？</h3>
<p>这是一个典型的 <strong>安全默认值（Secure by Default）</strong> 设计决策。</p>
<p><strong>问题根源：</strong>
在云原生和容器化部署场景中，很多用户直接使用默认配置启动 IoTDB。当 <code>rpcAddress=0.0.0.0</code> 时，数据库会监听所有网络接口，包括：</p>
<ul>
<li>内网接口（eth0）</li>
<li>公网接口（如果有的话）</li>
<li>Docker 网桥接口（docker0）</li>
</ul>
<p><strong>风险场景：</strong></p>
<pre><code>┌─────────────────────────────────────────┐
│          公网/互联网                     │
│              ↓ (未授权访问)              │
│    ┌─────────────────────────┐          │
│    │   服务器 (0.0.0.0:6667)  │          │
│    │   ┌─────────────────┐   │          │
│    │   │   IoTDB         │   │          │
│    │   │   RPC: 0.0.0.0  │   │          │  ← 问题：暴露在所有接口
│    │   └─────────────────┘   │          │
│    └─────────────────────────┘          │
└─────────────────────────────────────────┘
</code></pre>
<p><strong>改为 127.0.0.1 后的效果：</strong></p>
<pre><code>┌─────────────────────────────────────────┐
│          公网/互联网                     │
│              X (无法访问)               │
│    ┌─────────────────────────┐          │
│    │   服务器 (127.0.0.1)    │          │
│    │   ┌─────────────────┐   │          │
│    │   │   IoTDB         │   │          │
│    │   │   RPC: 127.0.0.1│   │          │  ← 安全：仅本地可访问
│    │   └─────────────────┘   │          │
│    └─────────────────────────┘          │
│         ↑                               │
│    需要显式配置才能开放                  │
└─────────────────────────────────────────┘
</code></pre>
<h3>对集群部署的影响</h3>
<p><strong>这是本次升级最大的坑！</strong></p>
<h4>场景一：单机部署（无影响）</h4>
<pre><code># 默认配置即可
dn_rpc_address=127.0.0.1  # CLI 本地连接，没问题
</code></pre>
<h4>场景二：集群部署（必须修改配置）</h4>
<p><strong>错误配置（无法连接）：</strong></p>
<pre><code># DataNode A (192.168.1.10)
dn_rpc_address=127.0.0.1  # [错误] 只监听本地，其他节点无法连接！

# DataNode B (192.168.1.11)
dn_rpc_address=127.0.0.1  # [错误] 同上
</code></pre>
<p><strong>正确配置：</strong></p>
<pre><code># DataNode A (192.168.1.10)
dn_rpc_address=192.168.1.10      # 绑定实际 IP
dn_internal_address=192.168.1.10 # 内部通信地址

# DataNode B (192.168.1.11)
dn_rpc_address=192.168.1.11      # 绑定实际 IP
dn_internal_address=192.168.1.11 # 内部通信地址
</code></pre>
<h3>架构思考</h3>
<p>这个变更反映了 IoTDB 团队对安全边界的重新思考：</p>
<ol>
<li><strong>默认安全</strong>：用户需要显式选择开放网络访问，而不是反过来</li>
<li><strong>职责分离</strong>：<code>rpc_address</code> 用于客户端连接，<code>internal_address</code> 用于内部服务通信</li>
<li><strong>最小权限原则</strong>：只开放必要的网络接口</li>
</ol>
<hr />
<h2>变更二：移除 JEXL 函数 — 技术债的清理</h2>
<h3>什么是 JEXL？</h3>
<p>JEXL (Java Expression Language) 是一个轻量级的表达式解析引擎。在 IoTDB 中，它曾被用于：</p>
<ul>
<li>UDF（用户定义函数）表达式解析</li>
<li>查询条件动态计算</li>
<li>数据转换脚本</li>
</ul>
<h3>为什么要移除？</h3>
<h4>问题一：安全风险</h4>
<p>JEXL 支持动态执行任意 Java 表达式，这带来了代码注入风险：</p>
<pre><code>// 恶意用户可能构造这样的查询
SELECT JEXL("Runtime.getRuntime().exec('rm -rf /')") FROM root.sg.d1;
</code></pre>
<p>虽然 IoTDB 有权限控制，但表达式解析层的安全审计非常困难。</p>
<h4>问题二：维护成本高</h4>
<p>JEXL 是一个独立的依赖，需要：</p>
<ul>
<li>定期升级修复 CVE</li>
<li>兼容性问题处理</li>
<li>文档和维护成本</li>
</ul>
<h4>问题三：使用率低</h4>
<p>JEXL 函数在实际使用中并不常见。大多数查询场景可以通过：</p>
<ul>
<li>内置函数（<code>sin</code>, <code>cos</code>, <code>avg</code>, <code>max</code> 等）</li>
<li>客户端预处理</li>
<li>外部计算引擎（Spark/Flink）</li>
</ul>
<p>来实现。</p>
<h3>替代方案</h3>
<table>
<thead>
<tr>
<th>原 JEXL 场景</th>
<th>替代方案</th>
</tr>
</thead>
<tbody>
<tr>
<td>简单数学计算</td>
<td>内置算术运算符 (<code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>)</td>
</tr>
<tr>
<td>复杂函数</td>
<td>自定义 UDF（Java 编译）</td>
</tr>
<tr>
<td>数据转换</td>
<td>客户端预处理或 ETL 工具</td>
</tr>
</tbody>
</table>
<hr />
<h2>变更三：内部服务绑定优化</h2>
<h3>变更前</h3>
<pre><code>// 所有服务绑定到同一个地址
String bindAddress = config.getRpcAddress();  // 可能是 0.0.0.0
rpcService.bind(bindAddress);
internalService.bind(bindAddress);  // 内部服务也暴露在外网！
</code></pre>
<h3>变更后</h3>
<pre><code>// RPC 和内部服务使用不同地址
String rpcAddress = config.getRpcAddress();        // 127.0.0.1
String internalAddress = config.getInternalAddress(); // 内网 IP

rpcService.bind(rpcAddress);
internalService.bind(internalAddress);  // 内部服务只监听内网
</code></pre>
<h3>架构意义</h3>
<p>这是一个网络分层的设计改进：</p>
<pre><code>┌─────────────────────────────────────┐
│           客户端层                   │
│         (CLI, JDBC, Session)        │
│              ↓ RPC (6667)           │
├─────────────────────────────────────┤
│           DataNode 层                │
│  ┌─────────────────────────────┐    │
│  │ RPC Service: 127.0.0.1      │    │  ← 仅本地可访问
│  └─────────────────────────────┘    │
│  ┌─────────────────────────────┐    │
│  │ Internal Service: 内网 IP   │    │  ← 仅集群内可访问
│  └─────────────────────────────┘    │
└─────────────────────────────────────┘
</code></pre>
<hr />
<h2>其他变更</h2>
<h3>Pipe 命名检查</h3>
<p>V2.0.7 新增了创建 Pipe 时的命名合法性校验，防止因非法字符导致的运行时错误。</p>
<h3>分区表 TTL 删除逻辑修复</h3>
<p>修复了分区表自动删除逻辑中的问题：此前仅 DB 级别配置的 TTL 生效，且使用的是 DB 内的最大 TTL 值。</p>
<h3>安全漏洞（v2.0.6 已修复）</h3>
<p>需要注意的是，以下 CVE 漏洞已在 <strong>v2.0.6/v1.3.6</strong> 中修复，而非本次 v2.0.7：</p>
<ul>
<li><strong>CVE-2025-12183</strong>（高危）— 远程代码执行</li>
<li><strong>CVE-2025-66566</strong>（中危）— 权限绕过</li>
<li><strong>CVE-2025-11226</strong>（中危）— 信息泄露</li>
</ul>
<p>如果你还在使用 v2.0.5 或更早版本，建议直接升级到 v2.0.7 以同时获得 CVE 修复和本次安全加固。</p>
<hr />
<h2>生产环境升级指南</h2>
<h3>升级前检查清单</h3>
<pre><code># 1. 检查当前配置
grep -E "rpc_address|internal_address" conf/iotdb-conf.properties

# 2. 检查集群拓扑
./sbin/start-cli.sh
&gt; show datanodes;
&gt; show confignodes;

# 3. 备份（重要！）
cp -r data/ data.backup.$(date +%Y%m%d)
cp -r conf/ conf.backup.$(date +%Y%m%d)
</code></pre>
<h3>集群升级步骤</h3>
<h4>步骤一：准备新配置</h4>
<pre><code># iotdb-conf.properties (每个节点不同)

# ============ 节点 A (192.168.1.10) ============
dn_rpc_address=192.168.1.10
dn_internal_address=192.168.1.10
dn_seed_config_node=192.168.1.10:9003

# ============ 节点 B (192.168.1.11) ============
dn_rpc_address=192.168.1.11
dn_internal_address=192.168.1.11
dn_seed_config_node=192.168.1.10:9003
</code></pre>
<h4>步骤二：滚动升级</h4>
<pre><code># 1. 升级 ConfigNode（先主后备）
./sbin/stop-confignode.sh
# 替换二进制文件
./sbin/start-confignode.sh

# 2. 滚动升级 DataNode（一次一个节点）
for node in node1 node2 node3; do
    ssh $node "./sbin/stop-datanode.sh"
    # 替换二进制文件和配置
    ssh $node "./sbin/start-datanode.sh"
    # 验证节点加入集群
    ./sbin/start-cli.sh -e "show datanodes"
done
</code></pre>
<h4>步骤三：验证</h4>
<pre><code># 1. 检查集群状态
./sbin/start-cli.sh
&gt; show datanodes;
&gt; show confignodes;

# 2. 测试跨节点查询
&gt; SELECT count(*) FROM root.sg.d1;

# 3. 检查日志
tail -f log/iotdb.log | grep -E "ERROR|WARN"
</code></pre>
<hr />
<h2>总结</h2>
<h3>这次更新反映了什么趋势？</h3>
<ol>
<li><strong>安全优先</strong>：从"方便使用"转向"默认安全"</li>
<li><strong>技术债清理</strong>：移除使用率低、风险高的功能（JEXL）</li>
<li><strong>网络分层</strong>：明确区分客户端流量和内部服务流量</li>
</ol>
<h3>对用户的建议</h3>
<table>
<thead>
<tr>
<th>用户类型</th>
<th>建议</th>
</tr>
</thead>
<tbody>
<tr>
<td>单机测试</td>
<td>直接升级，无影响</td>
</tr>
<tr>
<td>集群部署</td>
<td><strong>必须修改配置</strong>后再升级</td>
</tr>
<tr>
<td>容器化部署</td>
<td>更新 Docker 镜像和配置模板</td>
</tr>
<tr>
<td>云服务</td>
<td>联系云厂商确认配置模板</td>
</tr>
</tbody>
</table>
<hr />
<h2>参考资料</h2>
<ul>
<li><a href="https://github.com/apache/iotdb/releases/tag/v2.0.7">IoTDB V2.0.7 Release Notes</a></li>
<li><a href="https://github.com/apache/iotdb/releases/tag/v1.3.7">IoTDB V1.3.7 Release Notes</a></li>
<li><a href="https://mp.weixin.qq.com/s/X0hu_CxgS12cQXl67mYmiQ">IoTDB 公众号发布说明</a></li>
<li><a href="https://iotdb.apache.org/UserGuide/V2.0.x/Configuration/ConfigurationFile.html">IoTDB 配置文档</a></li>
</ul>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-03-05T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[AI 编程工具与 IDE 全景介绍与对比]]></title>
        <id>https://critas.wang/posts/ai-coding-tools-comparison/</id>
        <link href="https://critas.wang/posts/ai-coding-tools-comparison/"/>
        <updated>2026-02-25T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[2025-2026 主流 AI 编程工具深度解析，涵盖终端智能体、AI 原生 IDE、IDE 插件三大类别的横向对比与选型建议。]]></summary>
        <content type="html"><![CDATA[<h2>一、AI 编程工具市场概述</h2>
<p>2024-2026 年，AI 编程工具市场经历了爆发式增长。从最初的代码自动补全，到如今能够自主完成复杂多文件重构的智能体（Agent），AI 编程助手已经从「锦上添花」变成了开发者的核心生产力工具。</p>
<p>当前市场上的 AI 编程工具大致可以分为三大类别：</p>
<h3>1. AI 原生 IDE（AI-Native Editors）</h3>
<p>以 AI 为核心重新构建的编辑器，如 Cursor、Windsurf、Trae、Kiro 等。它们理解整个代码库，而非仅限于当前文件，提供深度的上下文感知能力。</p>
<h3>2. IDE 插件/扩展（IDE Extensions）</h3>
<p>嵌入现有编辑器的 AI 助手，如 GitHub Copilot、Cline、Continue、Augment Code、Sourcegraph Cody、JetBrains AI Assistant 等。采用成本低，但能力通常不如原生 IDE 深度集成。</p>
<h3>3. 终端智能体（Terminal Agents / CLI Tools）</h3>
<p>在终端中运行的自主编程代理，如 Claude Code、OpenAI Codex CLI、OpenCode、Aider 等。开发者分配任务，它们跨文件、跨工具自主执行。适合高级开发者和自动化场景。</p>
<p>据统计，GitHub Copilot 仍以约 42% 的付费市场份额领先，但 Cursor 的年收入已突破 5 亿美元。Claude Opus 4.6 在 SWE-bench Verified 上达到 80.8%，编码能力处于业界领先水平。市场并未走向集中，而是走向专业化。</p>
<hr />
<h2>二、终端智能体类工具（Terminal Agents）</h2>
<h3>2.1 Claude Code（Anthropic）</h3>
<p><strong>产品定位：</strong> Anthropic 官方推出的终端优先（Terminal-First）AI 编程智能体，面向专业开发者。</p>
<p><strong>底层模型：</strong> Claude Opus 4.6 / Sonnet 4.6 / Haiku 4.5，支持自动模型切换。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>终端原生体验，直接在命令行中与 AI 交互，无需离开开发环境</li>
<li>深度代码库理解：自动索引整个项目，支持跨文件搜索、编辑、重构</li>
<li>自主执行能力：可运行 Shell 命令、管理文件、执行测试、操作 Git</li>
<li>支持 MCP（Model Context Protocol）协议，可连接外部工具和数据源</li>
<li>多级权限控制：Suggest / Auto Edit / Full Auto 三种审批模式</li>
<li>支持 Hooks 机制和子代理（Sub-agent）并行执行</li>
</ul>
<p><strong>适用场景：</strong> 复杂多文件重构、自动化工作流、CI/CD 集成、终端重度用户。</p>
<p><strong>价格：</strong> 按 API 用量计费。Max 订阅计划 $100-$200/月。</p>
<p><strong>优势：</strong> 推理能力业界领先（SWE-bench Verified 80.8%），终端集成度极高，自主性强。</p>
<p><strong>不足：</strong> 纯终端界面对新手不够友好，无图形化编辑器，API 费用较高。</p>
<h3>2.2 OpenAI Codex CLI（OpenAI）</h3>
<p><strong>产品定位：</strong> OpenAI 推出的终端 AI 编程代理，Claude Code 的直接竞品。</p>
<p><strong>底层模型：</strong> GPT-5.1-Codex-Max / o3 推理模型。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>终端原生运行，支持文件读写、Shell 命令执行、Git 操作</li>
<li>三级审批模式：Suggest / Auto Edit / Full Auto</li>
<li>云端 Codex Agent 版本可在 ChatGPT 中运行，支持多代理并行</li>
<li>Codex App（macOS 桌面版）支持 Git Worktree、Skills、Automations</li>
<li>支持 MCP 协议</li>
</ul>
<p><strong>适用场景：</strong> 终端开发者、OpenAI 生态用户、需要云端+本地双模式的团队。</p>
<p><strong>价格：</strong> CLI 免费开源；Codex Agent 需 ChatGPT Plus $20/月 或 Pro $200/月。</p>
<p><strong>优势：</strong> 免费开源 CLI，云端 Agent 功能强大，GPT 生态集成好。</p>
<p><strong>不足：</strong> CLI 功能相比 Claude Code 仍有差距，云端版需付费订阅。</p>
<h3>2.3 OpenCode</h3>
<p><strong>产品定位：</strong> 开源终端 AI 编程代理，主打「BYOK」（Bring Your Own Key）和模型自由。</p>
<p><strong>底层模型：</strong> 支持 75+ 模型提供商，包括 Claude、OpenAI、Gemini、本地模型（Ollama）等。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>终端原生 TUI 界面，Go + JavaScript 构建，性能优秀</li>
<li>支持多会话、LSP 自动加载、上下文感知</li>
<li>Client/Server 架构，支持桌面应用和 VS Code 扩展</li>
<li>完全开源，数据隐私可控</li>
</ul>
<p><strong>适用场景：</strong> 注重隐私、需要使用本地模型、希望灵活切换模型的开发者。</p>
<p><strong>价格：</strong> 免费开源，模型费用自付。</p>
<p><strong>优势：</strong> 模型自由度最高，完全开源，隐私友好。</p>
<p><strong>不足：</strong> 社区生态不如 Claude Code 成熟，部分高级功能仍在开发中。</p>
<h3>2.4 Aider</h3>
<p><strong>产品定位：</strong> 开源终端 AI 结对编程工具，专注于 Git 仓库内的代码编辑。</p>
<p><strong>底层模型：</strong> 支持 Claude、GPT-4o、DeepSeek、本地模型等几乎所有主流 LLM。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>Git 深度集成：自动提交、变更追踪、分支管理</li>
<li>多文件协同编辑，理解项目完整上下文</li>
<li>支持多种编辑模式（whole file / diff / unified diff）</li>
<li>丰富的命令行选项和配置</li>
</ul>
<p><strong>适用场景：</strong> Git 工作流重度用户、需要精细控制代码变更的开发者。</p>
<p><strong>价格：</strong> 免费开源，模型费用自付。</p>
<p><strong>优势：</strong> Git 集成最佳，编辑模式灵活，社区活跃。</p>
<p><strong>不足：</strong> 自主执行能力不如 Claude Code，无 Shell 命令执行。</p>
<hr />
<h2>三、AI 原生 IDE（AI-Native Editors）</h2>
<h3>3.1 Cursor</h3>
<p><strong>产品定位：</strong> 最受欢迎的 AI 原生代码编辑器，基于 VS Code 深度改造，年收入突破 5 亿美元。</p>
<p><strong>底层模型：</strong> 支持 Claude Sonnet/Opus、GPT-4o、自研模型，可自由切换。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>代码库级上下文理解（Codebase Indexing），支持 @codebase 全局搜索</li>
<li>Composer 模式：多文件同时编辑，Agent 自主执行任务</li>
<li>Tab 智能补全：基于上下文的多行预测补全</li>
<li>内联编辑（Cmd+K）：选中代码直接用自然语言修改</li>
<li>支持自定义 Rules 和 .cursorrules 项目配置</li>
</ul>
<p><strong>适用场景：</strong> 日常编码、复杂项目开发、需要深度代码库理解的团队。</p>
<p><strong>价格：</strong> Hobby 免费（有限额）；Pro $20/月；Business $40/月。</p>
<p><strong>优势：</strong> IDE 体验最佳，代码库理解深度领先，Composer Agent 能力强。</p>
<p><strong>不足：</strong> Pro 版有请求限额，重度使用可能需要自带 API Key。</p>
<h3>3.2 Windsurf（原 Codeium）</h3>
<p><strong>产品定位：</strong> AI 原生 IDE，主打高性价比和 Agentic 工作流。2025 年被 OpenAI 宣布以约 30 亿美元收购。</p>
<p><strong>底层模型：</strong> GPT-4、Claude、自研模型，收购后将深度集成 OpenAI 模型。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>Cascade Agent：自主执行多步骤任务，支持终端命令</li>
<li>Flows 系统：AI 与开发者协作的工作流引擎</li>
<li>慷慨的免费额度，入门门槛低</li>
<li>基于 VS Code 构建，插件生态兼容</li>
</ul>
<p><strong>适用场景：</strong> 预算敏感的开发者、需要 Agentic 能力但不想付高价的团队。</p>
<p><strong>价格：</strong> 免费版额度慷慨；Pro $10/月；Team $15/月。</p>
<p><strong>优势：</strong> 性价比最高，免费额度大方，Cascade Agent 体验好。</p>
<p><strong>不足：</strong> 被 OpenAI 收购后未来方向不确定，部分高级功能不如 Cursor 成熟。</p>
<h3>3.3 Trae（ByteDance / 字节跳动）</h3>
<p><strong>产品定位：</strong> 字节跳动推出的免费 AI IDE，定位「真正的 AI 工程师」，主打自主开发能力。</p>
<p><strong>底层模型：</strong> Claude Sonnet、GPT-4o、豆包大模型等。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>SOLO Agent：自主完成从需求到部署的完整开发流程</li>
<li>Builder 模式 + Chat 模式双模交互</li>
<li>Trae Agent CLI：终端版自主编程代理</li>
<li>DevBox 云端开发环境集成</li>
<li>基于 VS Code 构建，完全免费</li>
</ul>
<p><strong>适用场景：</strong> 个人开发者、初创团队、需要免费 AI IDE 的用户。</p>
<p><strong>价格：</strong> 完全免费。</p>
<p><strong>优势：</strong> 完全免费，SOLO Agent 自主能力强，支持中文。</p>
<p><strong>不足：</strong> 企业级功能不足，数据隐私存在顾虑（字节跳动背景），生态不如 Cursor。</p>
<h3>3.4 Kiro（AWS）</h3>
<p><strong>产品定位：</strong> AWS 推出的规格驱动（Spec-Driven）Agentic IDE，强调从「Vibe Coding」到生产级代码的转变。</p>
<p><strong>底层模型：</strong> Claude Sonnet 4（Claude 3.7 作为备选）。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>Spec-Driven 开发：将自然语言需求转化为规格文档、设计、任务列表，再生成代码</li>
<li>Steering 文件系统：项目级 AI 行为配置</li>
<li>Hooks 自动化：代码保存时自动触发测试、lint 等</li>
<li>深度 AWS 服务集成，支持 MCP</li>
<li>基于 VS Code (Code-OSS) 构建</li>
</ul>
<p><strong>适用场景：</strong> AWS 生态用户、企业级项目、需要结构化开发流程的团队。</p>
<p><strong>价格：</strong> 免费预览中；正式版预计有免费和付费层级。</p>
<p><strong>优势：</strong> 规格驱动方法论独特，AWS 集成深度，适合企业级开发。</p>
<p><strong>不足：</strong> 仍在预览阶段，功能不够成熟，非 AWS 用户吸引力有限。</p>
<hr />
<h2>四、IDE 插件/扩展类工具（IDE Extensions）</h2>
<h3>4.1 GitHub Copilot（Microsoft / GitHub）</h3>
<p><strong>产品定位：</strong> 全球市占率最高的 AI 编程助手，深度集成 GitHub 生态。</p>
<p><strong>底层模型：</strong> GPT-5、GPT-4.1、Claude Sonnet、Gemini 等多模型支持。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>实时代码补全：行内智能建议，支持多行预测</li>
<li>Copilot Chat：对话式编程助手，支持 @workspace 上下文</li>
<li>Copilot Agent Mode：自主执行多步骤任务</li>
<li>GitHub 深度集成：PR 审查、Issue 分析、Actions 自动化</li>
<li>支持 VS Code、JetBrains、Neovim、Xcode 等主流 IDE</li>
</ul>
<p><strong>适用场景：</strong> GitHub 生态用户、团队协作、企业级开发。</p>
<p><strong>价格：</strong> Free 免费（有限额）；Pro $10/月；Business $19/月；Enterprise $39/月。</p>
<p><strong>优势：</strong> 市占率最高，GitHub 集成无可替代，多 IDE 支持，企业合规认证齐全。</p>
<p><strong>不足：</strong> Agent 能力不如 Cursor/Claude Code，代码库理解深度有限。</p>
<h3>4.2 Cline</h3>
<p><strong>产品定位：</strong> 开源自主 AI 编程代理，作为 VS Code 扩展运行，模型无关。</p>
<p><strong>底层模型：</strong> 支持 Claude、GPT、Gemini、DeepSeek、本地模型等，用户自选。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>自主执行：创建/编辑文件、运行终端命令、浏览器操作</li>
<li>人机协作审批：每步操作需用户确认，安全可控</li>
<li>BYOK 模式：自带 API Key，无订阅费</li>
<li>MCP 支持：可连接外部工具和服务</li>
<li>VS Code 安装量超 500 万</li>
</ul>
<p><strong>适用场景：</strong> 需要灵活选择模型、注重成本控制的开发者。</p>
<p><strong>价格：</strong> 免费开源，模型费用自付。</p>
<p><strong>优势：</strong> 完全开源，模型自由，社区活跃，功能全面。</p>
<p><strong>不足：</strong> 每步审批可能影响效率，上下文管理不如 Cursor 精细。</p>
<h3>4.3 Augment Code</h3>
<p><strong>产品定位：</strong> 企业级 AI 编程助手，主打超大代码库上下文理解（40 万+文件）。</p>
<p><strong>底层模型：</strong> 自研 Context Engine + 多模型支持。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>Context Engine：可同时处理 40 万+文件，企业级代码库理解</li>
<li>Next Edit 预测：智能预判下一步编辑</li>
<li>MCP 和原生工具支持</li>
<li>SOC 2 Type II 和 ISO/IEC 42001 认证</li>
</ul>
<p><strong>适用场景：</strong> 大型企业、超大代码库项目。</p>
<p><strong>价格：</strong> Indie $20/月；Standard $60/月；Enterprise 定制。</p>
<p><strong>优势：</strong> 超大代码库支持无人能及，企业合规认证齐全。</p>
<p><strong>不足：</strong> 价格较高，个人开发者性价比不如 Cursor。</p>
<h3>4.4 Continue</h3>
<p><strong>产品定位：</strong> 开源 AI 编程助手，支持 VS Code 和 JetBrains，主打可定制性。</p>
<p><strong>底层模型：</strong> 支持几乎所有主流模型，包括本地模型。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>Tab 自动补全 + Chat 对话 + Agent 模式三合一</li>
<li>完全开源，可自托管，数据不出本地</li>
<li>支持自定义 Slash 命令和上下文提供者</li>
</ul>
<p><strong>价格：</strong> 免费开源。</p>
<p><strong>优势：</strong> 开源可定制，隐私友好，JetBrains 支持好。</p>
<p><strong>不足：</strong> 功能深度不如商业产品，需要自行配置模型。</p>
<h3>4.5 Sourcegraph Cody</h3>
<p><strong>产品定位：</strong> 基于 Sourcegraph 代码搜索引擎的 AI 编程助手，擅长大型代码库导航。</p>
<p><strong>底层模型：</strong> Claude、GPT-4o、Gemini 等多模型支持。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>全仓库上下文理解，基于 Sourcegraph 代码图谱</li>
<li>智能代码搜索 + AI Chat + 自动补全三合一</li>
<li>自定义 Prompts 和 Commands</li>
<li>支持 VS Code 和 JetBrains</li>
</ul>
<p><strong>价格：</strong> Free 免费；Pro $9/月；Enterprise 年付定制。</p>
<p><strong>优势：</strong> 代码搜索能力最强，大型 Monorepo 支持好。</p>
<p><strong>不足：</strong> Agent 能力较弱，主要是辅助而非自主执行。</p>
<h3>4.6 JetBrains AI Assistant</h3>
<p><strong>产品定位：</strong> JetBrains 官方 AI 助手，深度集成 IntelliJ 全家桶。</p>
<p><strong>底层模型：</strong> JetBrains 自研模型 + Claude、GPT-4o 等。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>与 IntelliJ、PyCharm、WebStorm 等 IDE 深度集成</li>
<li>AI Chat + 代码补全 + 重构建议</li>
<li>理解项目结构和框架约定</li>
</ul>
<p><strong>价格：</strong> AI Free 免费（有限额）；AI Pro 包含在 JetBrains All Products Pack 中。</p>
<p><strong>优势：</strong> JetBrains 用户无缝体验，IDE 集成度最高。</p>
<p><strong>不足：</strong> 仅限 JetBrains IDE，Agent 能力较弱。</p>
<h3>4.7 Tabnine</h3>
<p><strong>产品定位：</strong> 隐私优先的 AI 编程助手，支持本地部署和企业私有化。</p>
<p><strong>底层模型：</strong> 自研模型，支持本地运行，不将代码发送到云端。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>本地模型运行，代码不出企业网络</li>
<li>支持 VS Code、JetBrains、Neovim 等 15+ IDE</li>
<li>团队代码风格学习和适配</li>
<li>SOC 2 Type II 认证，企业合规</li>
</ul>
<p><strong>价格：</strong> Dev $9/月；Enterprise 定制。</p>
<p><strong>优势：</strong> 隐私保护最强，支持本地部署，企业合规。</p>
<p><strong>不足：</strong> 模型能力不如 Claude/GPT，Agent 功能缺失。</p>
<h3>4.8 Amazon Q Developer（AWS）</h3>
<p><strong>产品定位：</strong> AWS 官方 AI 开发助手，覆盖编码、测试、部署、运维全流程。</p>
<p><strong>底层模型：</strong> Amazon 自研基础模型。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>代码补全 + AI Chat + 代码转换（Java 8→17 等）</li>
<li>安全扫描与自动修复</li>
<li>AWS 服务深度集成：CloudFormation、CDK、Lambda 等</li>
<li>支持 VS Code、JetBrains、命令行</li>
</ul>
<p><strong>价格：</strong> Free 免费（有限额）；Pro $19/月。</p>
<p><strong>优势：</strong> AWS 集成最深，安全扫描能力强，免费额度可观。</p>
<p><strong>不足：</strong> 通用编码能力不如 Copilot/Cursor，非 AWS 场景吸引力有限。</p>
<hr />
<h2>五、其他值得关注的工具</h2>
<h3>5.1 Replit AI</h3>
<p><strong>产品定位：</strong> 云端 AI 开发平台，主打浏览器内全栈开发，零配置即用。</p>
<p><strong>底层模型：</strong> 自研模型 + Claude、GPT 等。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>浏览器内完整 IDE，无需本地环境</li>
<li>Replit Agent：从自然语言描述生成完整应用</li>
<li>一键部署，内置数据库和托管服务</li>
</ul>
<p><strong>价格：</strong> Free 免费；Replit Core $25/月。</p>
<p><strong>优势：</strong> 零配置，适合快速原型和教学。</p>
<p><strong>不足：</strong> 不适合大型项目，性能受限于云端。</p>
<h3>5.2 Zed AI</h3>
<p><strong>产品定位：</strong> 高性能原生代码编辑器，内置 AI 助手，主打速度和协作。</p>
<p><strong>底层模型：</strong> Claude、GPT-4o、本地模型等。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>Rust 构建，启动和响应速度极快</li>
<li>内置 AI Chat 和 Inline Assist</li>
<li>实时多人协作编辑</li>
</ul>
<p><strong>价格：</strong> 免费开源。</p>
<p><strong>优势：</strong> 性能最快，协作体验好，开源。</p>
<p><strong>不足：</strong> 插件生态不如 VS Code，AI 功能深度有限。</p>
<h3>5.3 Roo Code</h3>
<p><strong>产品定位：</strong> Cline 的「可靠性优先」分支，强调稳定性和企业适用性。</p>
<p><strong>底层模型：</strong> 支持所有主流模型，与 Cline 相同的 BYOK 模式。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>基于 Cline 代码库，增强了稳定性和错误处理</li>
<li>自定义模式系统，可定义不同角色的 AI 行为</li>
<li>更保守的默认设置，减少意外操作</li>
</ul>
<p><strong>价格：</strong> 免费开源。</p>
<p><strong>优势：</strong> 比 Cline 更稳定可靠，适合生产环境。</p>
<p><strong>不足：</strong> 社区规模不如 Cline，创新速度较慢。</p>
<h3>5.4 阿里云 Coding Plan（Alibaba Cloud Model Studio）— 模型订阅平台</h3>
<p><strong>产品定位：</strong> 阿里云百炼平台推出的多模型编程订阅服务（非编程工具本身），一个订阅即可自由切换多款顶级编程模型，搭配 Claude Code、Cline 等客户端使用，主打极致性价比。</p>
<p><strong>底层模型：</strong> Qwen3.5-Plus（397B 参数）、GLM-5（智谱 744B 参数）、MiniMax M2.5（230B 参数）、Kimi K2.5、Qwen3-Coder-Next 等。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>多模型自由切换：一个订阅覆盖 Qwen、GLM-5、MiniMax M2.5、Kimi K2.5 等多款模型</li>
<li>兼容主流 AI 编程工具：支持 Claude Code、Cline、OpenClaw、Qwen Code 等客户端接入</li>
<li>极致性价比：入门版每月最多 18,000 次请求，首月仅 ¥7.9（约 $1）</li>
<li>2026 年 2 月最新更新：新增 GLM-5 和 MiniMax M2.5 模型支持</li>
<li>API 兼容：提供标准 API 接口，开发者可灵活集成到自有工作流</li>
</ul>
<p><strong>适用场景：</strong> 中国开发者、预算敏感用户、需要多模型对比选择的团队、Claude Code 用户寻求低成本替代方案。</p>
<p><strong>价格：</strong> 入门版首月 ¥7.9 后 ¥39/月（18,000 次/月）；Pro 版首月 ¥39 后 ¥199/月（90,000 次/月）。</p>
<p><strong>优势：</strong> 价格极低（约为海外同类服务的 1/10），多模型自由切换，国内访问稳定。</p>
<p><strong>不足：</strong> 模型能力与 Claude Opus/GPT-5 仍有差距，国际用户使用不便，生态成熟度不如海外平台。</p>
<h3>5.5 Kilo Code</h3>
<p><strong>产品定位：</strong> Cline 生态的新竞争者，获得 800 万美元种子轮融资。</p>
<p><strong>底层模型：</strong> 支持多模型，BYOK 模式。</p>
<p><strong>核心特性：</strong></p>
<ul>
<li>VS Code 扩展，自主编程代理</li>
<li>强调开发者体验和易用性</li>
<li>活跃的社区和快速迭代</li>
</ul>
<p><strong>价格：</strong> 免费开源。</p>
<p><strong>优势：</strong> 有资金支持，迭代快速。</p>
<p><strong>不足：</strong> 较新，生态和功能成熟度不如 Cline。</p>
<hr />
<h2>六、综合对比表格</h2>
<p>以下表格从多个维度对主流 AI 编程工具进行横向对比：</p>
<table>
<thead>
<tr>
<th>工具名称</th>
<th>类型</th>
<th>底层模型</th>
<th>开源</th>
<th>价格</th>
<th>Agent 能力</th>
<th>IDE 支持</th>
<th>核心优势</th>
<th>主要不足</th>
</tr>
</thead>
<tbody>
<tr>
<td>Claude Code</td>
<td>终端 Agent</td>
<td>Claude Opus/Sonnet/Haiku</td>
<td>否</td>
<td>按量/$100+月</td>
<td>极强</td>
<td>终端/VS Code</td>
<td>推理最强，自主性高</td>
<td>终端门槛高，费用高</td>
</tr>
<tr>
<td>Codex CLI</td>
<td>终端 Agent</td>
<td>GPT-5.1/o3</td>
<td>是</td>
<td>免费/$20+月</td>
<td>强</td>
<td>终端</td>
<td>免费开源，云端+本地</td>
<td>功能不如 Claude Code</td>
</tr>
<tr>
<td>OpenCode</td>
<td>终端 Agent</td>
<td>75+ 模型</td>
<td>是</td>
<td>免费</td>
<td>强</td>
<td>终端/VS Code</td>
<td>模型自由，隐私友好</td>
<td>生态不够成熟</td>
</tr>
<tr>
<td>Aider</td>
<td>终端 Agent</td>
<td>多模型</td>
<td>是</td>
<td>免费</td>
<td>中</td>
<td>终端</td>
<td>Git 集成最佳</td>
<td>无 Shell 执行</td>
</tr>
<tr>
<td>Cursor</td>
<td>AI 原生 IDE</td>
<td>多模型</td>
<td>否</td>
<td>免费/$20月</td>
<td>强</td>
<td>独立 IDE</td>
<td>IDE 体验最佳</td>
<td>有请求限额</td>
</tr>
<tr>
<td>Windsurf</td>
<td>AI 原生 IDE</td>
<td>多模型</td>
<td>否</td>
<td>免费/$10月</td>
<td>强</td>
<td>独立 IDE</td>
<td>性价比最高</td>
<td>收购后方向不确定</td>
</tr>
<tr>
<td>Trae</td>
<td>AI 原生 IDE</td>
<td>多模型</td>
<td>否</td>
<td>免费</td>
<td>强</td>
<td>独立 IDE</td>
<td>完全免费</td>
<td>隐私顾虑</td>
</tr>
<tr>
<td>Kiro</td>
<td>AI 原生 IDE</td>
<td>Claude Sonnet</td>
<td>否</td>
<td>免费预览</td>
<td>中强</td>
<td>独立 IDE</td>
<td>规格驱动，AWS 集成</td>
<td>仍在预览阶段</td>
</tr>
<tr>
<td>GitHub Copilot</td>
<td>IDE 插件</td>
<td>GPT-5/多模型</td>
<td>否</td>
<td>免费/$10月</td>
<td>中强</td>
<td>多 IDE</td>
<td>市占率最高，GitHub 集成</td>
<td>Agent 能力一般</td>
</tr>
<tr>
<td>Cline</td>
<td>IDE 插件</td>
<td>多模型</td>
<td>是</td>
<td>免费</td>
<td>强</td>
<td>VS Code</td>
<td>开源灵活，功能全面</td>
<td>每步需审批</td>
</tr>
<tr>
<td>Augment Code</td>
<td>IDE 插件</td>
<td>自研+多模型</td>
<td>否</td>
<td>$20-60月</td>
<td>中</td>
<td>VS Code/JB</td>
<td>40万+文件上下文</td>
<td>价格较高</td>
</tr>
<tr>
<td>Tabnine</td>
<td>IDE 插件</td>
<td>自研</td>
<td>否</td>
<td>$9月起</td>
<td>弱</td>
<td>15+ IDE</td>
<td>隐私保护最强</td>
<td>模型能力有限</td>
</tr>
<tr>
<td>Amazon Q Dev</td>
<td>IDE 插件</td>
<td>Amazon 自研</td>
<td>否</td>
<td>免费/$19月</td>
<td>中</td>
<td>VS Code/JB</td>
<td>AWS 集成最深</td>
<td>通用能力一般</td>
</tr>
<tr>
<td>阿里云 Coding Plan</td>
<td>模型订阅平台</td>
<td>Qwen/GLM-5/M2.5</td>
<td>否</td>
<td>¥7.9-199月</td>
<td>依客户端</td>
<td>多客户端</td>
<td>多模型切换，极致性价比</td>
<td>模型能力有差距</td>
</tr>
</tbody>
</table>
<hr />
<h2>七、选型建议与总结</h2>
<h3>7.1 按开发者类型推荐</h3>
<h4>终端重度用户 / 高级开发者</h4>
<p>首选 Claude Code，推理能力最强，自主性最高。预算有限可选 OpenCode 或 Aider（开源免费）。Codex CLI 也是不错的免费选择。</p>
<h4>IDE 用户 / 日常编码</h4>
<p>首选 Cursor，IDE 体验最佳，代码库理解深度领先。预算敏感可选 Windsurf（$10/月）或 Trae（免费）。</p>
<h4>GitHub 生态用户</h4>
<p>GitHub Copilot 仍是最佳选择，与 GitHub 的集成无可替代。Agent Mode 也在持续增强。</p>
<h4>企业级 / 大型团队</h4>
<p>Augment Code 适合超大代码库（40万+文件）。Tabnine 适合对隐私有严格要求的企业。Amazon Q Developer 适合 AWS 深度用户。</p>
<h4>AWS 生态用户</h4>
<p>Kiro 的规格驱动开发方法论值得关注，与 AWS 服务深度集成。Amazon Q Developer 覆盖编码到运维全流程。</p>
<h4>中国开发者 / 预算敏感用户</h4>
<p>阿里云 Coding Plan 是极具性价比的选择，一个订阅即可切换 Qwen3.5、GLM-5、MiniMax M2.5、Kimi K2.5 等多款模型，首月低至 ¥7.9。搭配 Claude Code 或 Cline 等客户端使用，可大幅降低 AI 编程成本。Trae（字节跳动）则提供完全免费的 AI IDE 体验。</p>
<h3>7.2 2026 年趋势展望</h3>
<ul>
<li><strong>Agent 化：</strong> 从辅助补全到自主执行，AI 编程工具正在从「副驾驶」变成「自动驾驶」</li>
<li><strong>多模型支持：</strong> 几乎所有工具都在走向模型无关，用户可自由选择最适合的模型</li>
<li><strong>MCP 协议普及：</strong> Model Context Protocol 正在成为 AI 工具连接外部服务的标准</li>
<li><strong>终端 vs IDE 分化：</strong> 终端 Agent 适合自动化和高级用户，IDE 适合日常交互式开发</li>
<li><strong>开源崛起：</strong> Cline、OpenCode、Aider 等开源工具正在缩小与商业产品的差距</li>
<li><strong>企业合规：</strong> SOC 2、ISO 认证成为企业采购的硬性要求</li>
<li><strong>国产模型崛起：</strong> GLM-5（744B）、MiniMax M2.5（230B）、Qwen3.5 等国产模型编码能力快速追赶，阿里云 Coding Plan 等平台以极低价格提供多模型订阅</li>
</ul>
<p>总结：2026 年的 AI 编程工具市场已经高度成熟和专业化。没有一个工具能满足所有场景，许多开发者会同时使用 2-3 个工具来覆盖不同需求。选择工具时，应根据自身的工作流、预算、隐私要求和技术栈来综合考量。</p>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2026-02-25T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[gradle学习]]></title>
        <id>https://critas.wang/posts/gradle%E5%AD%A6%E4%B9%A0/</id>
        <link href="https://critas.wang/posts/gradle%E5%AD%A6%E4%B9%A0/"/>
        <updated>2018-01-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Gradle 构建工具学习笔记，包含 Maven 仓库配置与 Spring MVC 依赖管理。]]></summary>
        <content type="html"><![CDATA[<blockquote>
<p>maven repository</p>
</blockquote>
<ul>
<li>http://maven.aliyun.com/nexus/content/groups/public</li>
</ul>
<pre><code>repositories {
    maven {
        url 'http://maven.aliyun.com/nexus/content/groups/public'
    }
}
</code></pre>
<hr />
<blockquote>
<p>spring mvc 配置</p>
</blockquote>
<pre><code>dependencies {
    //Version
    def springVersion = "4.3.7.RELEASE"
    def mybatisVersion = "3.4.2"

    // https://mvnrepository.com/artifact/org.springframework/spring-webmvc
    compile group: 'org.springframework', name: 'spring-webmvc', version: '$springVersion'
    // https://mvnrepository.com/artifact/org.mybatis/mybatis
    compile group: 'org.mybatis', name: 'mybatis', version: '$mybatisVersion'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}
</code></pre>
<hr />
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2018-01-26T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[ssh无密码登录]]></title>
        <id>https://critas.wang/posts/ssh%E6%97%A0%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95/</id>
        <link href="https://critas.wang/posts/ssh%E6%97%A0%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95/"/>
        <updated>2018-01-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Linux 下使用 SSH 密钥对实现免密码登录的配置教程。]]></summary>
        <content type="html"><![CDATA[<p>ssh 无密码登录要使用公钥与私钥。linux下可以用用ssh-keygen生成公钥/私钥对，下面我以CentOS为例。</p>
<p>有机器A(本机)，B(192.168.2.209)。现想A通过ssh免密码登录到B。</p>
<ol>
<li>在A机下生成公钥/私钥对。</li>
</ol>
<pre><code>ssh-keygen -t rsa -P ''
</code></pre>
<p>直接ssh-keygen然后三次回车就可以了。
-P表示密码，-P '' 就表示空密码，也可以不用-P参数，这样就要三车回车，用-P就一次回车。
它在/home/用户下生成.ssh目录，.ssh下有id_rsa和id_rsa.pub。</p>
<ol>
<li>把A机下的id_rsa.pub复制到B机下，在B机的.ssh/authorized_keys文件里</li>
</ol>
<ul>
<li>用scp复制。（如果B机器没有.ssh和authorized_keys文件则先创建这个文件夹和文件）</li>
</ul>
<pre><code>scp ~/.ssh/id_rsa.pub [用户名]@[IP]:/home/[用户名]/id_rsa.pub
</code></pre>
<p>id_rsa.pub                                    100%  223     0.2KB/s   00:00</p>
<p>由于还没有免密码登录的，所以要输入密码。</p>
<ol>
<li>B机把从A机复制的id_rsa.pub添加到.ssh/authorzied_keys文件里。</li>
</ol>
<pre><code>cat id_rsa.pub &gt;&gt; .ssh/authorized_keys
chmod 755 ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
</code></pre>
<p>authorized_keys的权限要是600。</p>
<blockquote>
<p>无视2、3步，一步到位</p>
</blockquote>
<pre><code>ssh-copy-id -i ~/.ssh/id_rsa.pub [用户名]@[IP]
</code></pre>
<blockquote>
<p>mac安装 ssh-copy-id</p>
</blockquote>
<pre><code>curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh
</code></pre>
<p>由于直接ssh [IP]不指定用户名，则会默认使用本机的用户名，为了使用固定用户名则采用以下方式</p>
<pre><code>cd ~/.ssh
vi config
</code></pre>
<p>键入以下格式内容</p>
<pre><code>Host    [别名]
        HostName        [IP]
        User            [用户名]
Host    [别名]
        HostName        [IP]
        User            [用户名]
</code></pre>
<p>输入完成如下</p>
<pre><code>Host    dev
        HostName        192.168.2.209
        User            root
Host    test
        HostName        192.168.2.225
        User            root
</code></pre>
<p>至此直接输入如下命令即可通过固定用户名免密码连接对应服务器</p>
<pre><code>ssh dev
</code></pre>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2018-01-26T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[supervisor进程守护]]></title>
        <id>https://critas.wang/posts/supervisor%E8%BF%9B%E7%A8%8B%E5%AE%88%E6%8A%A4/</id>
        <link href="https://critas.wang/posts/supervisor%E8%BF%9B%E7%A8%8B%E5%AE%88%E6%8A%A4/"/>
        <updated>2018-01-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Supervisor 进程守护工具的安装、配置与使用，涵盖 CentOS 6/7 自启动配置及 Nginx、Redis、MongoDB 等服务的管理。]]></summary>
        <content type="html"><![CDATA[<blockquote>
<p>1、安装与启动</p>
</blockquote>
<ul>
<li>yum 安装</li>
</ul>
<pre><code>yum install supervisor
</code></pre>
<ul>
<li>easy_install 安装</li>
</ul>
<pre><code>wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

easy_install supervisor
</code></pre>
<ul>
<li>配置supervisor</li>
</ul>
<p>在etc下创建目录，并赋权限</p>
<pre><code>mkdir -m 700 -p /etc/supervisor
</code></pre>
<p>在目录" /etc/supervisor"下创建配置文件</p>
<pre><code>echo_supervisord_conf &gt; /etc/supervisor/supervisord.conf
</code></pre>
<p>修改配置文件</p>
<pre><code>vi /etc/supervisor/supervisord.conf
</code></pre>
<p>在文件末尾添加，注意首尾需无空格，需顶格</p>
<pre><code>[include]
files = /root/supervisorConf/*.conf
</code></pre>
<p>在目录"/etc/supervisor"下创建dotnet core 进程配置文件存放目录"conf.d"</p>
<pre><code>mkdir -m 700 /root/supervisorConf
</code></pre>
<p>如果需要在web控制台管理,则找到以下代码</p>
<pre><code>;[inet_http_server]         ; inet (TCP) server disabled by default
;port=127.0.0.1:9001        ; (ip_address:port specifier, *:port for all iface)
;username=user              ; (default is no username (open server))
;password=123               ; (default is no password (open server))
</code></pre>
<p>修改代码，删除前面的分号，port改为*:9001</p>
<pre><code>[inet_http_server]         ; inet (TCP) server disabled by default
port=*:9001        ; ip_address:port specifier, *:port for all ifa
username=user              ; default is no username (open server)
password=123               ; default is no password (open server)
</code></pre>
<hr />
<ul>
<li>配置supervisor自动启动</li>
</ul>
<h2>centos6</h2>
<p>设定supervisor启动文件</p>
<pre><code>vi /etc/init.d/supervisord
</code></pre>
<p>粘贴以下内容</p>
<pre><code>#! /usr/bin/env bash
# chkconfig: - 85 15

PATH=/sbin:/bin:/usr/sbin:/usr/bin

PROGNAME=supervisord

DAEMON=/usr/bin/$PROGNAME

CONFIG=/etc/supervisor/$PROGNAME.conf

PIDFILE=/tmp/$PROGNAME.pid

DESC="supervisord daemon"

SCRIPTNAME=/etc/init.d/$PROGNAME

# Gracefully exit if the package has been removed.

test -x $DAEMON || exit 0


start()

{

echo -n "Starting $DESC: $PROGNAME"

$DAEMON -c $CONFIG

echo ".............start success"

}

stop()

{

echo "Stopping $DESC: $PROGNAME"

if [ -f "$PIDFILE" ];
then
supervisor_pid=$(cat $PIDFILE)
kill -15 $supervisor_pid
echo "......"
echo "stop success"
else
echo "$DESC: $PROGNAME is not Runing"
echo ".........................stop sucess"
fi
}

status()

{ statusport=`netstat -lntp|grep 9001|awk -F ' ' '{print $4}'|awk -F ':' '{print $2}'`

if [ -f "$PIDFILE" ];
then
supervisor_pid=$(cat $PIDFILE)
echo "$DESC: $PROGNAME is Runing pid=$supervisor_pid"
else
echo "$DESC: $PROGNAME is not Runing"
echo "please use command /etc/init.d/supervisord start Run the service"
fi
}

case "$1" in

start)

start

;;

stop)

stop

;;

restart)

stop

start

;;

status)

status

;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart}" &gt;&amp;2

exit 1

;;

esac

exit 0
</code></pre>
<p>添加自启动服务</p>
<pre><code>chkconfig supervisord  on
</code></pre>
<p>启动服务</p>
<pre><code>service supervisord start
</code></pre>
<p>停止服务</p>
<pre><code>service supervisord stop
</code></pre>
<h2>centos7</h2>
<p>创建supervisor 自启动服务</p>
<pre><code>vi /etc/systemd/system/supervisor.service
</code></pre>
<p>编辑内容：</p>
<pre><code>[Unit]
Description=supervisor

[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
</code></pre>
<p>使配置生效</p>
<pre><code>systemctl daemon-reload
</code></pre>
<p>设置服务开机启动，即设置enable</p>
<pre><code>systemctl enable supervisor.service
</code></pre>
<p>启动服务</p>
<pre><code>systemctl start supervisor.service
</code></pre>
<blockquote>
<p>2、参考配置</p>
</blockquote>
<ul>
<li>
<p>/etc/supervisor/supervisord.conf</p>
<p>在文件最后添加</p>
</li>
</ul>
<pre><code>[include]
files = /root/supervisorConf/*.conf
</code></pre>
<ul>
<li>/etc/supervisor/mongo.conf</li>
</ul>
<pre><code>[program:mongo]
command=/home/mongodb/mongodb-linux/bin/mongod --dbpath /home/mongodb/mongodb-linux/data
stderr_logfile=/var/log/mongo.error.log
stdout_logfile=/var/log/mongo.stdout.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
stopsignal=INT
autostart=true
autorestart=true
redirect_stderr=true
startsecs=3
</code></pre>
<ul>
<li>/etc/supervisor/mysql.conf</li>
</ul>
<pre><code>[program:mysql]
command=/usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3306/my.cnf
stderr_logfile=/var/log/mongo.error.log
stdout_logfile=/var/log/mongo.stdout.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
stopsignal=INT
autostart=true
autorestart=true
redirect_stderr=true
startsecs=3
</code></pre>
<p>supervisor 监控的进程必须以非daemon 方式运行</p>
<p>如Nginx要用supervisor 管理需要在配置文件增加一行</p>
<ul>
<li>/opt/nginx/conf/nginx.conf</li>
</ul>
<pre><code>daemon off;
</code></pre>
<ul>
<li>/etc/supervisor/nginx.conf</li>
</ul>
<pre><code>[program:nginx]
command=/usr/local/nginx/sbin/nginx
directory=/usr/local/nginx
stderr_logfile=/var/log/nginx.error.log
stdout_logfile=/var/log/nginx.stdout.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
stopsignal=INT
autostart=true
autorestart=true
redirect_stderr=true
startsecs=3
</code></pre>
<ul>
<li>/etc/supervisor/redis.conf</li>
</ul>
<pre><code>[program:redis]
command=/usr/local/bin/redis-server /opt/redis/redis.conf
stderr_logfile=/var/log/Redis.error.log
stdout_logfile=/var/log/Redis.stdout.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
stopsignal=INT
autostart=true
autorestart=true
redirect_stderr=true
startsecs=3
</code></pre>
<blockquote>
<p>3、其他</p>
</blockquote>
<p>更新新的配置到supervisord：</p>
<pre><code>supervisorctl update
</code></pre>
<p>更新新的配置到supervisord</p>
<pre><code>supervisorctl update
</code></pre>
<p>重新启动配置中的所有程序</p>
<pre><code>supervisorctl reload
</code></pre>
<p>启动某个进程(program_name=你配置中写的程序名称)</p>
<pre><code>supervisorctl start program_name
</code></pre>
<p>查看正在守候的进程</p>
<pre><code>supervisorctl
</code></pre>
<p>停止某一进程 (program_name=你配置中写的程序名称)</p>
<pre><code>pervisorctl stop program_name
</code></pre>
<p>重启某一进程 (program_name=你配置中写的程序名称)</p>
<pre><code>supervisorctl restart program_name
</code></pre>
<p>停止全部进程</p>
<pre><code>supervisorctl stop all
</code></pre>
]]></content>
        <author>
            <name>Critas</name>
            <uri>https://critas.wang/</uri>
        </author>
        <published>2018-01-26T00:00:00.000Z</published>
    </entry>
</feed>