MongoDB Replica Set Configuration Series III: Authentication method for Replica sets

Source: Internet
Author: User
Tags base64 file permissions pkill

1: Replica Set configuration reference this blog:

Http://www.cnblogs.com/xiaoit/p/4478951.html

2: Authentication of replica set

Suppose there are two machines that have been configured with a replica set (the crime of replica set is generally at least 3 machines, here only for demonstration use)

192.168.91.132

192.168.91.133

The general idea of a replica set is the user name, password, and keyfile file, KeyFile requires that each replica set service be loaded at startup and if the same file is required, then the user name, password
The KeyFile file must meet the criteria:
(1) A minimum of 6 characters, less than 1024 bytes
(2) When the certificate does not consider the blank characters in the file
(3) The contents of the KeyFile file connected to the replica set and MONGOs must be the same
(4) must be Base64 encoded, but cannot have an equal sign
(5) file permissions must be x00, that is, you cannot assign any permissions to group members and other members

Performed on 132

[email protected] ~]# OpenSSL rand-base64 >/root/software/mongodb/keyfiletest

Then the file SCP to 133 above

SCP  /root/software/mongodb/keyfile [email protected]:/root/software/mongodb/

Kill Mongod Process: Pkill-2 Mongod (can also db.shutdownserver (), but not pkill-9)

Restarting the Mongod process

./mongod--config/root/software/mongodb/mongo.conf--keyfile/root/software/mongodb/keyfile

  

Authentication OK. The user name password can then be created.

For details, please refer to here:

http://docs.mongodb.org/manual/reference/security/

MongoDB Replica Set Configuration Series III: Authentication method for Replica sets

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.