Mongodb caused 127.0.0.1:27017 unable to connect

The main reason is abnormal shutdown.
if you have abnormal shutdown operation, please try the following methods

mongod --dbpath  /usr/local/mongodb/data  --logpath  /usr/local/mongodb/mongod.log  --fork

Dbpath is your data configuration path
logpath is your log path
through this command, similar to windows restart services Service

Read More: