dpb42021
2013-04-25 23:40
浏览 63
已采纳

在Dreamhost VPS上配置MongoDB的问题

I have MongoDB up and running - I am able to sign into my VPS via SSH and execute the mongo command.

Here is where I run into a problem. Here are some test commands and their output:

[*******]$ mongo
MongoDB shell version: 1.4.4
url: test
connecting to: test
type "help" for help
> db
test
> db.test.save({a:1});
unauthorized

Here is another example of test input and its output:

[*******]$ mongo
MongoDB shell version: 1.4.4
url: test
connecting to: test
type "help" for help
> use admin
switched to db admin
> db.addUser( { user: "drew", pwd: "myPassword", roles: [ "userAdminAnyDatabase" ] } )
Thu Apr 25 16:34:37 JS Error: uncaught exception: error {
    "$err" : "unauthorized db:admin lock type:-1 client:127.0.0.1",
    "code" : 10057
}
unauthorized db:admin lock type:-1 client:127.0.0.1

So I'm a bit stuck - I don't know if this will help or not, but here is some sample code and output when using the PHP class as well:

Script

<?php
$dbHost = $dbHost = 'mongodb://*******.dreamhostps.com';;
$m = new Mongo($dbHost);
var_dump($m);
?>

Output

object(Mongo)#2 (4) { ["connected"]=> bool(true) ["status"]=> NULL ["server":protected]=> string(33) "mongodb://ps93785.dreamhostps.com" ["persistent":protected]=> NULL }

Other Notes

Server location was redacted - I am not actually using asterisks.

Update - output from fsyncUnlock()

[*******]$ mongo
MongoDB shell version: 1.4.4
url: test
connecting to: test
type "help" for help
> db.fsyncUnlock()
Thu Apr 25 17:36:40 JS Error: TypeError: db.fsyncUnlock is not a function (shell):0

图片转代码服务由CSDN问答提供 功能建议

我启动并运行MongoDB - 我可以通过SSH登录我的VPS并执行 mongo </ code>命令。</ p>

这是我遇到问题的地方。 以下是一些测试命令及其输出:</ p>

  [*******] $ mongo 
MongoDB shell版本:1.4.4 
url:test 
连接到:  test 
type“help”for help 
&gt; 分贝\ NTEST 
&GT;  db.test.save({a:1}); 
unauthorized 
 </ code> </ pre> 
 
 

以下是测试输入及其输出的另一个示例:</ p> \ n

  [*******] $ mongo 
MongoDB shell版本:1.4.4 
url:test 
连接到:test 
type“help”for help 
&gt; 使用admin 
switched到db admin 
&gt;  db.addUser({user:“drew”,pwd:“myPassword”,roles:[“userAdminAnyDatabase”]})
Thu Apr 25 16:34:37 JS错误:未捕获异常:错误{
“$ err”:  “未授权的数据库:管理员锁定类型:-1客户端:127.0.0.1”,
“代码”:10057 
} 
unauthorized db:admin lock type:-1 client:127.0.0.1 
 </ code> </  pre> 
 
 

所以我有点卡住了 - 我不知道这是否会有所帮助,但是在使用PHP类时,这里有一些示例代码和输出:</ p> \ n

脚本</ strong> </ p>

 &lt;?php 
 $ dbHost = $ dbHost ='mongodb:// *****  **。dreamhostps.com';; 
 $ m = new Mongo($ dbHost); 
var_dump($ m); 
?&gt; 
 </ code> </ pre> 
 
 

输出</ strong> </ p>

  object(Mongo)#2(4){[“connected”] =&gt;  bool(true)[“status”] =&gt;  NULL [“server”:protected] =&gt;  string(33)“mongodb://ps93785.dreamhostps.com”[“persistent”:protected] =&gt;  NULL} 
 </ code> </ pre> 
 
 

其他注释</ strong> </ p>

服务器位置已编辑 - 我实际上并未使用星号 。 </ p>

更新 - 输出 fsyncUnlock()</ code> </ strong> </ p>

  [***  ****] $ mongo 
MongoDB shell版本:1.4.4 
url:test 
连接到:test 
type“help”for help 
&gt;  db.fsyncUnlock()
Thu 4月25日17:36:40 JS错误:TypeError:db.fsyncUnlock不是函数(shell):0 
 </ code> </ pre> 
 </ div>

1条回答 默认 最新

相关推荐 更多相似问题