启用mongodb身份验证

时间:2016-02-08 05:28:20

标签: mongodb authentication

我安装了ubuntu 14.04 x64我唯一做的就是全新更新并安装mongodb和pritunl。这是我安装两者的方式

itemListLabel.text = listArray.joinWithSeparator("\n")

现在我想在mongodb 3.0.9上启用auth,因为我在这里使用了指南 https://medium.com/@matteocontrini/how-to-setup-auth-in-mongodb-3-0-properly-86b60aeef7e8#.a1nfxsy3a

创建第一个用户后我

 $ nano /etc/apt/sources.list.d/mongodb-org-3.0.list
deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse

$ nano /etc/apt/sources.list.d/pritunl.list
deb http://repo.pritunl.com/stable/apt trusty main

$ apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7F0CEB10
$ apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv CF8E292A
$ apt-get update
$ apt-get install pritunl mongodb-org
$ service pritunl start

我遇到了问题我无法从这里得到任何来自locahost的连接是我收到的错误

 security:
    authorization: enabled

或尝试连接到管理员

~# mongo pritunl --port 27017 -u admin -p passwordhere --authe                                                                                            nticationDatabase admin
MongoDB shell version: 3.0.9
connecting to: 127.0.0.1:27017/pritunl
2016-02-08T00:18:54.096-0500 W NETWORK  Failed to connect to 127.0.0.1:27017, re                                                                                            ason: errno:111 Connection refused
2016-02-08T00:18:54.098-0500 E QUERY    Error: couldn't connect to server 127.0.                                                                                            0.1:27017 (127.0.0.1), connection attempt failed
    at connect (src/mongo/shell/mongo.js:181:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed

或者我尝试建立连接的任何其他方式。我觉得我错过了一些简单的事情。我想也许我搞砸了用户创建,所以我尝试使用http://3t.io/mongochef/ gui从用户创建中获取潜在的输入错误。

我已经和它斗争了几天,并且谷歌出来但没有得到牵引力。在这一点上,我将支付一些帮助,以弄清楚我搞砸了什么,但我想知道如何解决它,所以我知道如何实现基本的安全性。我可以用比特币支付

 ~# mongo admin — port 27017 -u admin -p password — authenticationDatabase admin
    MongoDB shell version: 3.0.9
    connecting to: 127.0.0.1:27017/admin
    2016–02–07T09:54:09.436–0500 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
    2016–02–07T09:54:09.438–0500 E QUERY Error: couldn’t connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
     at connect (src/mongo/shell/mongo.js:181:14)
     at (connect):1:6 at src/mongo/shell/mongo.js:181
    exception: connect failed

0 个答案:

没有答案
相关问题