<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Yi 的博客</title>
        <link>https://shishiyi.cc/</link>
        <description>盈盈秋水,淡淡春山</description>
        <lastBuildDate>Thu, 19 Feb 2026 00:37:31 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2026, 十十乙</copyright>
        <item>
            <title><![CDATA[Doris数据库之使用记录]]></title>
            <link>https://shishiyi.cc/article/2ba05292-33af-80e5-ae06-c23517d9c59e</link>
            <guid>https://shishiyi.cc/article/2ba05292-33af-80e5-ae06-c23517d9c59e</guid>
            <pubDate>Mon, 26 Jan 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-2ba0529233af80e5ae06c23517d9c59e"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-2ba0529233af802081f3c36f48dcedda"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">记录一些关于Doris数据库的使用</div></div><div class="notion-blank notion-block-2ba0529233af805e84fcc4b7493d5f62"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-2ba0529233af8011a142f461f930a340" data-id="2ba0529233af8011a142f461f930a340"><span><div id="2ba0529233af8011a142f461f930a340" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2ba0529233af8011a142f461f930a340" title="📝 数据导入"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📝 数据导入</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-2ba0529233af802d88a8d75c8eccc775" data-id="2ba0529233af802d88a8d75c8eccc775"><span><div id="2ba0529233af802d88a8d75c8eccc775" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2ba0529233af802d88a8d75c8eccc775" title="Stream Load导入"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>Stream Load导入</b></span></span></h3><div class="notion-callout notion-gray_background_co notion-block-2ba0529233af80f88b11fd816a0682fd"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-2ba0529233af80b7b87ffe778e7255a7">在使用 Stream Load 时，需要通过 HTTP 协议发起导入作业给 FE 节点，FE 会以轮询方式，重定向（redirect）请求给一个 BE 节点以达到负载均衡的效果。也可以直接发送 HTTP 请求作业给指定的 BE 节点。在 Stream Load 中，Doris 会选定一个节点作为 Coordinator 节点。Coordinator 节点负责接受数据并分发数据到其他节点上。</div></div></div><blockquote class="notion-quote notion-block-2ba0529233af80109ffff73bd146ce08"><div> Stream Load 主要流程</div></blockquote><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2ba0529233af80278926c1ed723b25de"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A2fc8f1cc-6966-49b9-9737-70816adf201a%3Astream-load-d06478e3d3e26152f3c4c52b399af2e2.png?table=block&amp;id=2ba05292-33af-8027-8926-c1ed723b25de&amp;t=2ba05292-33af-8027-8926-c1ed723b25de" alt="notion image" loading="lazy" decoding="async"/></div></figure><ol start="1" class="notion-list notion-list-numbered notion-block-2ba0529233af8088b245d9071c2af3d2" style="list-style-type:decimal"><li>Client 向 FE 提交 Stream Load 导入作业请求</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-2ba0529233af80b7a351dcd0e58fef34" style="list-style-type:decimal"><li>FE 会轮询选择一台 BE 作为 Coordinator 节点，负责导入作业调度，然后返回给 Client 一个 HTTP 重定向</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-2ba0529233af80eaaddaf20448c042b6" style="list-style-type:decimal"><li>Client 连接 Coordinator BE 节点，提交导入请求</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-2ba0529233af80719d38e088394e4e91" style="list-style-type:decimal"><li>Coordinator BE 会分发数据给相应 BE 节点，导入完成后会返回导入结果给 Client</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-2ba0529233af80e29bd8e5042a0b2d19" style="list-style-type:decimal"><li>Client 也可以直接通过指定 BE 节点作为 Coordinator，直接分发导入作业</li></ol><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-2ba0529233af8031bbdcd7bb4a12cda3" data-id="2ba0529233af8031bbdcd7bb4a12cda3"><span><div id="2ba0529233af8031bbdcd7bb4a12cda3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2ba0529233af8031bbdcd7bb4a12cda3" title="Java（Spring）封装实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Java（Spring）封装实现</span></span></h4><details class="notion-toggle notion-block-2f40529233af806db129daa0275c520c"><summary><b>将对象转换为下划线命名的 Map</b></summary><div></div></details><details class="notion-toggle notion-block-2f40529233af80669d61f47c4a534686"><summary><b>DORIS Stream Load 工具类（JDK17）</b></summary><div></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-2f40529233af80f88f49f0aae331a156" data-id="2f40529233af80f88f49f0aae331a156"><span><div id="2f40529233af80f88f49f0aae331a156" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2f40529233af80f88f49f0aae331a156" title="🐒 Doris 异步批量分发器"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🐒 Doris 异步批量分发器</span></span></h2><div class="notion-callout notion-gray_background_co notion-block-2f40529233af80f89052f3de8784a723"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-2f40529233af8056b18ecf5a35589930">1. 接收任意表名、任意结构的 Map 数据。 </div><div class="notion-text notion-block-2f40529233af80b0913ec158aa5f3ceb">2. 内部通过内存队列缓冲。 </div><div class="notion-text notion-block-2f40529233af80ffac7ffb8bb3db4a90">3. 按照“表名”进行分组聚合。 </div><div class="notion-text notion-block-2f40529233af8061a71bf20d4903bf6e">4. 满足阈值（数量或时间）后，批量调用 Stream Load 入库。</div></div></div><details class="notion-toggle notion-block-2f40529233af808a8437f92245986050"><summary><b>分发器-核心代码实现</b></summary><div></div></details><details class="notion-toggle notion-block-2f40529233af80739631fd94d6a55d5b"><summary><b>RabbitMQ配置</b>(nacos)</summary><div></div></details><details class="notion-toggle notion-block-2f40529233af805ca956d3d566b87766"><summary><b>RabbitMQ-消费例子</b></summary><div><div class="notion-text notion-block-2f40529233af80d6a816db3a06a7cc3b">以下是处理sl651协议解析日志数据的例子</div></div></details><div class="notion-blank notion-block-2f40529233af803fbee0dfc46015c51e"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[启动Jar包的Shell脚本]]></title>
            <link>https://shishiyi.cc/article/5a9a8b61-f585-4dd1-8974-9967b7ab0518</link>
            <guid>https://shishiyi.cc/article/5a9a8b61-f585-4dd1-8974-9967b7ab0518</guid>
            <pubDate>Fri, 30 Aug 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[批量启动Jar包的Shell脚本]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-5a9a8b61f5854dd189749967b7ab0518"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-c063bd21bc284ba5a7d6b5fec22be39a"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="📢">📢</span></div><div class="notion-callout-text">背景：需要启动多个jar服务，且相关存在一定的启动顺序，同时启动会影响liquibase冲突造成数据库锁住</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-dfca0a54cd9e4537814c5d793436d3f2" data-id="dfca0a54cd9e4537814c5d793436d3f2"><span><div id="dfca0a54cd9e4537814c5d793436d3f2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#dfca0a54cd9e4537814c5d793436d3f2" title="✍️ 服务器环境"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">✍️ 服务器环境</span></span></h2><details class="notion-toggle notion-block-1e66b7a29b5349d7a2b4de31d3d85ca4"><summary>JDK安装目录</summary><div><blockquote class="notion-quote notion-block-9f9d78356f98456aa592b57345a5ecdd"><div><b>/data/jdk-11.0.22/bin</b></div></blockquote><div class="notion-blank notion-block-18b0dc04b7db40e49db0892a366b5fe5"> </div></div></details><details class="notion-toggle notion-block-1c4f5dec3adc493280f6925d06bbb7b8"><summary>Jar包存放目录</summary><div><blockquote class="notion-quote notion-block-c24b5e93e44e4dbeb07b4d9211d0a134"><div>根路径：<b>/data/fusion/kingbase8</b></div></blockquote><table class="notion-simple-table notion-block-2af61204fd7841dd9b81e4bf9254e2ba"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-73c906eb2e2e440a8b74d70d84422146"><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">存放目录</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">jar包名称</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">web端口</div></td></tr><tr class="notion-simple-table-row notion-block-c12f32bbe02a46239d56feaabe37cf1a"><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">/data/fusion/kingbase8</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">fusion-reservoir-matrix-start-kingbase8.jar</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">9601</div></td></tr><tr class="notion-simple-table-row notion-block-2e03404a0b1c41d49fe9e9c99549deef"><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">/data/fusion/kingbase8</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">fusion-reservoir-matrix-menu-record-kingbase8.jar</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">9602</div></td></tr><tr class="notion-simple-table-row notion-block-d084c717e7e64df0be70a2c0701376b6"><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">/data/fusion/kingbase8</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">fusion-reservoir-matrix-mid-message-kingbase8.jar</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">9603</div></td></tr><tr class="notion-simple-table-row notion-block-3e47483d90e448a99218b06d5c1ebf58"><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">/data/fusion/kingbase8</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">fusion-reservoir-matrix-protocol-message-kingbase8.jar</div></td><td class="" style="width:220.66666666666666px"><div class="notion-simple-table-cell">9604</div></td></tr></tbody></table></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-9ffc7bfc10114adf8eeed3c29a471ddb" data-id="9ffc7bfc10114adf8eeed3c29a471ddb"><span><div id="9ffc7bfc10114adf8eeed3c29a471ddb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9ffc7bfc10114adf8eeed3c29a471ddb" title="💯 shell脚本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">💯 shell脚本</span></span></h2></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[基于taosdump实现TDengine数据备份以及导入]]></title>
            <link>https://shishiyi.cc/article/1d305292-33af-80f7-9cf3-e39c14f018ba</link>
            <guid>https://shishiyi.cc/article/1d305292-33af-80f7-9cf3-e39c14f018ba</guid>
            <pubDate>Sat, 12 Apr 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[基于taosdump实现TDengine数据备份以及导入]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-1d30529233af80f79cf3e39c14f018ba"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-1d30529233af800b84cbf0f2f846847d"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">实现 Docker 部署的 TDengine 数据库的备份和迁移导入，满足每次备份路径唯一以及备份多个指定数据库的要求</div></div><div class="notion-text notion-block-1d30529233af80988abbe7a5e9b696f0">基于taosdump 命令实现</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1d30529233af804abe65d6fa6c0ade29" data-id="1d30529233af804abe65d6fa6c0ade29"><span><div id="1d30529233af804abe65d6fa6c0ade29" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af804abe65d6fa6c0ade29" title="1️⃣ 数据备份"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1️⃣ 数据备份</span></span></h2><div class="notion-callout notion-gray_background_co notion-block-1d30529233af8009be33d9680f0b53a7"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="👉">👉</span></div><div class="notion-callout-text"><div class="notion-text notion-block-1d30529233af80648dddd4f8be7e9b90"><b>备份脚本执行步骤：</b></div><ol start="1" class="notion-list notion-list-numbered notion-block-1d30529233af802081eae307f63baa36" style="list-style-type:decimal"><li><b>初始化默认值</b></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1d30529233af807ea049f2eea6b3098b" style="list-style-type:decimal"><li><b>解析命令行参数</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af807ea049f2eea6b3098b" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80079e62f1425db2bc76"><li>读取参数（<span class="notion-yellow_background">-c</span> 容器名称、<span class="notion-yellow_background">-u</span> 用户名、<span class="notion-yellow_background">-p</span> 密码、<span class="notion-yellow_background">-D</span> 数据库列表、<span class="notion-yellow_background">-b</span> 容器备份根目录、<span class="notion-yellow_background">-o</span> 宿主机备份根目录、<span class="notion-yellow_background">-r</span> 保留天数)。</li></ul></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1d30529233af800b89f9ff73a75164f2" style="list-style-type:decimal"><li><b>检查必要参数</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af800b89f9ff73a75164f2" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80fb83d0eb92650a478a"><li>确认 DATABASES 是否提供(通过 -D 或环境变量)。</li></ul></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-1d30529233af80689602ef59dae5a37c" style="list-style-type:decimal"><li><b>验证容器运行</b></li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-1d30529233af8004a4d9ed73a60c5054" style="list-style-type:decimal"><li><b>生成备份路径</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af8004a4d9ed73a60c5054" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80a9b736dc4ab1a3db21"><li>创建时间戳（格式 <span class="notion-yellow_background">YYYYMMDD_HHMMSS</span>）</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af804ba5f8f489ad624dd7"><li>设置容器内备份目录（如<span class="notion-yellow_background">/var/lib/taos/backup/backup_20250412_151622</span>）</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af804e8106fcdf7dd1228c"><li>设置宿主机备份文件路径（全量备份如<span class="notion-yellow_background">/data/tdengine_3/data/backup/backup_full_20250412_151622.tar.gz</span>）</li></ul></ol></ol><ol start="6" class="notion-list notion-list-numbered notion-block-1d30529233af80a09d82f4386375a223" style="list-style-type:decimal"><li><b>创建宿主机目录</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80a09d82f4386375a223" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80fcb477dd5cc3169e26"><li>在宿主机创建备份目录（如<span class="notion-yellow_background">/data/tdengine_3/data/backup/backup_20250412_151622</span>）</li></ul></ol></ol><ol start="7" class="notion-list notion-list-numbered notion-block-1d30529233af8052ab75c09c298c9a90" style="list-style-type:decimal"><li><b>创建容器内目录</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af8052ab75c09c298c9a90" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af8057893ce0c9a07f28f3"><li>在容器内创建备份目录并设置写权限（<span class="notion-yellow_background">chmod 777</span>）。</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af800783d8cc1cbaa99205"><li>验证目录存在并可访问</li></ul></ol></ol><ol start="8" class="notion-list notion-list-numbered notion-block-1d30529233af80cdab98d71bb74ea1b5" style="list-style-type:decimal"><li><b>执行 </b><span class="notion-default"><span class="notion-default_background"><b>taosdump</b></span></span><b> 备份</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80cdab98d71bb74ea1b5" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80f0994cde5c42c5d25f"><li>使用 <span class="notion-yellow_background">taosdump -o</span> 备份指定数据库到容器内目录</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80f48de3cbbf75c6adda"><li>通过管道（<span class="notion-yellow_background">echo &#x27;$PASSWORD&#x27; | ...</span>）传递密码</li></ul></ol></ol><ol start="9" class="notion-list notion-list-numbered notion-block-1d30529233af80939f52fc3766e53200" style="list-style-type:decimal"><li><b>清理临时文件</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80939f52fc3766e53200" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af8013ae88d60bdcc354d7"><li>删除容器内错误日志（<span class="notion-yellow_background">/tmp/taosdump_err.log</span>）</li></ul></ol></ol><ol start="10" class="notion-list notion-list-numbered notion-block-1d30529233af805c9daeca54ed7c52fb" style="list-style-type:decimal"><li><b>压缩备份目录</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af805c9daeca54ed7c52fb" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80eeac7ed38110c4b8c9"><li>将备份目录压缩为 <span class="notion-yellow_background">.tar.gz</span> 文件</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af804880a1d9064dc75391"><li>如果压缩成功：</li><ul class="notion-list notion-list-disc notion-block-1d30529233af804880a1d9064dc75391"><li>删除宿主机临时目录，打印删除结果（成功或警告）</li><li>删除容器内备份目录，打印删除结果（成功或警告）</li></ul></ul></ol></ol><ol start="11" class="notion-list notion-list-numbered notion-block-1d30529233af802f9196def7ada2db3e" style="list-style-type:decimal"><li><b>清理旧备份</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af802f9196def7ada2db3e" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af807b9b79e1e343566eac"><li>删除超过保留天数（如 5 天）的 <span class="notion-yellow_background">.tar.gz</span> 文件。</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af800aad15cc4c256636e7"><li>打印清理结果（成功或警告）</li></ul></ol></ol><ol start="12" class="notion-list notion-list-numbered notion-block-1d30529233af808ca1dcd8972e25c7e3" style="list-style-type:decimal"><li><b>输出完成信息</b></li></ol></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d30529233af806aaac8e2be2835e779" data-id="1d30529233af806aaac8e2be2835e779"><span><div id="1d30529233af806aaac8e2be2835e779" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af806aaac8e2be2835e779" title="🟣 Shell脚本内容"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🟣 Shell脚本内容</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d30529233af805d9ce7f528a9bea03d" data-id="1d30529233af805d9ce7f528a9bea03d"><span><div id="1d30529233af805d9ce7f528a9bea03d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af805d9ce7f528a9bea03d" title="🟣 使用方法"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🟣 使用方法</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-1d30529233af80dabf5bc9b164497995" style="list-style-type:decimal"><li>保存为 <span class="notion-yellow_background">backup_tdengine_docker.sh</span>。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1d30529233af8019919be7826ee739d3" style="list-style-type:decimal"><li>添加执行权限：<span class="notion-yellow_background">chmod +x backup_tdengine_docker.sh</span></li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1d30529233af80609ab1e06ec4c10b34" style="list-style-type:decimal"><li><b>使用默认值</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80609ab1e06ec4c10b34" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af806da94dcf5e8e58fc61"><li>备份<span class="notion-yellow_background">iot_reservoir_matrix</span>到 <span class="notion-yellow_background">/data/tdengine_3/data/backup/backup_YYYYMMDD_HHMMSS.tar.gz</span></li></ul></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-1d30529233af80178832d959831b543b" style="list-style-type:decimal"><li><b>指定数据库</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80178832d959831b543b" style="list-style-type:lower-alpha"></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-1d30529233af80878595c131cc527fd3" style="list-style-type:decimal"><li><b>多容器</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80878595c131cc527fd3" style="list-style-type:lower-alpha"></ol></ol><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d30529233af8061bb84f3e9d3006ef1" data-id="1d30529233af8061bb84f3e9d3006ef1"><span><div id="1d30529233af8061bb84f3e9d3006ef1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af8061bb84f3e9d3006ef1" title="🟣 关于多容器支持"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🟣 关于多容器支持</span></span></h3><div class="notion-text notion-block-1d30529233af8056af3ed2be769e34ee">脚本已通过 <span class="notion-yellow_background">-c</span> 参数很好地支持多容器，添加默认数据库后不会影响隔离性。可以进行以下进一步优化建议：
</div><ol start="1" class="notion-list notion-list-numbered notion-block-1d30529233af806182aefd458add3d0c" style="list-style-type:decimal"><li><b>独立脚本</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af806182aefd458add3d0c" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80f196e4db2b7f96e7b5"><li>为每个容器复制脚本，设置不同默认值：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80a0a70dd290c35b0ee5"><li>运行：</li></ul></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1d30529233af802b8dc4d22f9f72240a" style="list-style-type:decimal"><li><b>配置文件（可选）</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af802b8dc4d22f9f72240a" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af801a9be9f1bc058a452e"><li>创建 <span class="notion-yellow_background">tdengine_3.conf</span> 和 <span class="notion-yellow_background">tdengine_4.conf</span>：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af804b926bce6e95f3c549"><li>修改脚本支持：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af801ca848c2f0aafc229a"><li>运行：</li></ul></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1d30529233af8025865ac92bce394ced" style="list-style-type:decimal"><li><b>Cron 任务</b>：：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af8025865ac92bce394ced" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af807796d5f29cec3b2517"><li>为每个容器设置独立定时任务：</li></ul></ol></ol><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1d30529233af80f68ac3c0d4317f3fe2" data-id="1d30529233af80f68ac3c0d4317f3fe2"><span><div id="1d30529233af80f68ac3c0d4317f3fe2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af80f68ac3c0d4317f3fe2" title="2️⃣ 数据导入"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2️⃣ 数据导入</span></span></h2><div class="notion-callout notion-gray_background_co notion-block-1d30529233af801e8a2ce7883a12af32"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="👉">👉</span></div><div class="notion-callout-text"><div class="notion-text notion-block-1d30529233af80be9053f9a4dc014a8a"><b>导入脚本执行步骤：</b></div><ol start="1" class="notion-list notion-list-numbered notion-block-1d30529233af80ccbe89dde00e8c6718" style="list-style-type:decimal"><li><b>输出完成信息</b></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1d30529233af80b18300dfec8298646b" style="list-style-type:decimal"><li><b>清理临时目录</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80b18300dfec8298646b" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af808f8485d573c310f33d"><li>删除容器内错误日志（<span class="notion-yellow_background">/tmp/taosdump_err.log</span>）。</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af804899e8d8bdb1aad41d"><li>删除宿主机解压目录</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af807c8e85e4b9e88afafd"><li>删除容器内备份目录</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af8006963fff2adc461ac9"><li>对清理失败的情况打印警告</li></ul></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1d30529233af80e0b81ccaf84f4eb3e6" style="list-style-type:decimal"><li><b>执行 </b><span class="notion-default_background"><b>taosdump</b></span><b> 导入</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80e0b81ccaf84f4eb3e6" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af8065a17bda20356e0501"><li>使用 <span class="notion-yellow_background">taosdump-i</span> 从容器内备份路径导入数据</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80bb9c4fc2ef0d09cf7a"><li>通过管道（<span class="notion-yellow_background">echo‘$PASSWORD＇丨...</span>）传递密码</li></ul></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-1d30529233af80efb8ffc57448340e09" style="list-style-type:decimal"><li><b>创建容器内目录</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80efb8ffc57448340e09" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af8063a71ac93bda802a08"><li>在容器内创建备份目录并设置写权限（<span class="notion-yellow_background">chmod777</span>）</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af805fbe54d667c6179305"><li>验证目录存在并可访问</li></ul></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-1d30529233af8041862fff66c934083b" style="list-style-type:decimal"><li><b>解压备份文件</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af8041862fff66c934083b" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af802ebc09eb1d33762b26"><li>创建宿主机解压目录（如<span class="notion-yellow_background">/data/tdengine_3/data/backup/backup_20250412_151622</span>）</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80578714cfb9e984009e"><li><span class="notion-yellow_background">tar.gz</span> 文件解压到宿主机备份根目录</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80439f33f1cf6f2bf17c"><li>如果解压失败，清理临时目录并退出</li></ul></ol></ol><ol start="6" class="notion-list notion-list-numbered notion-block-1d30529233af80f181e7d339151928ea" style="list-style-type:decimal"><li><b>生成备份路径</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80f181e7d339151928ea" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80109258f8702b504018"><li>从备份文件名提取子路径（如 <span class="notion-yellow_background">backup_20250412_151622</span>）</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80a28390ef93b1bfd024"><li>计算容器内备份路径（如<span class="notion-yellow_background">/var/lib/taos/backup/backup_20250412_151622</span>）</li></ul></ol></ol><ol start="7" class="notion-list notion-list-numbered notion-block-1d30529233af80d0af95ca40244fc222" style="list-style-type:decimal"><li><b>验证容器运行</b></li></ol><ol start="8" class="notion-list notion-list-numbered notion-block-1d30529233af80258f2ced281e045e25" style="list-style-type:decimal"><li><b>检查备份文件</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80258f2ced281e045e25" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af805dbe84f26a4a0ac696"><li>验证备份文件是否存在</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80ce9407d0f2b427f526"><li>确认文件为<span class="notion-yellow_background">·tar.gz</span> 格式</li></ul></ol></ol><ol start="9" class="notion-list notion-list-numbered notion-block-1d30529233af80449811d6a8a264cf50" style="list-style-type:decimal"><li><b>检查必要参数</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80449811d6a8a264cf50" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af8050837aebc92788d1ba"><li>确认<span class="notion-yellow_background">－i</span> 参数（备份文件）是否提供）。</li></ul></ol></ol><ol start="10" class="notion-list notion-list-numbered notion-block-1d30529233af8092bbc8dc9af9829723" style="list-style-type:decimal"><li><b>解析命令行参数</b></li><ol class="notion-list notion-list-numbered notion-block-1d30529233af8092bbc8dc9af9829723" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af800896b6f16fa51ebaf3"><li>读取参数（-c 容器名称、-u 用户名、-p 密码、-i 备份文件、-b 容器备份根目录、-o 宿主机备份根目录）</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af8007a1f4d235b16eeb58"><li>优先级：命令行&gt;环境变量&gt;默认值</li></ul></ol></ol><ol start="11" class="notion-list notion-list-numbered notion-block-1d30529233af80729c22d090ac235f38" style="list-style-type:decimal"><li><b>初始化默认值</b></li></ol></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d30529233af807fb4e0fbb37c72028f" data-id="1d30529233af807fb4e0fbb37c72028f"><span><div id="1d30529233af807fb4e0fbb37c72028f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af807fb4e0fbb37c72028f" title="🟣 Shell脚本内容"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🟣 Shell脚本内容</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d30529233af80e893e3e05c12f0d0b4" data-id="1d30529233af80e893e3e05c12f0d0b4"><span><div id="1d30529233af80e893e3e05c12f0d0b4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af80e893e3e05c12f0d0b4" title="🟣 使用方法"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🟣 <b>使用方法</b></span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-1d30529233af80c8bf46d414d827a3d5" style="list-style-type:decimal"><li>保存为 <span class="notion-yellow_background">restore_tdengine_docker.sh</span></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1d30529233af803088c6ec509cea687d" style="list-style-type:decimal"><li>添加执行权限：<span class="notion-yellow_background">chmod +x restore_tdengine_docker.sh</span></li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1d30529233af80838296d1e9bdebf3a2" style="list-style-type:decimal"><li>使用默认值</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80838296d1e9bdebf3a2" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80f3a382d0caddf184a2"><li>导入到容器 <span class="notion-yellow_background">tdengine_3</span></li></ul></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-1d30529233af80319402e1d6128d3e1a" style="list-style-type:decimal"><li><b>多容器</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80319402e1d6128d3e1a" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af809295baf52df99ca445"><li>容器 tdengine_3：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af804a9eddd00f9ce7aa36"><li>容器 tdengine_4：</li></ul></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-1d30529233af805f8a5ec8356b285df0" style="list-style-type:decimal"><li><b>覆盖用户名和密码</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af805f8a5ec8356b285df0" style="list-style-type:lower-alpha"></ol></ol><ol start="6" class="notion-list notion-list-numbered notion-block-1d30529233af809abe8ad6a0b8cb3035" style="list-style-type:decimal"><li><b>环境变量</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af809abe8ad6a0b8cb3035" style="list-style-type:lower-alpha"></ol></ol><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d30529233af802f92bbf90b5dddde85" data-id="1d30529233af802f92bbf90b5dddde85"><span><div id="1d30529233af802f92bbf90b5dddde85" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d30529233af802f92bbf90b5dddde85" title="🟣 多容器支持"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🟣 多容器支持</span></span></h3><div class="notion-text notion-block-1d30529233af809cb64dece48bf1d747">导入脚本通过 <span class="notion-yellow_background">-c</span> 参数支持多容器，与备份脚本一致。以下是建议：</div><ol start="1" class="notion-list notion-list-numbered notion-block-1d30529233af80919e69dabca16ac621" style="list-style-type:decimal"><li><b>独立脚本</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af80919e69dabca16ac621" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af80d28e08cc30a03db2f7"><li>为每个容器复制脚本，设置不同默认值：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af805380b9cc013c58678c"><li>运行：</li></ul></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1d30529233af803cbabdd070d08f94ec" style="list-style-type:decimal"><li><b>配置文件</b>：</li><ol class="notion-list notion-list-numbered notion-block-1d30529233af803cbabdd070d08f94ec" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1d30529233af8038907fea740f68f551"><li>创建 <span class="notion-yellow_background">tdengine_3.conf</span>：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af80799603cd58f21b96cd"><li>修改脚本支持：</li></ul><ul class="notion-list notion-list-disc notion-block-1d30529233af800c83e8e3d36e37eba9"><li>运行：</li></ul></ol></ol><div class="notion-blank notion-block-1d30529233af80d8bc6acce8cc876324"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CertBot申请证书]]></title>
            <link>https://shishiyi.cc/article/e38580e8-281a-440d-a537-f30c8c3f41fa</link>
            <guid>https://shishiyi.cc/article/e38580e8-281a-440d-a537-f30c8c3f41fa</guid>
            <pubDate>Mon, 07 Aug 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[申请HTTPS的证书]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-e38580e8281a440da537f30c8c3f41fa"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-06695747d64940e3b912abf8d12b4427"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🤧">🤧</span></div><div class="notion-callout-text">在使用<code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://letsencrypt.org/">let&#x27;s encrypt</a></code>获取免费的HTTPS证书的时候，<code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://letsencrypt.org/">let&#x27;s encrypt</a></code>需要对域名进行验证，以确保域名是你自己的。<div class="notion-text notion-block-7ef840830b7644eaa003108cd91c1c64"><code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://letsencrypt.org/">let&#x27;s encrypt</a></code>的免费证书有3个月的时间，到期前需要续期。
第一次使用certbot签证书时如果输入了邮箱地址，证书快到期前是会发邮件提醒你的。</div></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-50c76e2db8e64e68875b302192759aa0" data-id="50c76e2db8e64e68875b302192759aa0"><span><div id="50c76e2db8e64e68875b302192759aa0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#50c76e2db8e64e68875b302192759aa0" title="下载Certbot"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>下载Certbot</b></span></span></h2><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-af45f603f2df489c8f0737b42b9e13c1" data-id="af45f603f2df489c8f0737b42b9e13c1"><span><div id="af45f603f2df489c8f0737b42b9e13c1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#af45f603f2df489c8f0737b42b9e13c1" title="申请证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">申请证书</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-da1e199e6f9c40e9a8ceb0c30d35a08f" data-id="da1e199e6f9c40e9a8ceb0c30d35a08f"><span><div id="da1e199e6f9c40e9a8ceb0c30d35a08f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#da1e199e6f9c40e9a8ceb0c30d35a08f" title="签发证书（standalone）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>签发证书（standalone）</b></span></span></h3><div class="notion-text notion-block-432b3349b31e46ed8ce65ae44c5d97b1"><b>说明</b></div><ul class="notion-list notion-list-disc notion-block-28ccb2cd11b9447f9725e7de3bc054a3"><li>—config-dir</li><ul class="notion-list notion-list-disc notion-block-28ccb2cd11b9447f9725e7de3bc054a3"><div class="notion-text notion-block-450f1005e6644213a124464c0f62e639">证书生成的路径</div></ul></ul><ul class="notion-list notion-list-disc notion-block-271a384d1f6042f9b43a5dc3c225ef05"><li>-email</li><ul class="notion-list notion-list-disc notion-block-271a384d1f6042f9b43a5dc3c225ef05"><div class="notion-text notion-block-335a46457e704db591756b35be278e8a">通知的邮箱地址</div></ul></ul><ul class="notion-list notion-list-disc notion-block-2850036fa9274666a013d56623251d25"><li>-cert-name</li><ul class="notion-list notion-list-disc notion-block-2850036fa9274666a013d56623251d25"><div class="notion-text notion-block-354b2ecb0dd7422796f143e1b279251d">证书文件夹名称</div></ul></ul><ul class="notion-list notion-list-disc notion-block-6c4c11e042d2434398cd0806ec141a48"><li>-d</li><ul class="notion-list notion-list-disc notion-block-6c4c11e042d2434398cd0806ec141a48"><div class="notion-text notion-block-f81d45e98e194bbe897cc14665d106ab">要签的域名，<code class="notion-inline-code">-d</code>后面跟着一个域名，如果有多个域名要签的话记得每一个单独的域名前都要写<code class="notion-inline-code">-d</code>。certbot的泛域名其实只支持诸如<code class="notion-inline-code">*.example.com</code>，如要直接使用example.com，就得为其单独也签发一条</div></ul></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-036fb2b8e2e4414e8b6cbd57f67a0379" data-id="036fb2b8e2e4414e8b6cbd57f67a0379"><span><div id="036fb2b8e2e4414e8b6cbd57f67a0379" class="notion-header-anchor"></div><a class="notion-hash-link" href="#036fb2b8e2e4414e8b6cbd57f67a0379" title="泛域名DNS-TXT签发证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>泛域名DNS-TXT签发证书</b></span></span></h3><div class="notion-text notion-block-ffc46c7ba0184b0ab6e620a5d15775bd"><b>服务器不开通80/443端口，通过</b><code class="notion-inline-code"><b>DNS-TXT</b></code><b>的方式申请证书</b></div><div class="notion-text notion-block-d0ec400f73f74a6a9944c5092bf1b1f3"><b>说明</b></div><ul class="notion-list notion-list-disc notion-block-99a4542c03af4f2cb0f005516a40c12d"><li>-config-dir</li><ul class="notion-list notion-list-disc notion-block-99a4542c03af4f2cb0f005516a40c12d"><div class="notion-text notion-block-6d7462927f8c4b7bb3f7288e605b160a">证书生成的路径</div></ul></ul><ul class="notion-list notion-list-disc notion-block-a802d579c3b84eba8f53f87934a2bf81"><li>-email</li><ul class="notion-list notion-list-disc notion-block-a802d579c3b84eba8f53f87934a2bf81"><div class="notion-text notion-block-c6c7c1a900a24a068da46664ee1559e0">通知的邮箱地址</div></ul></ul><ul class="notion-list notion-list-disc notion-block-46b1792a7c4e446189487ae386f69011"><li>-cert-name</li><ul class="notion-list notion-list-disc notion-block-46b1792a7c4e446189487ae386f69011"><div class="notion-text notion-block-dfcb714694df4a639312fef5fb727d66">证书文件夹名称</div></ul></ul><ul class="notion-list notion-list-disc notion-block-809d4ee4f4654b8fa878c631952c2800"><li>-d</li><ul class="notion-list notion-list-disc notion-block-809d4ee4f4654b8fa878c631952c2800"><div class="notion-text notion-block-0fc5c23603254aff80f5db89750053a6">要签的域名，<code class="notion-inline-code">-d</code>后面跟着一个域名，如果有多个域名要签的话记得每一个单独的域名前都要写<code class="notion-inline-code">-d</code>。certbot的泛域名其实只支持诸如<code class="notion-inline-code">*.example.com</code>，如要直接使用example.com，就得为其单独也签发一条</div></ul></ul><ul class="notion-list notion-list-disc notion-block-c65f33d6eb1f4232a63c01671d79419e"><li>-manual</li><ul class="notion-list notion-list-disc notion-block-c65f33d6eb1f4232a63c01671d79419e"><div class="notion-text notion-block-01416ffe36844f42ae8835cf2df2a140">手动模式</div></ul></ul><div class="notion-text notion-block-388f4613453b49809bf3f3ba4e697e8e"><b>回车后，最后会要求在DNS控制界面增加一条TXT记录用于，域名验证</b></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-8b1adcddf67f4de696d71a0aaf1d62d4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fea4debf7-2028-4c1a-941b-a6890ba8cc86%2FUntitled.png?table=block&amp;id=8b1adcdd-f67f-4de6-96d7-1a0aaf1d62d4&amp;t=8b1adcdd-f67f-4de6-96d7-1a0aaf1d62d4&amp;width=792.984375&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2e6691b3a2b647148c98d19d0ee1bef2"><b>添加TXT示例如下</b></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ef881349d7ea4adaa6bc8d331cc3c2f4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffce46b89-f875-4d37-9fd5-be19966d0f0d%2FUntitled.png?table=block&amp;id=ef881349-d7ea-4ada-a6bc-8d331cc3c2f4&amp;t=ef881349-d7ea-4ada-a6bc-8d331cc3c2f4&amp;width=792.984375&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-e2f5f370e4ea47a0b1ba685814d98212">添加完记录保存之后，最好要<b>检查一下解析记录</b></div><blockquote class="notion-quote notion-block-5823c0ac36ef48a4b35b0d7fd38cd0db"><div>dig网址  https://toolbox.googleapps.com/apps/dig</div></blockquote><div class="notion-text notion-block-b1a10a270fc543fdb38e772349b26747">输入【主机记录】如出现的TXT值与<code class="notion-inline-code">certbot</code>提供的值相同，则表示添加记录成功</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-dde061ac6e634d02aeec9a70ea093573" data-id="dde061ac6e634d02aeec9a70ea093573"><span><div id="dde061ac6e634d02aeec9a70ea093573" class="notion-header-anchor"></div><a class="notion-hash-link" href="#dde061ac6e634d02aeec9a70ea093573" title="生成证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>生成证书</b></span></span></h3><div class="notion-text notion-block-e5c687ab67d64bb8bc8d6dc530b20e14">最后回车确认，证书便在<code class="notion-inline-code">/usr/local/nginx/cert/zhsk_fjwanfu_com/live</code>中，若没有指定路径，默认则在<code class="notion-inline-code">/etc/letsencrypt/live/{域名}</code> 下</div><div class="notion-text notion-block-8658bc655935460bab5940fb99aa8e3d">这个目录下一般会有四个文件：</div><table class="notion-simple-table notion-block-66961f39322a48dc98703583bddb3c15"><tbody><tr class="notion-simple-table-row notion-block-bcc9d5b90e824c2aa4f1981ebc5a3884"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>文件</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>描述</b></div></td></tr><tr class="notion-simple-table-row notion-block-ce5a9d664ed4432d9633c9fb175674b6"><td class="" style="width:120px"><div class="notion-simple-table-cell">cert.pem</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">服务器证书</div></td></tr><tr class="notion-simple-table-row notion-block-988fc9ac3f094c459a770ce2909c100b"><td class="" style="width:120px"><div class="notion-simple-table-cell">chain.pem</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">包含Web浏览器为验证服务器而需要的证书或附加中间证书</div></td></tr><tr class="notion-simple-table-row notion-block-01ed2d0033fc4ada85531fde3119d385"><td class="" style="width:120px"><div class="notion-simple-table-cell">fullchain.pem</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">cert.pem+chain.pem</div></td></tr><tr class="notion-simple-table-row notion-block-4d6047459bfb4988bf36f85cf9c4b05a"><td class="" style="width:120px"><div class="notion-simple-table-cell">privkey.pem</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">证书的私钥</div></td></tr></tbody></table><div class="notion-text notion-block-ba4bdf4aa9ac434692c22da0a194ff39">一般用<code class="notion-inline-code">fullchain.pem</code>和<code class="notion-inline-code">privkey.pem</code>就可以了</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-d830e17313294250ab5bb9a3a6c57bd1" data-id="d830e17313294250ab5bb9a3a6c57bd1"><span><div id="d830e17313294250ab5bb9a3a6c57bd1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d830e17313294250ab5bb9a3a6c57bd1" title="Nginx配置使用证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>Nginx配置使用证书</b></span></span></h2><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-68ec2f44ea304d8caed867b50a7c02af" data-id="68ec2f44ea304d8caed867b50a7c02af"><span><div id="68ec2f44ea304d8caed867b50a7c02af" class="notion-header-anchor"></div><a class="notion-hash-link" href="#68ec2f44ea304d8caed867b50a7c02af" title="自动续签证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>自动续签证书</b></span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-c1555fc1497d49089546679c740029d9" data-id="c1555fc1497d49089546679c740029d9"><span><div id="c1555fc1497d49089546679c740029d9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c1555fc1497d49089546679c740029d9" title="签发证书（standalone）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>签发证书（standalone）</b></span></span></h3><div class="notion-text notion-block-a490a26fbf9344d49c965ec2e5cbfd10">使用下面的命令续期</div><div class="notion-text notion-block-0bc28ea9764f49c1ac51e242cfe9f76c">设置自动续期的话，只需要写脚本放在Cron中定时运行即可，<code class="notion-inline-code">crontab -e</code>打开crontab脚本，添加如下的脚本</div><div class="notion-text notion-block-004006fe304d42e1b3cac1375dc46c86">这个脚本表示每隔 7 天，夜里 3 点整自动执行检查续期命令一次。续期完成后，重启 nginx 服务</div><div class="notion-blank notion-block-3714760e79094f608c36ec3b2eb8e743"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-24057eb2de5244a59435bf42ebd0223c" data-id="24057eb2de5244a59435bf42ebd0223c"><span><div id="24057eb2de5244a59435bf42ebd0223c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#24057eb2de5244a59435bf42ebd0223c" title="泛域名DNS-TXT签发证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>泛域名DNS-TXT签发证书</b></span></span></h3><div class="notion-text notion-block-7a593eb2bba242d4ab48d4c707e2e844">虽然 certbot 提供了自动续期命令，但是当我们把自动续期命令配置为定时任务时，我们无法手动添加新的 TXT 记录用于 certbot 验证。</div><div class="notion-text notion-block-158363519b4e4e9a95f3e6e3a4aac09d">好在 certbot 提供了一个 hook，可以编写一个 Shell 脚本。在续期的时候让脚本调用 DNS 服务商的 API 接口动态添加 TXT 记录，验证完成后再删除此记录</div><div class="notion-text notion-block-add4c9798fa34f6cad87ef273b065a6b">这里以阿里云为例</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-e2a35c5ee24044d9ae2cd3e940bb43fc" data-id="e2a35c5ee24044d9ae2cd3e940bb43fc"><span><div id="e2a35c5ee24044d9ae2cd3e940bb43fc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e2a35c5ee24044d9ae2cd3e940bb43fc" title="安装 aliyun cli 工具"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>安装 aliyun cli 工具</b></span></span></h4><div class="notion-text notion-block-2dd8781bb2814bf29d4113892ce64d1d">设置<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://help.aliyun.com/document_detail/110341.html">凭证信息</a></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-4c89baa05f22439a99dec8a68c36b1e2" data-id="4c89baa05f22439a99dec8a68c36b1e2"><span><div id="4c89baa05f22439a99dec8a68c36b1e2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4c89baa05f22439a99dec8a68c36b1e2" title="安装 certbot-dns-aliyun 插件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>安装 certbot-dns-aliyun 插件</b></span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-38d4f1a941b24d18bf2e2762bf548f48" data-id="38d4f1a941b24d18bf2e2762bf548f48"><span><div id="38d4f1a941b24d18bf2e2762bf548f48" class="notion-header-anchor"></div><a class="notion-hash-link" href="#38d4f1a941b24d18bf2e2762bf548f48" title="申请证书"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>申请证书</b></span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-ee7258c4463a485da7f2022bf0961894" style="list-style-type:decimal"><li>测试是否能正确申请：</li><ol class="notion-list notion-list-numbered notion-block-ee7258c4463a485da7f2022bf0961894" style="list-style-type:lower-alpha"><div class="notion-text notion-block-c26eb8abe59341ffbd5c6dc1d432dc15">正式申请时去掉 <code class="notion-inline-code">--dry-run</code> 参数：</div></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-934e990b45d2484980b7696ee1cb1e33" style="list-style-type:decimal"><li>证书续期</li><ol class="notion-list notion-list-numbered notion-block-934e990b45d2484980b7696ee1cb1e33" style="list-style-type:lower-alpha"><div class="notion-text notion-block-b43bb3c4452642fc982b26a319dff381">如果以上命令没有错误，把 <code class="notion-inline-code">--dry-run</code> 参数去掉。</div></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-0d1e6b1688114ec8922e3091c9941a6f" style="list-style-type:decimal"><li>自动续期</li><ol class="notion-list notion-list-numbered notion-block-0d1e6b1688114ec8922e3091c9941a6f" style="list-style-type:lower-alpha"><div class="notion-text notion-block-9a852163ca8b4fe9bca51f3f240d85d6">添加定时任务 crontab。</div><div class="notion-text notion-block-d0ca166bdb144eb6b94fa7524184ef8a">输入</div><div class="notion-text notion-block-008e7f9f89a143469720f4906ba117ae">这是每个月1号3点29分执行一次强制证书更新后重启nginx</div><div class="notion-text notion-block-d8a88a350bb748d89d028c83bbe31ac2">脚本中的 <code class="notion-inline-code">--deploy-hook &quot;nginx -s reload&quot;</code> 表示在续期成功后自动重启 nginx。</div><div class="notion-blank notion-block-195e9516566048188dbeaf4d60a25a0a"> </div></ol></ol></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[电影][中国台湾][阳光普照]]]></title>
            <link>https://shishiyi.cc/article/1b2da8b6-f9a9-48bb-a7df-5564a2ca9c72</link>
            <guid>https://shishiyi.cc/article/1b2da8b6-f9a9-48bb-a7df-5564a2ca9c72</guid>
            <pubDate>Fri, 20 Mar 2020 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-1b2da8b6f9a948bba7df5564a2ca9c72"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-11825aff09764cad9da3c164d6717c73" data-id="11825aff09764cad9da3c164d6717c73"><span><div id="11825aff09764cad9da3c164d6717c73" class="notion-header-anchor"></div><a class="notion-hash-link" href="#11825aff09764cad9da3c164d6717c73" title="📺 豆瓣评分"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📺 豆瓣评分</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-c0a207ee1bf7477a8e5303d031df12ee"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fbe23f5eb-2746-4139-b163-dae75ffc3a4b%2Fe5281dc7-bfb9-4fed-8a28-f6123815a11a%2FUntitled.png?table=block&amp;id=c0a207ee-1bf7-477a-8e53-03d031df12ee&amp;t=c0a207ee-1bf7-477a-8e53-03d031df12ee&amp;width=711&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-gray_background_co notion-block-7cb0bddd888b41a9ac542f66e6eeb804"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🌵">🌵</span></div><div class="notion-callout-text">我的工作经常会遇到一些八婆 碎嘴的女人，
她们常常问我 “陈教练 你结婚了吗？有几个小孩啊？”
每次我都只回答“一个”
你知道我为什么说“一个”吗？
因为在我心里 我从来不承认有过阿和 但这些年，
不同的八婆，
不同的碎嘴女人 还是会问 “陈教练.... 你有几个小孩啊？”
我还是只回答：“一个”
因为我现在真的只有“一个”</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-fe2f643d15bb4a029c67c56a106728a8" data-id="fe2f643d15bb4a029c67c56a106728a8"><span><div id="fe2f643d15bb4a029c67c56a106728a8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fe2f643d15bb4a029c67c56a106728a8" title="🎞️ 影片片段"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🎞️ 影片片段</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-embed notion-block-3cabe9f0dc5d47f5b793dff931cbe312"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:320px"><iframe class="notion-asset-object-fit" src="https://player.bilibili.com/player.html?aid=799609584&amp;bvid=BV1ry4y187HD&amp;cid=306992173&amp;page=1&amp;spaceId=be23f5eb-2746-4139-b163-dae75ffc3a4b" title="iframe embed" frameBorder="0" allowfullscreen="" loading="lazy" scrolling="auto"></iframe></div></figure><div class="notion-blank notion-block-9338ae9fe2ad462695b80aa76959b109"> </div><div class="notion-blank notion-block-e2866e9ee92a462e999de071c77fa4ed"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[电影][中国大陆][邪不压正]]]></title>
            <link>https://shishiyi.cc/article/17debe06-72b3-42d7-ba53-2ad0f1b3ae1a</link>
            <guid>https://shishiyi.cc/article/17debe06-72b3-42d7-ba53-2ad0f1b3ae1a</guid>
            <pubDate>Fri, 20 Mar 2020 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-17debe0672b342d7ba532ad0f1b3ae1a"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-3a0e35c09e71424dbed70d4b54330559" data-id="3a0e35c09e71424dbed70d4b54330559"><span><div id="3a0e35c09e71424dbed70d4b54330559" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3a0e35c09e71424dbed70d4b54330559" title="📺 豆瓣评分"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📺 豆瓣评分</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-87b64ec7ae324d258f851871dac37397"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fbe23f5eb-2746-4139-b163-dae75ffc3a4b%2F6aeafabe-7498-490a-91e6-104afc9e4ed9%2FUntitled.png?table=block&amp;id=87b64ec7-ae32-4d25-8f85-1871dac37397&amp;t=87b64ec7-ae32-4d25-8f85-1871dac37397&amp;width=714&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-484ceb0c8c4a460ea6d81f46cfad962a" data-id="484ceb0c8c4a460ea6d81f46cfad962a"><span><div id="484ceb0c8c4a460ea6d81f46cfad962a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#484ceb0c8c4a460ea6d81f46cfad962a" title="🎬 影片截图"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🎬 影片截图</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-abee75bd9e7e46ecae906b12e1918451"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fbe23f5eb-2746-4139-b163-dae75ffc3a4b%2F2078ed24-0319-410f-8364-af3456351070%2FUntitled.jpeg?table=block&amp;id=abee75bd-9e7e-46ec-ae90-6b12e1918451&amp;t=abee75bd-9e7e-46ec-ae90-6b12e1918451&amp;width=1920&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>