简体   繁体   中英

How to install mongodb in Ubuntu?

I am installing Mongodb in Ubuntu and get following error message :

ubuntu@ip-10-214-154-88:/var/lib/mongodb$ mongo
MongoDB shell version: 3.0.0
connecting to: test
2015-10-26T11:45:14.257+0000 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-10-26T11:45:14.267+0000 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

I tried to solve this problem :

sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod restart

but above solution does not work for me.

I also check space on server :

ubuntu@ip-10-214-154-88:/var/lib/mongodb$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  4.3G  3.1G  59% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.9G   12K  1.9G   1% /dev
tmpfs           377M  356K  377M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.9G     0  1.9G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/xvdb       3.9G  8.1M  3.7G   1% /mnt

Check if mongod is running on your system. If not first start it as a daemon . On my system it is running as "/usr/bin/mongod" After that type mongo on terminal and initiate the client

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM