db-tutorial/pages/5e3c30/index.html

135 lines
56 KiB
HTML
Raw Permalink Normal View History

2024-10-09 07:22:24 +08:00
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>MongoDB 运维 | DB-TUTORIAL</title>
<meta name="generator" content="VuePress 1.9.9">
<link rel="icon" href="/db-tutorial/img/favicon.ico">
<script src="https://cdn.wwads.cn/js/makemoney.js" type="text/javascript"></script>
<meta name="description" content="☕ db-tutorial 是一个数据库教程。">
<meta name="keywords" content="vuepress,theme,blog,vdoing">
<meta name="theme-color" content="#11a8cd">
<meta name="wwads-cn-verify" content="mxqWx62nfQQ9ocT4e5DzISHzOWyF4s">
<link rel="preload" href="/db-tutorial/assets/css/0.styles.51390d19.css" as="style"><link rel="preload" href="/db-tutorial/assets/js/app.be3f2e92.js" as="script"><link rel="preload" href="/db-tutorial/assets/js/2.aded268b.js" as="script"><link rel="preload" href="/db-tutorial/assets/js/42.14a20b0f.js" as="script"><link rel="prefetch" href="/db-tutorial/assets/js/10.551ab278.js"><link rel="prefetch" href="/db-tutorial/assets/js/11.c049b6a2.js"><link rel="prefetch" href="/db-tutorial/assets/js/12.92d587d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/13.a7b35fa5.js"><link rel="prefetch" href="/db-tutorial/assets/js/14.9ec959b5.js"><link rel="prefetch" href="/db-tutorial/assets/js/15.e7943372.js"><link rel="prefetch" href="/db-tutorial/assets/js/16.c6ad7b26.js"><link rel="prefetch" href="/db-tutorial/assets/js/17.39500ebd.js"><link rel="prefetch" href="/db-tutorial/assets/js/18.29949979.js"><link rel="prefetch" href="/db-tutorial/assets/js/19.78f879b8.js"><link rel="prefetch" href="/db-tutorial/assets/js/20.3ce14df7.js"><link rel="prefetch" href="/db-tutorial/assets/js/21.9d311c7c.js"><link rel="prefetch" href="/db-tutorial/assets/js/22.90234550.js"><link rel="prefetch" href="/db-tutorial/assets/js/23.12cf9e2d.js"><link rel="prefetch" href="/db-tutorial/assets/js/24.5b436e46.js"><link rel="prefetch" href="/db-tutorial/assets/js/25.8f2dc7d9.js"><link rel="prefetch" href="/db-tutorial/assets/js/26.61665ff4.js"><link rel="prefetch" href="/db-tutorial/assets/js/27.dfc7cc88.js"><link rel="prefetch" href="/db-tutorial/assets/js/28.a6286a66.js"><link rel="prefetch" href="/db-tutorial/assets/js/29.bfa8c106.js"><link rel="prefetch" href="/db-tutorial/assets/js/3.82108019.js"><link rel="prefetch" href="/db-tutorial/assets/js/30.c93b7a2e.js"><link rel="prefetch" href="/db-tutorial/assets/js/31.d48aab81.js"><link rel="prefetch" href="/db-tutorial/assets/js/32.33f8bb7c.js"><link rel="prefetch" href="/db-tutorial/assets/js/33.eb3b622d.js"><link rel="prefetch" href="/db-tutorial/assets/js/34.1ba1a06c.js"><link rel="prefetch" href="/db-tutorial/assets/js/35.24e4fee8.js"><link rel="prefetch" href="/db-tutorial/assets/js/36.dc61504e.js"><link rel="prefetch" href="/db-tutorial/assets/js/37.f1c9c729.js"><link rel="prefetch" href="/db-tutorial/assets/js/38.5024023f.js"><link rel="prefetch" href="/db-tutorial/assets/js/39.30ed016e.js"><link rel="prefetch" href="/db-tutorial/assets/js/4.884deeca.js"><link rel="prefetch" href="/db-tutorial/assets/js/40.6a6327f0.js"><link rel="prefetch" href="/db-tutorial/assets/js/41.3767f4d8.js"><link rel="prefetch" href="/db-tutorial/assets/js/43.b059081c.js"><link rel="prefetch" href="/db-tutorial/assets/js/44.73f724d9.js"><link rel="prefetch" href="/db-tutorial/assets/js/45.68f2ab27.js"><link rel="prefetch" href="/db-tutorial/assets/js/46.aed8a61f.js"><link rel="prefetch" href="/db-tutorial/assets/js/47.3bbf2366.js"><link rel="prefetch" href="/db-tutorial/assets/js/48.81688356.js"><link rel="prefetch" href="/db-tutorial/assets/js/49.1d366c93.js"><link rel="prefetch" href="/db-tutorial/assets/js/5.42f2cdb7.js"><link rel="prefetch" href="/db-tutorial/assets/js/50.ee6f08b7.js"><link rel="prefetch" href="/db-tutorial/assets/js/51.47835d9d.js"><link rel="prefetch" href="/db-tutorial/assets/js/52.b0cab79c.js"><link rel="prefetch" href="/db-tutorial/assets/js/53.106440a2.js"><link rel="prefetch" href="/db-tutorial/assets/js/54.340ab690.js"><link rel="prefetch" href="/db-tutorial/assets/js/55.00623de9.js"><link rel="prefetch" href="/db-tutorial/assets/js/56.9f086601.js"><link rel="prefetch" href="/db-tutorial/assets/js/57.f5ad5f3f.js"><link rel="prefetch" href="/db-tutorial/assets/js/58.14827368.js"><link rel="prefetch" href="/db-tutorial/assets/js/59.c41f57d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/6.5a5b4e54.js"><link rel="prefetch" href="/db-tutorial/assets/js/60.314534c0.js"><link rel="prefetch" href="/db-tutorial/assets/js/61.1ea5e4b7.js"><link rel="prefetch" href="/db-tutorial/assets/js/62.8b52e8fc.js"><link rel="prefetch" href="/db-tutorial/assets/js/63.d2fa8325.js"><link rel="prefetc
<link rel="stylesheet" href="/db-tutorial/assets/css/0.styles.51390d19.css">
</head>
<body class="theme-mode-light">
<div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/db-tutorial/" class="home-link router-link-active"><img src="https://raw.githubusercontent.com/dunwu/images/master/common/dunwu-logo.png" alt="DB-TUTORIAL" class="logo"> <span class="site-name can-hide">DB-TUTORIAL</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/db-tutorial/12.数据库/01.数据库综合/" class="nav-link">数据库综合</a></div><div class="nav-item"><a href="/db-tutorial/12.数据库/02.数据库中间件/" class="nav-link">数据库中间件</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="关系型数据库" class="dropdown-title"><a href="/db-tutorial/12.数据库/03.关系型数据库/" class="link-title">关系型数据库</a> <span class="title" style="display:none;">关系型数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/01.综合/" class="nav-link">综合</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/02.Mysql/" class="nav-link">Mysql</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/99.其他/" class="nav-link">其他</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="文档数据库" class="dropdown-title"><!----> <span class="title" style="display:;">文档数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/04.文档数据库/01.MongoDB/" class="nav-link">MongoDB</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="KV数据库" class="dropdown-title"><!----> <span class="title" style="display:;">KV数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/05.KV数据库/01.Redis/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="搜索引擎数据库" class="dropdown-title"><!----> <span class="title" style="display:;">搜索引擎数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/01.Elasticsearch/" class="nav-link">Elasticsearch</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/02.Elastic/" class="nav-link">Elastic技术栈</a></li></ul></div></div> <a href="https://github.com/dunwu/db-tutorial" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/db-tutorial/12.数据库/01.数据库综合/" class="nav-link">数据库综合</a></div><div class="nav-item"><a href="/db-tutorial/12.数据库/02.数据库中间件/" class="nav-link">数据库中间件</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="关系型数据库" class="dropdown-title"><a href="/db-tutorial/12.数据库/03.关系型数据库/" class="link-title">关系型数据库</a> <span class="title" style="display:none;">关系型数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/01.综合/" class="nav-link">综合</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/02.Mysql/" class="nav-link">Mysql</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/99.其他/" class="nav-link">其他</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="文档数据库" class="dropdown-title"><!----> <span class="title" style="display:;">文档数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/04.文档数据库/01.MongoDB/" class="nav-link">MongoDB</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="KV数据库" class="dropdown-title"><!----> <span class="title" style="display:;">KV数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/05.KV数据库/01.Redis/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="搜索引擎数据库" class="dropdown-title"><!----> <span class="title" style="display:;">搜索引擎数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/01.Elasticsearch/" class="nav-link">Elasticsearch</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/02.Elastic/" class="nav-link">Elastic技术栈</a></li></ul></div></div> <a href="https://github.com/dunwu/db-tutorial" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库综合</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库中间件</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>关系型数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>文档数据库</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><section class="sidebar-group collapsable is-sub-group depth-1"><p class="sidebar-heading open"><span>MongoDB</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/db-tutorial/pages/3288f3/" class="sidebar-link">MongoDB 应用指南</a></li><li><a href="/db-tutorial/pages/7efbac/" class="sidebar-link">MongoDB 的 CRUD 操作</a></li><li><a href="/db-tutorial/pages/75daa5/" class="sidebar-link">MongoDB 的聚合操作</a></li><li><a href="/db-tutorial/pages/4574fe/" class="sidebar-link">MongoDB 事务</a></li><li><a href="/db-tutorial/pages/562f99/" class="sidebar-link">MongoDB 建模</a></li><li><a href="/db-tutorial/pages/88c7d3/" class="sidebar-link">MongoDB 建模示例</a></li><li><a href="/db-tutorial/pages/10c674/" class="sidebar-link">MongoDB 索引</a></li><li><a href="/db-tutorial/pages/505407/" class="sidebar-link">MongoDB 复制</a></li><li><a href="/db-tutorial/pages/ad08f5/" class="sidebar-link">MongoDB 分片</a></li><li><a href="/db-tutorial/pages/5e3c30/" aria-current="page" class="active sidebar-link">MongoDB 运维</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/5e3c30/#mongodb-安装" class="sidebar-link">MongoDB 安装</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#windows" class="sidebar-link">Windows</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#linux" class="sidebar-link">Linux</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#设置用户名、密码" class="sidebar-link">设置用户名、密码</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/5e3c30/#备份和恢复" class="sidebar-link">备份和恢复</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#数据备份" class="sidebar-link">数据备份</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#数据恢复" class="sidebar-link">数据恢复</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/5e3c30/#导入导出" class="sidebar-link">导入导出</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#导入操作" class="sidebar-link">导入操作</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/5e3c30/#导出操作" class="sidebar-link">导出操作</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/5e3c30/#参考资料" class="sidebar-link">参考资料</a></li></ul></li></ul></section></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-hea
</code></pre></div><p>4客户端连接 MongoDB</p> <p>可以在命令窗口中运行 mongo.exe 命令即可连接上 MongoDB</p> <p>5配置 MongoDB 服务</p> <h3 id="linux"><a href="#linux" class="header-anchor">#</a> Linux</h3> <p>1使用安装包安装</p> <p>安装前我们需要安装各个 Linux 平台依赖包。</p> <p><strong>Red Hat/CentOS</strong></p> <div class="language- extra-class"><pre class="language-text"><code>sudo yum install libcurl openssl
</code></pre></div><p><strong>Ubuntu 18.04 LTS (&quot;Bionic&quot;)/Debian 10 &quot;Buster&quot;</strong></p> <div class="language- extra-class"><pre class="language-text"><code>sudo apt-get install libcurl4 openssl
</code></pre></div><p><strong>Ubuntu 16.04 LTS (&quot;Xenial&quot;)/Debian 9 &quot;Stretch&quot;</strong></p> <div class="language- extra-class"><pre class="language-text"><code>sudo apt-get install libcurl3 openssl
</code></pre></div><p>2创建数据目录</p> <p>默认情况下 MongoDB 启动后会初始化以下两个目录:</p> <ul><li>数据存储目录:/var/lib/mongodb</li> <li>日志文件目录:/var/log/mongodb</li></ul> <p>我们在启动前可以先创建这两个目录并设置当前用户有读写权限:</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">sudo</span> <span class="token function">mkdir</span> <span class="token parameter variable">-p</span> /var/lib/mongo
<span class="token function">sudo</span> <span class="token function">mkdir</span> <span class="token parameter variable">-p</span> /var/log/mongodb
<span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">`</span><span class="token function">whoami</span><span class="token variable">`</span></span> /var/lib/mongo <span class="token comment"># 设置权限</span>
<span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">`</span><span class="token function">whoami</span><span class="token variable">`</span></span> /var/log/mongodb <span class="token comment"># 设置权限</span>
</code></pre></div><p>3运行 MongoDB 服务</p> <div class="language-shell extra-class"><pre class="language-shell"><code>mongod <span class="token parameter variable">--dbpath</span> /var/lib/mongo <span class="token parameter variable">--logpath</span> /var/log/mongodb/mongod.log <span class="token parameter variable">--fork</span>
</code></pre></div><p>打开 /var/log/mongodb/mongod.log 文件看到以下信息,说明启动成功。</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment"># tail -10f /var/log/mongodb/mongod.log</span>
<span class="token number">2020</span>-07-09T12:20:17.391+0800 I NETWORK <span class="token punctuation">[</span>listener<span class="token punctuation">]</span> Listening on /tmp/mongodb-27017.sock
<span class="token number">2020</span>-07-09T12:20:17.392+0800 I NETWORK <span class="token punctuation">[</span>listener<span class="token punctuation">]</span> Listening on <span class="token number">127.0</span>.0.1
<span class="token number">2020</span>-07-09T12:20:17.392+0800 I NETWORK <span class="token punctuation">[</span>listener<span class="token punctuation">]</span> waiting <span class="token keyword">for</span> connections on port <span class="token number">27017</span>
</code></pre></div><p>4客户端连接 MongoDB</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token builtin class-name">cd</span> /usr/local/mongodb4/bin
./mongo
</code></pre></div><blockquote><p><a href="https://github.com/dunwu/linux-tutorial/tree/master/codes/linux/soft" target="_blank" rel="noopener noreferrer">Linux 安装脚本<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <h3 id="设置用户名、密码"><a href="#设置用户名、密码" class="header-anchor">#</a> 设置用户名、密码</h3> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token operator">&gt;</span> use admin
switched to db admin
<span class="token operator">&gt;</span> db.createUser<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;user&quot;</span><span class="token builtin class-name">:</span><span class="token string">&quot;root&quot;</span>,<span class="token string">&quot;pwd&quot;</span><span class="token builtin class-name">:</span><span class="token string">&quot;root&quot;</span>,<span class="token string">&quot;roles&quot;</span>:<span class="token punctuation">[</span><span class="token punctuation">{</span><span class="token string">&quot;role&quot;</span><span class="token builtin class-name">:</span><span class="token string">&quot;userAdminAnyDatabase&quot;</span>,<span class="token string">&quot;db&quot;</span><span class="token builtin class-name">:</span><span class="token string">&quot;admin&quot;</span><span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
Successfully added user: <span class="token punctuation">{</span>
<span class="token string">&quot;user&quot;</span> <span class="token builtin class-name">:</span> <span class="token string">&quot;root&quot;</span>,
<span class="token string">&quot;roles&quot;</span> <span class="token builtin class-name">:</span> <span class="token punctuation">[</span>
<span class="token punctuation">{</span>
<span class="token string">&quot;role&quot;</span> <span class="token builtin class-name">:</span> <span class="token string">&quot;userAdminAnyDatabase&quot;</span>,
<span class="token string">&quot;db&quot;</span> <span class="token builtin class-name">:</span> <span class="token string">&quot;admin&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token operator">&gt;</span>
</code></pre></div><h2 id="备份和恢复"><a href="#备份和恢复" class="header-anchor">#</a> 备份和恢复</h2> <h3 id="数据备份"><a href="#数据备份" class="header-anchor">#</a> 数据备份</h3> <p>在 Mongodb 中,使用 <code>mongodump</code> 命令来备份 MongoDB 数据。该命令可以导出所有数据到指定目录中。</p> <p><code>mongodump</code> 命令可以通过参数指定导出的数据量级转存的服务器。</p> <p>mongodump 命令语法如下:</p> <div class="language- extra-class"><pre class="language-text"><code>mongodump -h dbhost -d dbname -o dbdirectory
</code></pre></div><ul><li><p>-hMongDB 所在服务器地址例如127.0.0.1当然也可以指定端口号127.0.0.1:27017</p></li> <li><p>-d需要备份的数据库实例例如test</p></li> <li><p>-o备份的数据存放位置例如c:\data\dump当然该目录需要提前建立在备份完成后系统自动在 dump 目录下建立一个 test 目录,这个目录里面存放该数据库实例的备份数据。</p></li></ul> <p><code>mongodump</code> 命令可选参数列表如下所示:</p> <table><thead><tr><th style="text-align:left;">语法</th> <th style="text-align:left;">描述</th> <th style="text-align:left;">实例</th></tr></thead> <tbody><tr><td style="text-align:left;">mongodump --host HOST_NAME --port PORT_NUMBER</td> <td style="text-align:left;">该命令将备份所有 MongoDB 数据</td> <td style="text-align:left;">mongodump --host runoob.com --port 27017</td></tr> <tr><td style="text-align:left;">mongodump --dbpath DB_PATH --out BACKUP_DIRECTORY</td> <td style="text-align:left;"></td> <td style="text-align:left;">mongodump --dbpath /data/db/ --out /data/backup/</td></tr> <tr><td style="text-align:left;">mongodump --collection COLLECTION --db DB_NAME</td> <td style="text-align:left;">该命令将备份指定数据库的集合。</td> <td style="text-align:left;">mongodump --collection mycol --db test</td></tr></tbody></table> <p>【示例】备份全量数据</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongodump <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-o</span> test2
<span class="token punctuation">..</span>.
<span class="token number">2020</span>-09-11T11:55:58.086+0800 <span class="token keyword">done</span> dumping test.company <span class="token punctuation">(</span><span class="token number">18801</span> documents<span class="token punctuation">)</span>
<span class="token number">2020</span>-09-11T11:56:00.725+0800 <span class="token punctuation">[</span><span class="token comment">#############...........] test.people 559101/1000000 (55.9%)</span>
<span class="token number">2020</span>-09-11T11:56:03.725+0800 <span class="token punctuation">[</span><span class="token comment">###################.....] test.people 829496/1000000 (82.9%)</span>
<span class="token number">2020</span>-09-11T11:56:06.725+0800 <span class="token punctuation">[</span><span class="token comment">#####################...] test.people 884614/1000000 (88.5%)</span>
<span class="token number">2020</span>-09-11T11:56:08.088+0800 <span class="token punctuation">[</span><span class="token comment">########################] test.people 1000000/1000000 (100.0%)</span>
<span class="token number">2020</span>-09-11T11:56:08.350+0800 <span class="token keyword">done</span> dumping test.people <span class="token punctuation">(</span><span class="token number">1000000</span> documents<span class="token punctuation">)</span>
</code></pre></div><p>【示例】备份指定数据库</p> <div class="language-shell extra-class"><pre class="language-shell"><code>mongodump <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> admin <span class="token parameter variable">-o</span> test3
</code></pre></div><h3 id="数据恢复"><a href="#数据恢复" class="header-anchor">#</a> 数据恢复</h3> <p>mongodb 使用 <code>mongorestore</code> 命令来恢复备份的数据。</p> <p><code>mongorestore</code> 命令语法如下:</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token operator">&gt;</span> mongorestore <span class="token parameter variable">-h</span> <span class="token operator">&lt;</span>hostname<span class="token operator">&gt;</span><span class="token operator">&lt;</span>:port<span class="token operator">&gt;</span> <span class="token parameter variable">-d</span> dbname <span class="token operator">&lt;</span>path<span class="token operator">&gt;</span>
</code></pre></div><ul><li><p><code>--host &lt;:port&gt;</code>, <code>-h &lt;:port&gt;</code>MongoDB 所在服务器地址,默认为: localhost:27017</p></li> <li><p><code>--db</code> , <code>-d</code> 需要恢复的数据库实例例如test当然这个名称也可以和备份时候的不一样比如 test2</p></li> <li><p><code>--drop</code>:恢复的时候,先删除当前数据,然后恢复备份的数据。就是说,恢复后,备份后添加修改的数据都会被删除,慎用哦!</p></li> <li><p><code>&lt;path&gt;</code>mongorestore 最后的一个参数设置备份数据所在位置例如c:\data\dump\test。你不能同时指定 <code>&lt;path&gt;</code><code>--dir</code> 选项,<code>--dir</code> 也可以设置备份目录。</p></li> <li><p><code>--dir</code>:指定备份的目录。你不能同时指定 <code>&lt;path&gt;</code><code>--dir</code> 选项。</p></li></ul> <p>【示例】</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongorestore <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">--dir</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">--drop</span>
<span class="token punctuation">..</span>.
<span class="token number">2020</span>-09-11T11:46:16.053+0800 finished restoring test.tweets <span class="token punctuation">(</span><span class="token number">966</span> documents, <span class="token number">0</span> failures<span class="token punctuation">)</span>
<span class="token number">2020</span>-09-11T11:46:18.256+0800 <span class="token punctuation">[</span><span class="token comment">###.....................] test.people 164MB/1.03GB (15.6%)</span>
<span class="token number">2020</span>-09-11T11:46:21.255+0800 <span class="token punctuation">[</span><span class="token comment">########................] test.people 364MB/1.03GB (34.6%)</span>
<span class="token number">2020</span>-09-11T11:46:24.256+0800 <span class="token punctuation">[</span><span class="token comment">############............] test.people 558MB/1.03GB (53.0%)</span>
<span class="token number">2020</span>-09-11T11:46:27.255+0800 <span class="token punctuation">[</span><span class="token comment">###############.........] test.people 700MB/1.03GB (66.5%)</span>
<span class="token number">2020</span>-09-11T11:46:30.257+0800 <span class="token punctuation">[</span><span class="token comment">###################.....] test.people 846MB/1.03GB (80.3%)</span>
<span class="token number">2020</span>-09-11T11:46:33.255+0800 <span class="token punctuation">[</span><span class="token comment">######################..] test.people 990MB/1.03GB (94.0%)</span>
<span class="token number">2020</span>-09-11T11:46:34.542+0800 <span class="token punctuation">[</span><span class="token comment">########################] test.people 1.03GB/1.03GB (100.0%)</span>
<span class="token number">2020</span>-09-11T11:46:34.543+0800 no indexes to restore
<span class="token number">2020</span>-09-11T11:46:34.543+0800 finished restoring test.people <span class="token punctuation">(</span><span class="token number">1000000</span> documents, <span class="token number">0</span> failures<span class="token punctuation">)</span>
<span class="token number">2020</span>-09-11T11:46:34.544+0800 <span class="token number">1000966</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> restored successfully. <span class="token number">0</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> failed to restore.
</code></pre></div><h2 id="导入导出"><a href="#导入导出" class="header-anchor">#</a> 导入导出</h2> <p><code>mongoimport</code><code>mongoexport</code> 并不能可靠地保存所有的富文本 BSON 数据类型,因为 JSON 仅能代表一种 BSON 支持的子集类型。因此,数据用这些工具导出导入或许会丢失一些精确程度。</p> <h3 id="导入操作"><a href="#导入操作" class="header-anchor">#</a> 导入操作</h3> <p>在 MongoDB 中,使用 <code>mongoimport</code> 来导入数据。 默认情况下,<code>mongoimport</code> 会将数据导入到本地主机端口 27017 上的 MongoDB 实例中。要将数据导入在其他主机或端口上运行的 MongoDB 实例中,请通过包含 <code>--host</code><code>--port</code> 选项来指定主机名或端口。 使用 <code>--drop</code> 选项删除集合(如果已经存在)。 这样可以确保该集合仅包含您要导入的数据。</p> <p>语法格式:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>mongoimport <span class="token parameter variable">-h</span> IP <span class="token parameter variable">--port</span> 端口 <span class="token parameter variable">-u</span> 用户名 <span class="token parameter variable">-p</span> 密码 <span class="token parameter variable">-d</span> 数据库 <span class="token parameter variable">-c</span> 表名 <span class="token parameter variable">--type</span> 类型 <span class="token parameter variable">--headerline</span> <span class="token parameter variable">--upsert</span> <span class="token parameter variable">--drop</span> 文件名
</code></pre></div><p>【示例】导入表数据</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoimport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> book <span class="token parameter variable">--drop</span> test/book.dat
<span class="token number">2020</span>-09-11T10:53:56.359+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T10:53:56.372+0800 dropping: test.book
<span class="token number">2020</span>-09-11T10:53:56.628+0800 <span class="token number">431</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> imported successfully. <span class="token number">0</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> failed to import.
</code></pre></div><p>【示例】从 json 文件中导入表数据</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoimport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> student <span class="token parameter variable">--upsert</span> test/student.json
<span class="token number">2020</span>-09-11T11:02:55.907+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T11:02:56.068+0800 <span class="token number">200</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> imported successfully. <span class="token number">0</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> failed to import.
</code></pre></div><p>【示例】从 csv 文件中导入表数据</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoimport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> product <span class="token parameter variable">--type</span> csv <span class="token parameter variable">--headerline</span> test/product.csv
<span class="token number">2020</span>-09-11T11:07:49.788+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T11:07:51.051+0800 <span class="token number">11</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> imported successfully. <span class="token number">0</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> failed to import.
</code></pre></div><p>【示例】导入部分表字段数据</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoimport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> product <span class="token parameter variable">--type</span> json <span class="token parameter variable">--upsertFields</span> name,price test/product.json
<span class="token number">2020</span>-09-11T11:14:05.410+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T11:14:05.612+0800 <span class="token number">11</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> imported successfully. <span class="token number">0</span> document<span class="token punctuation">(</span>s<span class="token punctuation">)</span> failed to import.
</code></pre></div><h3 id="导出操作"><a href="#导出操作" class="header-anchor">#</a> 导出操作</h3> <p>语法格式:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>mongoexport <span class="token parameter variable">-h</span> <span class="token operator">&lt;</span>IP<span class="token operator">&gt;</span> <span class="token parameter variable">--port</span> <span class="token operator">&lt;</span>端口<span class="token operator">&gt;</span> <span class="token parameter variable">-u</span> <span class="token operator">&lt;</span>用户名<span class="token operator">&gt;</span> <span class="token parameter variable">-p</span> <span class="token operator">&lt;</span>密码<span class="token operator">&gt;</span> <span class="token parameter variable">-d</span> <span class="token operator">&lt;</span>数据库<span class="token operator">&gt;</span> <span class="token parameter variable">-c</span> <span class="token operator">&lt;</span>表名<span class="token operator">&gt;</span> <span class="token parameter variable">-f</span> <span class="token operator">&lt;</span>字段<span class="token operator">&gt;</span> <span class="token parameter variable">-q</span> <span class="token operator">&lt;</span>条件导出<span class="token operator">&gt;</span> <span class="token parameter variable">--csv</span> <span class="token parameter variable">-o</span> <span class="token operator">&lt;</span>文件名<span class="token operator">&gt;</span>
</code></pre></div><ul><li><code>-f</code>:导出指字段,以逗号分割,<code>-f name,email,age</code> 导出 name,email,age 这三个字段</li> <li><code>-q</code>:可以根查询条件导出,<code>-q '{ &quot;uid&quot; : &quot;100&quot; }'</code> 导出 uid 为 100 的数据</li> <li><code>--csv</code>:表示导出的文件格式为 csv 的,这个比较有用,因为大部分的关系型数据库都是支持 csv在这里有共同点</li></ul> <p>【示例】导出整张表</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoexport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> product <span class="token parameter variable">-o</span> test/product.dat
<span class="token number">2020</span>-09-11T10:44:23.161+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T10:44:23.177+0800 exported <span class="token number">11</span> records
</code></pre></div><p>【示例】导出表到 json 文件</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoexport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> product <span class="token parameter variable">--type</span> json <span class="token parameter variable">-o</span> test/product.json
<span class="token number">2020</span>-09-11T10:49:52.735+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T10:49:52.750+0800 exported <span class="token number">11</span> records
</code></pre></div><p>【示例】导出表中部分字段到 csv 文件</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ mongoexport <span class="token parameter variable">-h</span> <span class="token number">127.0</span>.0.1 <span class="token parameter variable">--port</span> <span class="token number">27017</span> <span class="token parameter variable">-d</span> <span class="token builtin class-name">test</span> <span class="token parameter variable">-c</span> product <span class="token parameter variable">--type</span> csv <span class="token parameter variable">-f</span> name,price <span class="token parameter variable">-o</span> test/product.csv
<span class="token number">2020</span>-09-11T10:47:33.160+0800 connected to: mongodb://127.0.0.1:27017/
<span class="token number">2020</span>-09-11T10:47:33.176+0800 exported <span class="token number">11</span> records
</code></pre></div><h2 id="参考资料"><a href="#参考资料" class="header-anchor">#</a> 参考资料</h2> <ul><li><a href="https://www.mongodb.com/" target="_blank" rel="noopener noreferrer">MongoDB 官网<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/mongodb/mongo" target="_blank" rel="noopener noreferrer">MongoDB Github<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://university.mongodb.com/" target="_blank" rel="noopener noreferrer">MongoDB 官方免费教程<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://www.runoob.com/mongodb/mongodb-tutorial.html" target="_blank" rel="noopener noreferrer">MongoDB 教程<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <div class="page-edit"><div class="edit-link"><a href="https://github.com/dunwu/db-tutorial/edit/master/docs/12.数据库/04.文档数据库/01.MongoDB/20.MongoDB运维.md" target="_blank" rel="noopener noreferrer">📝 帮助改善此页面!</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="tags"><a href="/db-tutorial/tags/?tag=%E6%95%B0%E6%8D%AE%E5%BA%93" title="标签">#数据库</a><a href="/db-tutorial/tags/?tag=%E6%96%87%E6%A1%A3%E6%95%B0%E6%8D%AE%E5%BA%93" title="标签">#文档数据库</a><a href="/db-tutorial/tags/?tag=MongoDB" title="标签">#MongoDB</a><a href="/db-tutorial/tags/?tag=%E8%BF%90%E7%BB%B4" title="标签">#运维</a></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2024/10/09, 07:16:02</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/db-tutorial/pages/ad08f5/" class="page-nav-centre page-n
<a href="/db-tutorial/pages/ad08f5/" class="prev">MongoDB 分片</a></span> <span class="next"><a href="/db-tutorial/pages/451b73/">Redis 面试总结</a>
</span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/db-tutorial/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/db-tutorial/pages/b59ba2/"><div>
HBase Java API 管理功能
<!----></div></a> <span class="date">04-13</span></dt></dl><dl><dd>02</dd> <dt><a href="/db-tutorial/pages/ce5ca0/"><div>
HBase Java API 其他高级特性
<!----></div></a> <span class="date">03-31</span></dt></dl><dl><dd>03</dd> <dt><a href="/db-tutorial/pages/c8cfeb/"><div>
HBase 数据模型
<!----></div></a> <span class="date">03-16</span></dt></dl> <dl><dd></dd> <dt><a href="/db-tutorial/archives/" class="more">更多文章&gt;</a></dt></dl></div></div></main></div> <div class="footer"><div class="icons"><a href="mailto:forbreak@163.com" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://github.com/dunwu" title="GitHub" target="_blank" class="iconfont icon-github"></a></div>
Theme by
<a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a>
| Copyright © 2019-2024
<span>钝悟dunwu | CC-BY-SA-4.0</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
跟随系统
</li><li class="iconfont icon-rijianmoshi">
浅色模式
</li><li class="iconfont icon-yejianmoshi">
深色模式
</li><li class="iconfont icon-yuedu">
阅读模式
</li></ul></div></div> <!----> <!----> <div class="custom-html-window custom-html-window-rb" style="display:;"><div class="custom-wrapper"><span class="close-but">×</span> <div>
<div class="wwads-cn wwads-vertical windowRB" data-id="261" style="max-width:160px;
min-width: auto;min-height:auto;"></div>
<style>
.windowRB{ padding: 0;}
.windowRB .wwads-img{margin-top: 10px;}
.windowRB .wwads-content{margin: 0 10px 40px 10px;}
.custom-html-window-rb .close-but{
display: none;
}
</style>
</div></div></div></div><div class="global-ui"><div></div></div></div>
<script src="/db-tutorial/assets/js/app.be3f2e92.js" defer></script><script src="/db-tutorial/assets/js/2.aded268b.js" defer></script><script src="/db-tutorial/assets/js/42.14a20b0f.js" defer></script>
</body>
</html>