gpt4 book ai didi

node.js - MongoDB - 使用代码 :100 关闭

转载 作者:IT王子 更新时间:2023-10-29 00:46:23 25 4
gpt4 key购买 nike

我一直在尝试在我的 Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-22-generic x86_64) VPS 上设置 MongoDB,但遇到了一些问题.我在我的服务器上以具有 root 访问权限但未使用 root 帐户本身的用户身份运行。

当我在 admin 数据库上执行 db.createUser() 以便添加其他用户时,我开始注意到这个问题,但我收到了这个错误:无权执行命令

然后我继续使用网站上提供的教程卸载并再次安装:https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/

现在,当我在 2 验证 MongoDB 已成功启动 Run MongoDB Community Edition 部分时,我会查看文件的输出 /var/log/mongodb/mongod.log,我得到以下信息:

2017-04-14T14:23:09.309+0200 I CONTROL  [main] ***** SERVER RESTARTED *****
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] MongoDB starting : pid=9691 port=27017 dbpath=/var/lib/mongodb 64-bit host=vps338741
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] db version v3.4.3
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] git version: f07437fb5a6cca07c10bafa78365456eb1d6d5e1
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] allocator: tcmalloc
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] modules: none
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] build environment:
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] distarch: x86_64
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] target_arch: x86_64
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten]
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=464M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-04-14T14:23:09.366+0200 E STORAGE [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
2017-04-14T14:23:09.367+0200 I - [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-04-14T14:23:09.367+0200 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-04-14T14:23:09.367+0200 I CONTROL [initandlisten] now exiting
2017-04-14T14:23:09.367+0200 I CONTROL [initandlisten] shutting down with code:100

我环顾四周,发现它不是同一个错误 as found here ,因为这与我没有 /data/db 文件夹这一事实有关。从该日志中我可以看出它与这一行有关:

2017-04-14T14:23:09.366+0200 E STORAGE  [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory

这是真的,当我转到 /var/lib/mongodb 并执行 ls -l 结果是:

drwxr-xr-x 2 mongodb mongodb 4096 Apr 14 14:10 journal
-rw-r--r-- 1 mongodb mongodb 0 Apr 14 14:02 mongod.lock
-rw-r--r-- 1 mongodb mongodb 0 Apr 14 14:10 WiredTiger
-rw-r--r-- 1 mongodb mongodb 21 Apr 14 14:10 WiredTiger.lock
-rw-r--r-- 1 mongodb mongodb 1004 Apr 14 14:10 WiredTiger.turtle

但我不知道是否应该手动创建该文件,因为在其他地方没有看到这个问题。如 in the answer to this question 所述,我确保 mongodb 用户也对这些文件具有权限,但仍然没有成功。

我真的不知道该怎么做,任何帮助将不胜感激,因为这是我第五次尝试让它工作!

谢谢!

最佳答案

如果您创建了 mkdir -p/data/db,您可能必须使用以下命令启动服务器:sudo mongod

macOS/OSX:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

关于node.js - MongoDB - 使用代码 :100 关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43411896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com