How to connect to MongoDB EC2 instance

前端 未结 6 783
失恋的感觉
失恋的感觉 2020-12-31 02:05

we have an EC2 MongoDB 2.4 instance from Amazon MarketPlace. when i try to access it from my computer using the mongo command like so:

mongo xx-xx-xx-xx-xx.c         


        
6条回答
  •  清歌不尽
    2020-12-31 02:36

    Try to access xx-xx-xx-xx-xx.compute-1.amazonaws.com:27017 from browser, if it works then ssh into the instance.

    • Stop the mongodb server
    • Remove the file /var/lib/mongodb/mongod.lock

    start the mongodb server again, and check if typing mongo takes into a mongo shell or gives any error.

    If the error is present, exit from the instance and again ssh to check for $mongo, if it opens a mongo shell. Try a reboot after this changes if the error still exists after the above changes.

    The only concern here is, before accessing it from any application. Mongodb should work independently in the terminal.

提交回复
热议问题