mongdb单机开启副本集

2021-08-09  本文已影响0人  酱油诗人077

非常感谢!参考: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>

上一篇 下一篇

猜你喜欢

热点阅读