Ubuntu更改mongoDB的位置导致连接失败(不允许操作)

时间:2017-04-17 15:46:35

标签: mongodb ubuntu permissions file-permissions

所以我按照here提供的说明在Ubuntu上安装了MongoDB Community Edition。

我首先启动了服务,然后使用任何客户端进行连接,成功测试了我的连接。 (robomongo和umongo)。

现在因为我的工作类型,我将把GB文件存储到我的机器上。因此我需要更改mongoDB的位置。所以我按照下面的步骤(提到here):

第1步: 在mongod.conf

打开\etc

第2步

编辑所需帐户的路径。我的新路径如下

dbPath: /home/shouman/mongodb

第3步:将数据从旧路径复制到新路径

第4步:以递归方式将新目录权限更新为777

现在我似乎无法启动mongoDB。我在/var/log/mongodb/mongod.lod检查了日志文件,似乎存在如下所述的权限问题

/home/shouman/mongodb/WiredTiger.wt

现在您可以注意到

中的一些注释
  1. mongoDB现在可以看到新位置。 (它还创建了两个锁定文件)
  2. 我检查了这个特定文件的权限,看起来没问题(查看最后的图片)
  3. 我尝试重新启动mongoDB但仍然存在同样的问题
  4. 以下是完整的日志输出

    2017-04-17T18:19:59.466+0300 I CONTROL  [main] ***** SERVER RESTARTED *****
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] MongoDB starting : pid=3374 port=27017 dbpath=/home/shouman/mongodb 64-bit host=shouman-Lenovo-IdeaPad-Y500
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] db version v3.4.3
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] git version: f07437fb5a6cca07c10bafa78365456eb1d6d5e1
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] allocator: tcmalloc
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] modules: none
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] build environment:
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten]     distmod: ubuntu1604
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten]     distarch: x86_64
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten]     target_arch: x86_64
    2017-04-17T18:19:59.471+0300 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/home/shouman/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
    2017-04-17T18:19:59.503+0300 I -        [initandlisten] Detected data files in /home/shouman/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
    2017-04-17T18:19:59.503+0300 I STORAGE  [initandlisten] 
    2017-04-17T18:19:59.503+0300 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
    2017-04-17T18:19:59.503+0300 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
    2017-04-17T18:19:59.503+0300 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3454M,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-17T18:19:59.507+0300 E STORAGE  [initandlisten] WiredTiger error (1) [1492442399:507878][3374:0x7f5379b49cc0], file:WiredTiger.wt, connection: /home/shouman/mongodb/WiredTiger.wt: handle-open: open: Operation not permitted
    2017-04-17T18:19:59.508+0300 I -        [initandlisten] Assertion: 28595:1: Operation not permitted src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
    2017-04-17T18:19:59.508+0300 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
    2017-04-17T18:19:59.508+0300 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
    2017-04-17T18:19:59.508+0300 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
    2017-04-17T18:19:59.508+0300 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
    2017-04-17T18:19:59.508+0300 I CONTROL  [initandlisten] now exiting
    2017-04-17T18:19:59.508+0300 I CONTROL  [initandlisten] shutting down with code:100
    

    WireTiger.wt Permissions

1 个答案:

答案 0 :(得分:0)

行。所以我似乎还需要让mongod用户成为新mongoDB driectoty的拥有者

我在这个问题中找到了答案

MongoDB service doesn't start. errno:13 Permission denied