MongoDB's mongosniff won't start? - mongodb

mongosniff is for looking at what's sent to the MongoDB server, but on a Mac with OS X Snow Leopard, it says
error finding device: no suitable device found
this is when mongod is running fine. Is there something that can make it work?
Update: thanks. after running it as root, for some reason it is not reporting any activities when a mongo is running with different queries on this same machine. One time I had an error and it reported once and that was it... was it to report each activity usually?

Have you tried running it as root? I get that error when I don't have permission to monitor network traffic.
Edit in response to your update:
You have to specify the network interface to sniff. Run ifconfig to see what your local network name is and then use:
sudo mongosniff --source NET lo

Running as root works for me:
bobk-mbp:~ bobk$ sudo mongosniff --source NET lo0
sniffing... 27017
10.78.4.213:14303 -->> 10.78.4.213:27017 admin.$cmd 58 bytes id:2447 9287
query: { ismaster: 1 } ntoreturn: -1 ntoskip: 0
10.78.4.213:27017 <<-- 10.78.4.213:14303 87 bytes id:2789 10121 - 9287
reply n:1 cursorId: 0
{ ismaster: true, maxBsonObjectSize: 16777216, ok: 1.0 }
...also, ifconfig shows that the LOOPBACK is on lo0 on my system.

Related

Failed to start mongod com.Could not find appropriate mongod in `/opt/mongodb/mms/mongodb-releases

I am getting following error when I tried to activate a backup for mongo instance.
I choosed local and copied all rpms to this folder /opt/mongodb/mms/mongodb-releases.
error:
Failed to start mongod
com.xgen.svc.brs.util.GenericMongoManager$MongodVersionException: Could not find appropriate mongod in `/opt/mongodb/mms/mongodb-releases/`, versions available to MMS: . Expecting version 3.4.4 or greater.
com.xgen.svc.brs.util.GenericMongoManager$Purpose.calculateBinaryPath(GenericMongoManager.java:166)
com.xgen.svc.brs.util.GenericMongoManager$Purpose.<init>(GenericMongoManager.java:125)
com.xgen.svc.brs.util.MongoManager$MongoDPurpose.<init>(MongoManager.java:331)
com.xgen.svc.brs.util.MongoManager$HeadPurpose.<init>(MongoManager.java:477)
com.xgen.svc.brs.job.ReplicaSetJob.startMongo(ReplicaSetJob.java:103)
com.xgen.svc.brs.job.ReplicaSetJob.startMongo(ReplicaSetJob.java:80)
com.xgen.svc.brs.job.IncrementalSyncJob.doWork(IncrementalSyncJob.java:82)
com.xgen.svc.brs.grid.Daemon.iterate(Daemon.java:116)
com.xgen.svc.brs.grid.Daemon.run(Daemon.java:305)

Assertion failure _setName.size on URI auth

I tried to much posibilities that I found searching for this error without success.
I can connect to my mongo with the CLI typing mongo --port myPort -u myUser ...
But I need to connect my app (in the same host) by URI.
This is what I get:
mongo mongodb://username:password#localhost:myPort/myDb
MongoDB shell version: 2.6.10
connecting to: mongodb://username:password#localhost:myPort/myDb
2017-05-19T23:34:33.568+0200 Assertion failure _setName.size() src/mongo/client/dbclientinterface.h 231
2017-05-19T23:34:33.569+0200 0x6b75c9 0x659e9f 0x636a32 0x5013b8 0x4fa7f1 0x6006fd 0x5eb869 0x7fdcdff35d76 0x1ebf47506362
mongo(_ZN5mongo15printStackTraceERSo+0x39) [0x6b75c9]
mongo(_ZN5mongo10logContextEPKc+0x21f) [0x659e9f]
mongo(_ZN5mongo12verifyFailedEPKcS1_j+0x142) [0x636a32]
mongo(_ZN5mongo16ConnectionStringC1ENS0_14ConnectionTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x208) [0x5013b8]
mongo(_ZN5mongo16ConnectionString5parseERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERS6_+0x201) [0x4fa7f1]
mongo(_ZN5mongo17mongoConsExternalEPNS_7V8ScopeERKN2v89ArgumentsE+0x11d) [0x6006fd]
mongo(_ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE+0xa9) [0x5eb869]
/usr/lib/libv8.so.3.14.5(+0x99d76) [0x7fdcdff35d76]
[0x1ebf47506362]
2017-05-19T23:34:33.570+0200 Error: assertion src/mongo/client/dbclientinterface.h:231 at src/mongo/shell/mongo.js:148
exception: connect failed
Any idea? :\ Thanks
Solved upgrading mongod from 2.6 to 3.0.15
If you don't want to upgrade to a newer version of MongoDB you can also just drop the mongodb:// from the beginning. For example change:
mongo mongodb://username:password#localhost:myPort/myDb
to:
mongo username:password#localhost:myPort/myDb
Ref: https://jira.mongodb.org/browse/SERVER-15739?focusedCommentId=1000536&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1000536

errmsg" : "No host described in new configuration 1 for replica set rs0 maps to this node", Why I am getting this message?

I am getting this message every time I do rs.initiate() :
No host described in new configuration 1 for replica set rs0 maps to this node
This is how my /etc/hosts/ file looks on both the replica set servers.
Server 1 and server 2 "hosts" file
127.0.0.1 localhost
aa.bb.cc.dd DataMongo1
ee.ff.gg.hh DataMongo2
Server 1-mongod.conf file
bind-ip aa.bb.cc.dd
Server 2 -mongod.conf file
bind-ip ee.ff.gg.hh
changed server1 hostname to DataMongo1 and server2 to DataMongo2
$hostname DataMongo1
Port 27071 is uncommented on both servers
ReplicaSet config file:
cfg= {
_id:"rs0",
members:[{_id:0,host:"DataMongo1:27071"},{_id:1,host:"DataMongo2:27071"}]}
Please help me with this issue.
I just ran into this issue, and in my case the symptoms were that everything worked correctly, until I rebooted the server.
Then I would get the following error: NodeNotFound: No host described in new configuration $id for replica set $name maps to this node
Just restarting the mongodb daemon fixed it, so it couldn't be a replica set configuration issue.
After checking the logs a bit more in detail, I noticed the following error message: NETWORK [replexec-0] getaddrinfo("$name.emilburzo.com") failed: Temporary failure in name resolution -> bingo
It was trying to query the hostname before the network was fully up, and thus the replica set member didn't know it's own identity
Adding the server's FQDN hostname to /etc/hosts fixed it, e.g.:
127.0.1.1 shortname shortname.fqdn.com
Looks like the port is wrong. The default port of MongoDB is 27017, not 27071.
if you are using mongo.conf file then initially comment "replication" section like below,
...
#operationProfiling:
# replication:
# replSetName: rs0-here
#sharding:
...
Now run mongod and configure replica set on mongo terminal like below,
rs.initiate({_id: "rs0-here", version: 1, members: [{ _id: 0, host : "your_host:27017" }]})
You can also create users and databases here and then exit out of it. Uncomment the following section in mongo.conf,
replication:
replSetName: rs0-here
run mongod again and then this issue should go away.

MongoDB db.serverStatus() gives error when running using tunnel that is targeted to api.cloudfoundry.com

Following is the console session...
C:\Users\xxx>vmc tunnel myMongoDB
Getting tunnel connection info: OK
Service connection info:
username : uuuu
password : pppp
name : db
url : mongodb://uuuu:pppp#172.30.xx.xx:25200/db
Starting tunnel to myMongoDB on port 10000.
1: none
2: mongo
3: mongodump
4: mongorestore
Which client would you like to start?: 2
Launching 'mongo --host localhost --port 10000 -u uuuu -p pppp db'
MongoDB shell version: 2.0.6
connecting to: localhost:10000/db
> db.serverStatus()
{ "errmsg" : "need to login", "ok" : 0 }
>
Which credentials should I use to login (assuming should use db.auth) to get rid of the error "{ "errmsg" : "need to login", "ok" : 0 }".
When I run the same in micro CF on my machine it works ok and gives me the expected output.
P.S. I'm trying this to get to know the current connections on my application, written in node.js. Trying to debug some issues with connections to the DB. If there is any other alternative that I can use please suggest that as well.
this should work! Not sure why your tunnel isn't connecting, my immediate suggestion is to try another instance of MongoDB and see if the same error occurs.
If you are trying to inspect the bound services on you node.js app you should be able to inspect them in the VCAP_SERVICES environment variable. For example;
var http = require('http');
var util = require('util');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write(util.inspect(process.env.VCAP_SERVICES));
res.write("\n\n************\n\n");
res.end(util.inspect(req.headers));
}).listen(3000);
This code is currently running at http://node-headers.cloudfoundry.com/ to serve as an example. However, mongodb connections for node.js applications should automatically configure to the bound service. If this does not work for you, then please do let me know.

mongodb on VMPlayer ubuntu

I have installed mongoDB on ubuntu in VMplayer running on windows7.
I have edited the hosts file to have
machinename 192.168.1.12.
I installed all the packages and trying to start the mongod.
This is the error I am getting:
ubuntu:/etc/init.d$ start mongodb start: Rejected send message, 1
matched rules; type="method_call", sender=":1.128" (uid=1000 pid=9669
comm="start mongodb ") interface="com.ubuntu.Upstart0_6.Job"
member="Start" error name="(unset)" requested_reply="0"
destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
Can you please let me know what could be the issue?
I was able to install successfully in a pevious in ubuntu.
That's a permission error, you need to sudo, i.e. run the following and you will be ok -
sudo start mongodb