How to connect to mongo shell from windows cmd? - windows

This is my first time using Mongodb, It connect normally using the IDE from Mongodb university basics m001 course but when I tried to connect from cmd it won't connect and gives me this error
*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.
Error: Authentication failed. :
connect#src/mongo/shell/mongo.js:374:17 #(connect):2:6 exception:
connect failed exiting with code 1
I added the path to my environment & checked the network access from my Atlas and I can connect to it from anywhere
Can anyone help me with this please??

Related

Cassandra: target machine actively refused it

I am trying to run Cassandra (CQL Shell) and I am receiving the following error, I have tried all the google responses to existing questions, nothing has fixed it so far.
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(10061, "Tried connecting to [('127.0.0.1', 9042)]. Last error: No connection could be made because the target machine actively refused it")})
Before installing Apache Cassandra, JDK must be installed.
Can you make sure the IP address is set correctly on your rpc_address setting in your cassandra.yaml file, on your cassandra server.
Also, you need to make sure port 9042 is open and available for incoming traffic (if your IT department is setting up servers, it is possible this port is blocked, unless otherwise specified...)
Hope it helps.
I also faced the same issue , but may be the below 2 way's can help :
Option 1 :
In my case i haven't started the Cassandra Server and was directly trying to connect to Cassandra.
(a) Firstly start the cassandra server via cmd --> \bin>cassandra.bat -f
and then
(b) Try to connect to it's node --> \bin>cqlsh.bat -u cassandra
Option 2:
Try changing the rpc_address in your cassandra.yaml file to eihter 127.0.0.1 instead of localhost
or to 0.0.0.0 instead of localhost
and then again start the server from new CMD.

Unable to connect to EC2 Ubuntu instance from Putty

Im getting the error : Putty Fatal Error. Network Error: Connection Refused.
Security Group SSH rule:
I was able to connect to the instance a few hours ago. I did not change anything. What am I missing? Please help.
Instance is running :
Putty configuration:
System Log:
Btw, i am able to RDP to the instance by following https://aws.amazon.com/premiumsupport/knowledge-center/connect-to-linux-desktop-from-windows/

Local Mongo on Windows - couldn't connect to server 127.0.0.1:27017, connection attempt failed

Installed Mongo 3.2 on Windows 8.1. Got this:
c:\foo>"c:\Program Files\MongoDB\Server\3.2\bin\mongo.exe"
MongoDB shell version: 3.2.5
connecting to: test
2016-04-26T13:41:31.032+0100 W NETWORK [thread1] Failed to connect to 127.0.0.1
:27017, reason: errno:10061 No connection could be made because the target machine actively refused it.
2016-04-26T13:41:31.034+0100 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
c:\foo>ver
Microsoft Windows [Version 6.3.9600]
Why?
What else can I say?
I got the same error this is how i solved it.
open your task manager
click on service tab
check for Mongo Db service
and right click restart it.
hopefully this will solved it.
You have to start the server process first.
https://docs.mongodb.org/v3.0/tutorial/install-mongodb-on-windows/#run-mongodb
First, you should install Mongodb as a service,
Open your cmd as admin
Run ( net start mongodb )
Now you can run the command ( mongo ) and you will be able to connect normally, with no Problem.

Use same mongodb database over Windows 7 & Ubuntu

I would like to use the same MongoDB database I use on windows 7 as I do on Ubuntu.
On Ubuntu, I went into the file: /etc/mongodb.conf
and changed dbpath=/var/lib/mongodb to dbpath=/media/meaniostack/OS/data/db which is the database on the windows partition.
When I tried starting up mongod & mongo, I got the following error:
MongoDB shell version: 2.6.7
connecting to: test
2015-01-30T14:19:11.027-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-01-30T14:19:11.028-0500 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
However, when I go back to dbpath=/var/lib/mongodb, it works like normal. Keep in mind, that I have mounted media/meaniostack/OS
How do I make this work, and is it possible? Does mongodb, use a different type of storage compared to the one in Ubuntu?
After a bit of messing around I found the solution to be:
Alter permissions to the folders that the database is in.
Change the mongodb.conf path variable
Use mongod --dbpath /media/meaniostack/OS/data/db instead of: service mongod start
Hope this helped anyone with a similar issue.

Can't access mongoDB outside server

I've set up a mongod service on centOS. I've played around with DBs, collections, etc - after connecting using 'localhost', 27017.
That said, for some reason I can't connect to it from outside SSH. I'm using the ruby mongo gem to try and connect to mydomain.com:27017 and I get the following error:
Mongo::ConnectionFailure: Failed to connect to a master node at xx.xx.xx.xx:27017
How can I figure out what's wrong?

Resources