Failed connection in MongoVUE - mongodb

I'm trying to create a new connection in MongoVUE but I have an error : "Connection was refused".
The connection configuration is:
Name: database
Server: 127.0.0.1
Port: 27017(default)
Username:admin
Connection was refused Unable to connect to server 127.0.0.1:27017:
Object reference not set to an instance of an object.. Type:
MongoDB.Driver.MongoConnectionException Stack: at
MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan
timeout, ReadPreference readPreference) at
MongoDB.Driver.MongoServer.Connect(TimeSpan timeout) at
MongoDB.Driver.MongoServer.Connect() at
MangoUI.MMongo.QSDlL5xzK686iCExThO(Object ) at
MangoUI.MMongo.Open(Boolean mustWrite) at MangoUI.MMongo.Open()
at MangoUI.MConnection.get_IsValid() at
MangoUI.WinConnect.SCOjR9kYRPerNNngykW(Object ) at
MangoUI.WinConnect.btnTest_Click(Object sender, EventArgs e)
Object reference not set to an instance of an object. Type:
System.NullReferenceException Stack: at
MongoDB.Driver.MongoServerInstance.RefreshStateAsSoonAsPossible()
at MongoDB.Driver.Internal.MongoConnection.HandleException(Exception
ex) at
MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer,
Int32 requestId) at
MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage
message) at
MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection
connection) at
MongoDB.Driver.MongoServerInstance.RunCommandAs[TCommandResult](MongoConnection
connection, String databaseName, IMongoCommand command) at
MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.Connect() at
MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan
timeout, ReadPreference readPreference)
How can I fix it and create connection? Help please.

Maybe you have solved this problem.I just provide how I solve for whom come with it later:
check if your mongodb is on.
Open the browser, input the urllocalhost:27017, you should find that the web page have words like"it seems that you attend to connect the mongodb", then go to step 3.
If not go to step 2.
keep your mongodb on. you should add the install directory to the path variable.
Then create a directory to store you db,for example"D:\data\db\".
Then input this commandmongod --dbpath D:\data\db in the console, never close the console if you want to make connection.
Then go step 3.
Use MongoBooster rather than MongVUE. MongoVUE is nolooger update since 2014. However, mongobooster is well and good,support mongodb from 2.2 to 3.2
That is all.

Related

Azure Cosmos DB Emulator : Unable to connect to MongoDb via MongoChef

After following the instructions from the following official reference "Use the Azure Cosmos DB Emulator for local development and testing", we attempted to connect to MongoDb using MongoChef using the connection string pasted below:
mongodb://localhost:C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==#localhost:10255/admin?ssl=true
But when we test the connection through MongoChef we get the error pasted below:
Connection failed.
SERVER [localhost:10255] (Type: UNKNOWN)
|_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Socket error: Connection refused: connect
Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27018, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
If we check the ports currently in use on our system, we do not see 10255 being used at all.
Could someone please help us understand what's wrong here.
The connection string is correct. Studio 3T has a very nasty bug - when you use From URI function while creating new connection it cuts the "+" characters that are present in the key, that's why you need to copy the key manually to the corresponding field in connection properties.
Also, make sure the Emulator is actually launched (tray area icon should be present).

Check mongo status on Meteor?

I'm trying to create an alarm system for my application, that will trigger when one of the services (e.g. MongoDB) is not working.
What I'm doing is, once the application is started, I shut down my MongoDB server and try to connect to it, but instead of receiving an error my application just gets stuck into the execution of the method. The server console looks like something is in execution.
My current code (coffeescript) is:
checkMongoService: ()->
mongo = Npm.require 'mongodb'
assert = Npm.require 'assert'
url = 'mongodb://....'
mongo.connect url, (err, db) ->
assert.equal null, err
console.log 'Connected correctly to server'
db.close()
return
I've also been trying by doing a simple
Meteor.users.find().count();
or using MongoInternals with
testConnection = new MongoInternals.RemoteCollectionDriver("mongodb://...);
but still same issue, when mongo is not running no error is thrown and the console stops to work. If then I start Mongo again, it will just return the result (in this case the log 'Connected correctly to server')
Something that I've noticed is if I try with meteor shell to execute testConnection = new MongoInternals.RemoteCollectionDriver("mongodb://...); I get an error "Error: failed to connect to [127.0.0.1:27017]"
TL;DR
Do you might have an idea on how I can check if mongo is reachable or do you know if I'm doing something wrong with the code above?
Try setting the timeouts to be a bit shorter than the default 30 seconds:
mongo.connect(url, {
connectTimeoutMS: 1000,
socketTimeoutMS: 1000,
reconnectTries: 1
}, function(err, db) {...}
(Full set of connection params are here)
Meteor.status().status
from the docs
This method returns the status of the connection between the client and the server. The return value is an object with the following fields:
connected (Boolean)
True if currently connected to the server. If false, changes and method invocations will be queued up until the connection is reestablished.
status (String)
Blockquote
Describes the current reconnection status. The possible values are connected (the connection is up and running), connecting (disconnected and trying to open a new connection), failed (permanently failed to connect; e.g., the client and server support different versions of DDP), waiting (failed to connect and waiting to try to reconnect) and offline (user has disconnected the connection).
https://docs.meteor.com/api/connections.html

Connection to mongoose causes ECONNREFUSE [duplicate]

I've got a problem to connect my socketIO application (made with nodeJS) with my mongoDB.
I try to connect on an remote server, but its throws me error
Here's my code (there's no user/password set in the mongoDB) :
var url = "mongodb://192.168.1.5:27017/DB"
MongoClient.connect(url, function(err, db) {
console.log("test")
if (!err) {
console.log("test");
}
else {
console.dir(err)
throw err
}
// db.close();
});
And here's when I launch the server and I tried to launch the app in a navigator :
Server listening at port 80:
{ [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect ECONNREFUSED' }
/root/fys-realtime/examples/chat/node_modules/mongodb/lib/server.js:228
process.nextTick(function() { throw err; })
^
Error
at Error.MongoError (/root/fys-realtime/examples/chat/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:13:17)
at Server.destroy (/root/fys-realtime/examples/chat/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:629:47)
at Server.close (/root/fys-realtime/examples/chat/node_modules/mongodb/lib/server.js:344:17)
at Db.close (/root/fys-realtime/examples/chat/node_modules/mongodb/lib/db.js:267:19)
at /root/fys-realtime/examples/chat/node_modules/mongodb/lib/db.js:196:12
at null.<anonymous> (/root/fys-realtime/examples/chat/node_modules/mongodb/lib/server.js:226:9)
at g (events.js:180:16)
at emit (events.js:98:17)
at null.<anonymous> (/root/fys-realtime/examples/chat/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:238:68)
at g (events.js:180:16)
This error is returned for several errors like :
server is not running
you need to authenticate user
this database does not exists
the mongodb port is not the default port
Check this. Normaly your problem is just one of these causes
For this to work you have to make the changes in /etc/mongod.conf
comment bind_ip=127.0.0.1 As if this line in not commented it Listen to local interface only.
One of the solutions is to change 127.0.0.1 to public ip or whatever the router provided you with in mongodb config file located in /etc
There could be few reasons for ECONNREFUSED error.
Checkpoints
Check if your port is not serving any other process.
Check if your mongod is running.
Check if you localHost is configured correctly with your id or not.
for more you can see this

MongoDB: Element "sysinfo" not found

We successfully installed mongodb. However when we try to connect to it from Mongo Vue we are receiving following error. Any idea how to resolve this?
Connection was refused
Unable to connect to server Frontier:27017: Element 'sysInfo' not found..
Type: MongoDB.Driver.MongoConnectionException
Stack: at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
at MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
at MongoDB.Driver.MongoServer.Connect()
at MangoUI.MMongo.QSDlL5xzK686iCExThO(Object )
at MangoUI.MMongo.Open(Boolean mustWrite)
at MangoUI.MMongo.Open()
at MangoUI.MConnection.get_IsValid()
at MangoUI.WinConnect.SCOjR9kYRPerNNngykW(Object )
at MangoUI.WinConnect.btnTest_Click(Object sender, EventArgs e)
Element 'sysInfo' not found.
Type: System.Collections.Generic.KeyNotFoundException
Stack: at MongoDB.Bson.BsonDocument.get_Item(String name)
at MongoDB.Driver.MongoServerBuildInfo.FromCommandResult(CommandResult result)
at MongoDB.Driver.MongoServerInstance.LookupServerInformation(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.Connect()
at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
If you are using MongoDB 3.0, it will not work. I have not been able to get a response from the company.
I am thinking support for the product has stopped and the application is never going to be upgraded.

Mongo 3.0.1 DB Auth/Connection problems. Mongo console Yes, everything else No

I have MongoDB 3.0.1 installed on Windows 7 Pro 64bit. Everything that I am doing is being done on this server itself, all connections are via 127.0.0.1:27017. And yes, I have applied the MS Hotfix that was recommended to do by MongoDB. Here is my complete config file:
systemLog:
destination: file
path: "C:\\Program Files\\MongoDB\\Server\\3.0\\data\\log\\mongod.log"
logAppend: true
storage:
dbPath: "C:\\Program Files\\MongoDB\\Server\\3.0\\data\\db"
security:
authorization: enabled
I created a superuser like this:
db.createUser({user:"superuser", pwd:"temp",
roles:[ "userAdminAnyDatabase", "readWrite" ] } )
I can log into mongo console like this:
mongo.exe 127.0.0.1:27017/admin -u superuser -p temp --authenticationDatabase admin --verbose
I can then do everthing from mongo console. But when I try to connect an admin UI such as Mongovue or Robomongo, I get connection refused. Mongovue spits out this stack trace:
Connection was refused
Unable to connect to server 127.0.0.1:27017: Object reference not set to an instance of an object..
Type: MongoDB.Driver.MongoConnectionException
Stack: at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
at MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
at MongoDB.Driver.MongoServer.Connect()
at MangoUI.MMongo.QSDlL5xzK686iCExThO(Object )
at MangoUI.MMongo.Open(Boolean mustWrite)
at MangoUI.MMongo.Open()
at MangoUI.MConnection.get_IsValid()
at MangoUI.WinConnect.SCOjR9kYRPerNNngykW(Object )
at MangoUI.WinConnect.btnTest_Click(Object sender, EventArgs e)
Object reference not set to an instance of an object.
Type: System.NullReferenceException
Stack: at MongoDB.Driver.MongoServerInstance.RefreshStateAsSoonAsPossible()
at MongoDB.Driver.Internal.MongoConnection.HandleException(Exception ex)
at MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, Int32 requestId)
at MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message)
at MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.RunCommandAs[TCommandResult](MongoConnection connection, String databaseName, IMongoCommand command)
at MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.Connect()
at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
This looks like a null pointer to me. Am I missing a config somewhere ? What do I need to do to get this to work ?
Thanks,
Warren
I guess the answer is as simple as Mongovue and Robomongo do not support Mongo DB 3.0.1 yet. I had no problems getting the Mongo console to connect and 3T MongoChef to connect. Now I guess I need to make sure Mongoose is good.