Connecting to MongoDB
You can connect to MongoDB with your Joyent Public Cloud admin user credentials, which you can find in your my.joyent.com portal. The MongoDB server is configured to listen to the localhost (127.0.0.1) and with authentication enabled.
|To run the commands in this page, you must be logged in as
Connect to a MongoDB database as the
admin user and connect to the
# mongo -uadmin -p$(mdata-get mongodb_pw) admin
|This command only works if you have not modified your original MongoDB credentials. If you have changed your credentials, use this command:
The first reference to
admin specifies the user of the database that uses the default or set password to connect. The second reference to
admin specifies the name of the database to which you want to connect.
If you connect without authenticating, MongoDB will log you in to the shell but will not let you execute any commands. Instead, you will see:
errmsg : need to login
If you provide the wrong password you will see:
To connect other SmartMachines over a private network to your MongoDB appliance:
- SSH into your MongoDB appliance.
- Locate the
Set the value of the
bind_ipproperty to the private IP of your MongoDB appliance. You can find the private IP of your appliance in your my.joyent.com portal or by using
For more information on private IPs, see [here](General FAQs.html#GeneralFAQs-privIps).
- Save the file and close it. You will need to restart the MongoDB server to set the changes.
- Run this command to restart the MongoDB server.
svcadm restart mongodb