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
  • 写回答

1条回答 默认 最新

  • dsf12123 2013-04-25 23: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

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

报告相同问题?

悬赏问题

  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改
  • ¥15 Windows 系统cmd后提示“加载用户设置时遇到错误”
  • ¥50 vue router 动态路由问题
  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义