我在Ubuntu 15.04中安装了几次
Mongodb但它安装不正确并且mongo shell有错误:
mongo MongoDB shell version: 3.0.1 connecting to: test 2015-04-07T18:46:14.958+0430 W NETWORK Failed to connect to 127.0.0.1:27017,reason: errno:111 Connection refused 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 at connect (src/mongo/shell/mongo.js:179:14) at (connect):1:6 at src/mongo/shell/mongo.js:179 exception: connect Failed
我正在安装2.6.4并更新到3.0.1但错误无法解决.
我找到this Answer in stackoverflow并搜索在ubuntu中找到mongod.lock并将其删除然后流程这一步:
Step 2: Repair mongodb. sudo mongod --repair Step 3: start mongodb. sudo start mongodb or sudo service mongodb start Step 4: Check status of mongodb. sudo status mongodb or sudo service mongodb status Step 5: Start mongo console. mongo
为reapir:
mongod --repair 2015-04-07T18:58:15.595+0430 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found.,terminating 2015-04-07T18:58:15.595+0430 I CONTROL [initandlisten] dbexit: rc: 100
sudo服务mongodb启动时出现此错误:
sudo service mongodb start [sudo] password for amir: Failed to start mongodb.service: Unit mongodb.service Failed to load: No such file or directory.
和状态:
sudo service mongodb status ● mongodb.service Loaded: not-found (Reason: No such file or directory) 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中正确启动此版本:
root@AbrFa:/home/amir# mongo MongoDB shell version: 2.6.3 connecting to: test >
没有sudo su mongo shell在这个版本中启动:
MongoDB shell version: 3.0.1 connecting to: test
顺便说一下,我想知道这两个版本是否相互冲突?
好的,我找到了解决办法.不是最好的,但它现在会做.
Click this link并下载合适的选项.我选择了apt-install选项.选择是你的.版本是2.6.3,您将不得不再次创建/ data / db文件夹.但我们现在回来了.
原文链接:https://www.f2er.com/ubuntu/347439.html