dpb42021 2013-04-25 15: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

展开全部

  • 写回答

1条回答 默认 最新

  • dsf12123 2013-04-25 15:44
    关注

    Try something such as db.fsyncUnlock() in Mongo Shell to test if the fsync lock is active and try to repeat the save of any info.

    Here is the documentation of the db.fsyncUnlock

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部