Reputation: 1
I am trying to install mongodb on ubuntu 16.10, though it's not listed in supported versions. I first got this error trying to start the mongo shell:
MongoDB shell version v4.0.0
connecting to: mongodb://127.0.0.1:27017
2018-07-12T11:15:00.464+0200 E QUERY [js] Error: couldn't connect
to server 127.0.0.1:27017, connection attempt failed: SocketException:
Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused
:
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed
I tried running sudo service mongod start
but I'm getting Unit mongod.service not found.
I also tried modifying the mongodb.service file, checking for locked files, running repair commands and reinstalling mongo.
Logging files are not found in the specified location in mongod.conf
, there is no mongodb
directory in /var/log
.
Upvotes: 0
Views: 1574
Reputation: 11
You need to create mongodb service in systemd.
sudo vim /etc/systemd/system/mongodb.service
Content:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitNPROC=64000
User=mongodb
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
Auto start in startup:
sudo systemctl enable mongodb
Start/Stop/Status:
sudo systemctl start/stop/status mongodb
sudo service mongodb start/stop/status
Upvotes: 1