<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://note.simperator.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://note.simperator.com/feed.php">
        <title>天涯的知库 - it:database</title>
        <description>聚沙成塔</description>
        <link>https://note.simperator.com/</link>
        <image rdf:resource="https://note.simperator.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg" />
       <dc:date>2026-05-06T12:53:11+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://note.simperator.com/doku.php?id=it:database:mongodbreplication&amp;rev=1660281633&amp;do=diff"/>
                <rdf:li rdf:resource="https://note.simperator.com/doku.php?id=it:database:mongo_install&amp;rev=1767105545&amp;do=diff"/>
                <rdf:li rdf:resource="https://note.simperator.com/doku.php?id=it:database:start&amp;rev=1627286694&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://note.simperator.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg">
        <title>天涯的知库</title>
        <link>https://note.simperator.com/</link>
        <url>https://note.simperator.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://note.simperator.com/doku.php?id=it:database:mongodbreplication&amp;rev=1660281633&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-08-12T05:20:33+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>MongoDB 副本集</title>
        <link>https://note.simperator.com/doku.php?id=it:database:mongodbreplication&amp;rev=1660281633&amp;do=diff</link>
        <description>MongoDB 副本集

参考之前的笔记以及收集的文章 搭建副本

连接多副本
单版本的数据库连接通常为 &lt;span class=&quot;wss-nowiki-section&quot;&gt;mongodb://localhost:20271&lt;/span&gt;，而多副本的连接可以是 &lt;span class=&quot;wss-nowiki-section&quot;&gt;mongodb://localhost:20271,localhost:20272,localhost:20273?replicaSet=myRepl
&lt;/span&gt;
mongodb://user:password@serverwin,serverfin:33720/?replicaSet=stockdb&amp;readPreference=nearest&amp;wtimeoutMS=20000&lt;span class=&quot;wss-nowiki-section&quot;&gt;mongo --port 2717&lt;/span&gt;&lt;span class=&quot;wss-nowiki-section&quot;&gt;rs.status()&lt;/span&gt;&lt;span class=&quot;wss-nowiki-section&quot;&gt;rs.…</description>
    </item>
    <item rdf:about="https://note.simperator.com/doku.php?id=it:database:mongo_install&amp;rev=1767105545&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-12-30T14:39:05+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>MongoDB 架构</title>
        <link>https://note.simperator.com/doku.php?id=it:database:mongo_install&amp;rev=1767105545&amp;do=diff</link>
        <description>MongoDB 架构

安装 Mongodb@5.0 ubuntu mac OX

树莓派只能安装4.4版本
sudo systemctl restart mongod
安全

防止被黑客攻击 主要措施

	*  启动认证登录
	*  设定复杂密码
	*  修改端口
	*  限制内网访问

通过 MongoDB 自带的 bindip 参数在我的实践中并不管用，这里采用的是 Linux 自带的iptables 功能，限制允许访问 MongoDB 端口的IP地址：&lt;span class=&quot;wss-nowiki-section&quot;&gt;tar -czf /home/ubuntu/Backup/`date +%F`_mongo_all.tar.gz /home/ssd/mongodb&lt;/span&gt;&lt;span class=&quot;wss-nowiki-section&quot;&gt;tar -xzf /home/ubuntu/Backup/2021-07-17_mongo_all.tar.gz -C /&lt;/span&gt;…</description>
    </item>
    <item rdf:about="https://note.simperator.com/doku.php?id=it:database:start&amp;rev=1627286694&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-07-26T08:04:54+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title></title>
        <link>https://note.simperator.com/doku.php?id=it:database:start&amp;rev=1627286694&amp;do=diff</link>
        <description>database index</description>
    </item>
</rdf:RDF>
