Reference: http://docs.mongodb.org/manual/tutorial/generate-key-file/
Generate a Key File
Overview
This section describes the generate a key file to store authentication information. After generating a key file, specify the key file using the-keyfile option when starting a mongod or MONGOs instance.
A key ' s length must be between 6 and 1024x768 characters and may only contain characters in the Base64 set. The key file must not has group or world permissions on UNIX systems. Key file permissions is not checked on Windows systems.
1, Create a key file.
Create The key file your deployment would use the Authenticate servers.
To generate pseudo-random data to use for a keyfile, issue the following OpenSSL command:
OpenSSL rand-base64 741 > Mongodb-keyfile
chmod mongodb-keyfile
Chown Mongod.mongod Mongodb-keyfile
Generate a key file using any method, you choose. Always ensure, the password stored in the key file is both long and contains a high amount of entropy. Using OpenSSL in this manner helps generate such a key.
2, specify the key file when starting a MongoDB instance.
Specify the path to the key file with the KeyFile option.
This article is from the "Legendary Library sub" blog, please be sure to keep this source http://chason.blog.51cto.com/9078447/1601398
MongoDB Key file generation