在Ubuntu 15.10上安装Mongo 3.2.9

时间:2016-08-19 19:50:39

标签: mongodb ubuntu

我在ubuntu中安装了mongodb,请使用以下链接 https://askubuntu.com/questions/724749/install-mongo-3-2-on-ubuntu-15-10

root@karthickeyan:/home/karthickeyan# mongo
MongoDB shell version: 3.2.9
connecting to: test
2016-08-20T01:17:08.198+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-08-20T01:17:08.198+0530 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

1 个答案:

答案 0 :(得分:0)

使用以下内容创建文件/lib/systemd/system/mongod.service

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf

[Install]
WantedBy=multi-user.target

启动服务:

sudo service mongodb start

然后运行命令:

mongo

然后,您将访问该服务器。希望对你有效。 :)