After the Replica set is configured, you will not be able to sync after you have enabled the AUTH option, which steps should be missing from the authentication section.
Later found that the configuration is less keyfile, so it generates a.
KeyFile In fact there is nothing mysterious, as long as
- is a character in the Base64 character set,
- The length is between 6~1024,
- The whitespace characters are deleted by MongoDB,
- Each node is to use the same keyfile file ,
- The Linux environment needs to modify KeyFile permissions (chmod- mongodb-keyfile).
Since the example of the official MongoDB document is generated using OpenSSL, the Base64 encoded string can be misleading, keyfile must be generated using OpenSSL, be sure to use BASE64 encoding, which is actually not the case,
Can not be generated without OpenSSL, do not need Base64 encoding, as long as the length between 6~1024, Base64 character set character is OK, with your most convenient tool to complete one or casually enter some characters can be.
It's easy to see the official text (attached).
The Base64 character set is as follows:
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/
The modified configuration information is as follows:
1 replset = rs012true3270174 bind_ip = localhost 5true6 dbpath = e:\data\db7 logpath = e:\data\log\ Mongo.log8 keyfile = D:\mongodb\key
Reference:
1. Generate a Key file:http://docs.mongodb.org/manual/tutorial/generate-key-file/
2. OpenSSL download (Windows): http://www.openssl.org/related/binaries.html
MongoDB replica set configuration with user authentication