在ubuntu 15.04中安装mongodb

前端之家收集整理的这篇文章主要介绍了在ubuntu 15.04中安装mongodb前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在Ubuntu 15.04中安装了几次 Mongodb但它安装不正确并且mongo shell有错误
  1. mongo
  2. MongoDB shell version: 3.0.1
  3. connecting to: test
  4. 2015-04-07T18:46:14.958+0430 W NETWORK Failed to connect to 127.0.0.1:27017,reason: errno:111 Connection refused
  5. 2015-04-07T18:46:14.959+0430 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1),connection attempt Failed
  6. at connect (src/mongo/shell/mongo.js:179:14)
  7. at (connect):1:6 at src/mongo/shell/mongo.js:179
  8. exception: connect Failed

我正在安装2.6.4并更新到3.0.1但错误无法解决.
我找到this Answer in stackoverflow搜索在ubuntu中找到mongod.lock并将其删除然后流程这一步:

  1. Step 2: Repair mongodb.
  2. sudo mongod --repair
  3.  
  4. Step 3: start mongodb.
  5. sudo start mongodb
  6. or
  7. sudo service mongodb start
  8.  
  9. Step 4: Check status of mongodb.
  10. sudo status mongodb
  11. or
  12. sudo service mongodb status
  13.  
  14. Step 5: Start mongo console.
  15. mongo

为reapir:

  1. mongod --repair
  2. 2015-04-07T18:58:15.595+0430 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found.,terminating
  3. 2015-04-07T18:58:15.595+0430 I CONTROL [initandlisten] dbexit: rc: 100

sudo服务mongodb启动时出现此错误

  1. sudo service mongodb start
  2. [sudo] password for amir:
  3. Failed to start mongodb.service: Unit mongodb.service Failed to load: No such file or directory.

和状态:

  1. sudo service mongodb status
  2. mongodb.service
  3. Loaded: not-found (Reason: No such file or directory)
  4. Active: inactive (dead)

并且对于启动shell,第一个问题就是抛出.

我尝试使用linuxbrew安装mongodb并再次错误没有消失…

—————更新——–
因为在什么说“demostene”:

I think you just need to create this folder /data/db . Try sudo mkdir /data/db then repair

我在home / amir / data / db中有/ data / db然后我在root中创建/ data / db而没有任何变化……
在上次我用linuxbrew安装mongo并为此sudo命令在sudo mongod –repair和其他步骤中没有工作,没有sudo那个命令不起作用…
所以我首先在终端尝试sudo su并尝试root中的步骤
在第一步说mongodb不是安装和安装它插入:apt-get install mongo-server
我插入此命令并再次安装mongodb.
现在在root mongo shell中正确启动此版本:

  1. root@AbrFa:/home/amir# mongo
  2. MongoDB shell version: 2.6.3
  3. connecting to: test
  4. >

没有sudo su mongo shell在这个版本中启动:

  1. MongoDB shell version: 3.0.1
  2. connecting to: test

顺便说一下,我想知道这两个版本是否相互冲突?

好的,我找到了解决办法.不是最好的,但它现在会做. Click this link并下载合适的选项.我选择了apt-install选项.选择是你的.版本是2.6.3,您将不得不再次创建/ data / db文件夹.但我们现在回来了.

猜你在找的Ubuntu相关文章