美文网首页
mongdb单机开启副本集

mongdb单机开启副本集

作者: 酱油诗人077 | 来源:发表于2021-08-09 19:02 被阅读0次

    非常感谢!参考:mongo 单机开启副本集事务

    补充两点:

    1.  4.2以后的版本开启副本集需要加入security.keyFile!

    2.  在4.4版本测试可以动态的生成集合

    1.  security.keyFile官方文档:

    security.keyFile

    The path to a key file that stores the shared secret that MongoDB instances use to authenticate to each other in a sharded cluster or replica set. keyFile implies security.authorization. See Internal/Membership Authentication for more information.

    Starting in MongoDB 4.2, keyfiles for internal membership authentication use YAML format to allow for multiple keys in a keyfile. The YAML format accepts content of:

    生成key文件:

    openssl rand -base64 756 > <path-to-keyfile>

    chmod 400 <path-to-keyfile>

    配置文件:

    security:

    keyFile:<path-to-keyfile>

    replication:

    replSetName:<replicaSetName>

    相关文章

      网友评论

          本文标题:mongdb单机开启副本集

          本文链接:https://www.haomeiwen.com/subject/fkttbltx.html