PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 23rd of May, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[03:04:06] <narutimateum2> so should i use multi db for like user in mysql.. products in mongo?
[03:04:15] <narutimateum2> or i could just put everything in mongo?
[03:54:12] <Reflow> i have 9m rows on a sql query and it's taking too long to finish a query
[03:54:20] <Reflow> could someone help me optimize it
[04:01:40] <joannac> Reflow: build an index?
[04:02:02] <joannac> this is probably not the place to ask about sql though
[04:02:11] <Reflow> joannac where then
[04:02:14] <Reflow> this is mongodb channel
[04:02:38] <Reflow> but i did db.collection.ensureIndex({ field : "text" }) and it does not optimize it
[04:02:58] <joannac> um, what's your query?
[04:03:17] <Reflow> db.collection.find({ field : "text"});
[04:03:25] <Reflow> but i do it on like 9 different fields
[04:03:34] <Reflow> and i execute 8 queries parallel
[04:08:10] <joannac> umm
[04:08:18] <joannac> ensureIndex({field: 1})
[04:08:35] <Reflow> isn't it supposed to be text instead of 2
[04:08:37] <Reflow> 1*
[04:08:43] <Reflow> joannac
[04:08:53] <joannac> no
[04:09:07] <joannac> http://docs.mongodb.org/manual/reference/method/db.collection.ensureIndex/
[04:09:15] <joannac> you want an ascending or descending index
[04:09:38] <joannac> not a text index (i think) http://docs.mongodb.org/manual/core/index-text/
[04:10:16] <joannac> you may want a compound index too
[04:15:16] <nevan> hi
[04:21:59] <nevan> anybody online
[04:22:46] <joannac> yes
[04:22:51] <joannac> do you have a question?
[04:23:04] <nevan> yes
[04:24:02] <nevan> i created a script in ruby to extract db size of all db of a single mongo instance
[04:24:21] <nevan> due to some bug it also created around 4k empty db....
[04:24:44] <nevan> and due to which mongo instance became unresponsive though system resources were empty
[04:25:05] <nevan> i want to know what actually might have happened that made mongo unresponsive
[04:25:21] <nevan> cpu, ram, io, everything was normal
[04:25:58] <nevan> any idea
[04:25:59] <nevan> ?
[04:26:25] <nevan> or if you could redirect me to internals of mongodb, i am not able to find anything deep in mongodocs
[04:28:04] <joannac> file allocation?
[04:28:32] <joannac> wait, what kind of script?
[04:28:36] <joannac> using db.eval()?
[04:30:20] <nevan> no db.stat()
[04:31:08] <nevan> the mongo became unsresponsie after the script executed succesfully and remained so until i did not killed and started mongod process
[04:42:09] <nevan> ?
[05:48:28] <fatih> hi all
[05:48:44] <fatih> I want to update 20 documents at once, each have different id
[05:48:52] <fatih> I want to update a single field to the same value
[05:49:23] <fatih> what is the preferred way to do this? update with multi selects only for one selector
[05:49:35] <fatih> however I have 20 different ids
[06:11:13] <nevan> nobody answers in thi channel or may be all are like me :)
[06:20:55] <joannac> nevan: do the mongod logs show anything
[06:21:16] <joannac> fatih: how do you know which 20 you need to update? do they have something else in common you can use?
[06:21:21] <joannac> otherwise you could use $in
[06:22:15] <fatih> joannac: I have a list already, a list of id's
[06:25:14] <nevan> no logs doesnt show anything
[06:27:01] <nevan> except socket error
[06:27:17] <nevan> though no. of connections were low at that time
[06:35:37] <jhonkola> I have some queries take extremely long in both mongodb 2.4.10 and 2.6.1
[06:36:42] <jhonkola> Documents have 10 fields, I query with full document, there are 3 compound indexes all covering 2 fields
[06:37:31] <jhonkola> Query for single document can take up to 11000 seconds
[06:43:18] <jhonkola> when calling explain() on long running example query it seems to find the indexes nicely
[06:45:14] <joannac> okay...
[06:45:35] <joannac> how many documents are you returning?
[06:45:41] <joannac> what does the explain look like?
[06:46:54] <jhonkola> {
[06:46:54] <jhonkola> "cursor" : "BtreeCursor identifier_1_time_-1",
[06:46:54] <jhonkola> "isMultiKey" : false,
[06:46:54] <jhonkola> "n" : 1,
[06:46:54] <jhonkola> "nscannedObjects" : 2,
[06:46:57] <jhonkola> "nscanned" : 2,
[06:46:59] <jhonkola> "nscannedObjectsAllPlans" : 14,
[06:47:02] <jhonkola> "nscannedAllPlans" : 41,
[06:47:04] <jhonkola> "scanAndOrder" : false,
[06:47:07] <jhonkola> "indexOnly" : false,
[06:47:09] <jhonkola> "nYields" : 2,
[06:47:12] <jhonkola> "nChunkSkips" : 0,
[06:47:14] <jhonkola> "millis" : 107,
[06:47:17] <jhonkola> "indexBounds" : {
[06:47:19] <jhonkola> "identifier" : [
[06:47:22] <jhonkola> [
[06:47:23] <joannac> dude, pastebin
[06:47:24] <jhonkola> -136789410,
[06:47:27] <jhonkola> -136789410
[06:47:29] <jhonkola> ]
[06:47:32] <jhonkola> ],
[06:47:34] <jhonkola> "time" : [
[06:47:37] <jhonkola> [
[06:47:39] <jhonkola> ISODate("2014-05-22T19:57:01Z"),
[06:47:42] <jhonkola> ISODate("2014-05-22T19:57:01Z")
[06:47:44] <jhonkola> ]
[06:47:47] <jhonkola> ]
[06:47:49] <jhonkola> },
[06:47:52] <jhonkola> "server" : "ip-10-82-5-216:27017",
[06:47:54] <jhonkola> "filterSet" : false
[06:47:57] <jhonkola> }
[06:47:59] <jhonkola> returning one (or none) document, purpose is to check for possible duplicates
[06:48:02] <jhonkola> just a second
[06:48:02] <joannac> that shows 107milliseconds to service that query
[06:48:12] <Gr1> Hi guys
[06:48:30] <Gr1> Is there any way to track when was the last re-indexing done for a collection
[06:48:31] <Gr1> ?
[06:48:46] <joannac> check the logs, if they go back that far
[06:49:04] <jhonkola> yes, but exact same query has been running for ~400 secs
[06:49:21] <jhonkola> I copy-pasted the query expression from db.currentOp()
[06:50:20] <jhonkola> explain output is on http://pastebin.com/pLMw92hq
[06:50:49] <jhonkola> What should I look for in the logs
[06:51:09] <jhonkola> last night I could not find anything suspicious
[06:51:32] <joannac> no idea, but mongodb is servicing the query in 107ms
[06:56:50] <jhonkola> http://pastebin.com/rDn3e2gP contains currentOp() output of the same query I ran from shell that had taken 163 seconds when I ran currentOp()
[06:57:06] <jhonkola> some parameters were replaced with aaa...
[06:58:23] <jhonkola> could the reason be that sometimes mongod fails to find suitable index for query
[06:58:40] <jhonkola> then the long running time would make sense as the collection is large
[07:00:03] <nevan> ?
[07:01:39] <joannac> jhonkola: yes, that's possible
[07:02:25] <joannac> that's a massive number of yields
[07:03:12] <joannac> what else is running on that system?
[07:04:52] <jhonkola> It is storing data from sensor network
[07:05:24] <jhonkola> lot of messages coming from aws SQS and then inserted to wait for further processing
[07:07:19] <jhonkola> there are enough queries that if index determination fails even occasionally it will be a problem
[07:10:04] <joannac> your writes might be starving out reads?
[07:12:47] <jhonkola> the problem that follows from long running queries is that the message writers eventually all block while waiting for query to finish
[07:13:11] <jhonkola> thus after a short while all message writers are stuck on query
[07:16:27] <jhonkola> Also during the problem query there is lot of disk activity, looks like mongodb is scanning the entire collection
[07:16:42] <jhonkola> there are no other processes running in the computer
[07:16:59] <joannac> hmm
[07:17:10] <joannac> doesn't fit
[07:17:21] <joannac> you sure you're explaining the same query that's stuck?
[07:17:38] <joannac> the query you're explaining scans 2 documents
[07:17:59] <jhonkola> could have been one of the other ones that were running at the same time
[07:18:27] <jhonkola> I'll get you a new explain shortly
[07:34:14] <jhonkola> http://pastebin.com/kX0neisX there is currentOp() and explain for 2 longest running queries (sorry for needing to obfuscate some values, might make it harder to understand)
[07:37:57] <rspijker> jhonkola: what’s the question?
[07:43:06] <jhonkola> some queries take long time (up to 10000s seen)
[07:43:21] <jhonkola> there should be index available and explain finds that
[07:44:10] <jhonkola> when looking at currentOp() when query is stuck and doing same query from shell explain reports reasonable values
[07:46:58] <rspijker> well… looks like some of them are alreay spending >8s to acquire a lock...
[07:47:06] <rspijker> could it be your DB is very heavily loaded?
[07:48:36] <jhonkola> it has lot of query + insert pairs, query to determine if doc exists, if not then insert
[07:48:56] <rspijker> your explain queries have no results…
[07:49:02] <rspijker> you only index 2 fields
[07:49:06] <jhonkola> insertions come from SQS (no uniqueness guarantee there)
[07:49:21] <rspijker> if your explained query uses values for the indexed fields that already yield no results, they are going to be very fast
[07:49:49] <jhonkola> Yes, and the 2 fields should be sufficient to narrow the search set
[07:49:53] <rspijker> if your ‘real’ queries use values for those fields that yield a resulting set of millions of documents, which you then have to narrow down by the unindexed fields, that’s going to be sloooow
[07:50:05] <rspijker> are you certain of this?
[07:50:17] <rspijker> your explains currently don’t proof that
[07:50:18] <jhonkola> no, the 2 fields should be enough (timestamp at second level)
[07:50:44] <jhonkola> the timestamp alone should narrow down to some 10 or so documents
[07:50:55] <jhonkola> identifier to a few documents
[07:51:09] <jhonkola> meant to say identifier with time to a few documents
[07:51:18] <rspijker> so, if you run an explain on the exact same query that is currently in currentOps it also runs really fast?
[07:51:47] <jhonkola> yes. when I tried to run normal query it got also stuck
[07:52:09] <jhonkola> this setup has been running fine until last week
[07:52:16] <rspijker> what do you mean by that?
[07:52:26] <rspijker> “when I tried to run normal query it got also stuck:
[07:53:02] <jhonkola> when I copied the query expression from currentOp() output and ran it on shell
[07:53:15] <jhonkola> from op that had taken over 100s already
[07:54:26] <rspijker> yes?
[07:54:30] <rspijker> that didn’t work either?
[07:54:42] <jhonkola> no
[07:55:01] <rspijker> … stop giving me ambiguous answers please
[07:55:19] <jhonkola> that did not work
[07:55:23] <rspijker> thanks :)
[07:56:10] <jhonkola> Could the cause be that query planner fails occasionally, then the long running times would make sense as the collection is large
[07:56:22] <rspijker> ok, so couyld it be that the index does not narrow that down enough?
[07:56:38] <rspijker> take the query that fails on the shell as well
[07:57:15] <rspijker> what happens if you do a count on the 2 indexed fields for the specific values in that query?
[07:58:02] <rspijker> so, if your query was aaa:xxx, bbb:yyy, … ,time: timeVal, indetifier: idVal, … then do a count on {time:timeVal, identifier:idVal}
[07:58:32] <jhonkola> for one in pastebin, count was 1 which is expected
[07:58:57] <jhonkola> the same setup with same indexes etc. has been working fine until this week
[07:59:35] <jhonkola> the load has increased which may just have brought underlying problem to light
[08:00:30] <jhonkola> I guess I'll next try to work around the problem by checking uniqueness of documents by querying only on identifier and time
[08:00:50] <jhonkola> then at least indexes should work ok
[08:02:05] <jhonkola> rspijker and joannac, thanks for help
[08:02:30] <rspijker> sure, weird problem though :/
[08:28:04] <monu> Hey evereyone
[08:28:54] <monu> I'm facing an issue with my sharded clusters, the secondary node on one of my replicat set crashed due to some hardware issue.
[08:29:17] <monu> In other to fix it, i've replace the secondary node by an new and fresh node
[08:29:42] <monu> So how can i reconfigure my sharding reconfiguration ?
[08:30:41] <monu> So how can i reconfigure my sharding configuration ?
[08:31:06] <monu> the sharded cluster is running on mongo 2.0.2
[10:07:56] <sn0lan> morning
[10:08:03] <Jadenn> something is seriously stuffed up with mongos logic engine...
[10:08:28] <sn0lan> Can anyone give me a hand with a mongo issue im having? Bit of a newbie with it.
[10:08:34] <Jadenn> i have a simple query, namely [ '$and' => [ [ 'location' => $location ], [ 'enabled' => 1 ], [ '$or' => [ [ '$or' => [ [ 'start' => [ '$lte' => time() ] ], [ 'start' => 0 ] ] ], [ '$or' => [ [ 'end' => [ '$gte' => time() ] ], [ 'end' => 0 ] ] ] ] ] ] ];
[10:08:52] <sn0lan> I have done a find({ 'email': 'test@test.com'}) and this returns a cursor for me.
[10:09:01] <sn0lan> But When I try to updateit, it wont let me.
[10:09:03] <Jadenn> now, 'end' => [ '$gte' => time() ] is false, but the query is still returning results
[10:10:53] <Jadenn> oh i know what i did
[10:11:04] <Jadenn> missed an $or
[10:12:13] <sn0lan> Anyone any idea?
[10:26:53] <Jadenn> yeah! in your face mongo. i just whooped your logic engine in the butt
[10:35:18] <rspijker> sn0lan: what are you trying to do exactly?
[11:44:46] <kas84> guys
[11:45:23] <kas84> I am getting the following error while trying to remove with filter
[11:45:28] <kas84> in node
[11:45:32] <kas84> http://pastie.org/9202171
[11:45:37] <kas84> any idea why?
[11:46:28] <kas84> I am able to do a find but not a remove
[11:46:54] <kas84> can you use $filters in remove functions?
[11:48:44] <rspijker> in a regular .remove you can
[11:48:47] <rspijker> no clue about node
[11:48:50] <Jadenn> kas84: looks like a typo. it thinks that you want to find a key called $gte
[11:48:52] <rspijker> I would guess it’s a suntax thing
[11:49:12] <kas84> yep
[11:49:19] <kas84> tested it out in mongo and works just fine
[11:51:08] <Jadenn> iirc the syntax is not the same for node
[11:51:23] <Jadenn> then again i could never knew the difference between { and [ for arrays
[11:51:34] <Jadenn> s/could/
[12:12:52] <kas84> turns out it was a bug in node driver
[12:12:59] <kas84> it’s fixed in 1.4.5
[12:13:00] <kas84> :D
[12:18:32] <Jadenn> my favourite day http://puu.sh/8XIlu.png
[12:18:46] <Jadenn> its like a ginourmous mysql cruft weight was lifted off me
[12:31:04] <Veejay> Hi, we're thinking of upgrading from 2.4 to 2.6, I had a look at the changelog for 2.6 and I couldn't find any major changes that would break anything
[12:31:13] <Veejay> Does anyone have messages of caution in that regard for me?
[12:31:23] <Veejay> Something I should be aware of?
[12:34:41] <tscanausa> I never trust software that isnt on its 5th patch
[12:35:19] <Veejay> tscanausa: You mean 2.6 is still young?
[12:35:30] <tscanausa> Quite
[12:36:02] <tscanausa> It was released april 8th
[12:55:33] <hglattergotz> Anyone familiar with geo spatial search performance issues? Have a 2dsphere index on 900K recs (US and Canada) with GeoJson Point. Queries with $maxDistance greater than 100 miles are very slow. 200 miles takes over 20 seconds.
[14:56:49] <BrianJ> Does a replica set just mean having 2 mongodb instances?
[14:57:12] <BrianJ> that are running under the same set of config servers
[15:16:37] <Lujeni> BrianJ, u must read the doc :)
[16:30:58] <doug1> how can I run mongos in foreground and get log output to screen?
[16:46:44] <doug1> I'm trying to create an admin user with mongo. Where do I run the db.createUser() command? The mongos? The config server? The shards?
[16:47:12] <IndianaJoe> doug1 - run from mongo - the command line interface
[16:47:28] <doug1> IndianaJoe: On which instance? the one running mongos or another?
[16:48:19] <IndianaJoe> not sure. I'm not using sharding. On a replicaset, it needs to be the primary
[16:48:40] <doug1> IndianaJoe: I have a cluster set up. I created the key file... modified mongodb.conf on all instances and restarted. See errors about auth in logs now. I suppose that's expected. Went to mongos box, added user, it was accepted. Now when I try and login to mongo with mongo -u ddd -p ddd i get a socket exception error
[16:49:07] <doug1> The mongo docs don't say which box to run these commands on
[16:49:15] <IndianaJoe> hmmm
[16:49:33] <doug1> yep
[16:49:43] <IndianaJoe> all I can suggest is to look in the logs.
[16:50:07] <doug1> don't need the logs... I got this :) rror: 13106 nextSafe(): { $err: "error creating initial database config information :: caused by :: socket exception [CONNECT_ERROR] for s1r1/mongo-shard-s1-n1.prod.slicetest.com:2701...", code: 11002 } at src/mongo/shell/db.js:1210
[16:50:29] <doug1> ran it on the primary shard... user created. still can't login to mongos. grrr
[16:50:49] <doug1> and I can log into the primary shard with auth. I don't get it
[16:50:55] <doug1> oops without auth
[16:52:12] <IndianaJoe> i would still look into the logs on the primary - it should give the reason for the early socket termination
[16:52:27] <doug1> IndianaJoe: That error was on the mongos box
[16:53:09] <IndianaJoe> ok
[16:53:44] <doug1> it makes no sense to run it on a shard box I think
[16:54:01] <doug1> but, the docs don't say where to run it. All they say is 'run mongod'
[16:54:19] <doug1> maybe I need to run on the config server.... why not....
[17:17:10] <Fetch> I've read some docs/slideshares about setting mongodb on AWS, but I need some conceptual help. I want to present a single DNS name (mongo.foo.bar) for my internal clients to access for a mongo replica set. If I setup mongo.foo.bar to point to an ELB in front of the replica set, is the client going to get the full seed list from the first server the ELB shuffles it off to? (that would be great) Is a better solution to have each replica set member create an A
[17:24:26] <kali> Fetch: just don't do that.
[17:25:11] <Fetch> kali: what is a solution to have a single DNS name be effective for connections to a mongodb replica set, then?
[17:25:42] <doug1> oh yeah... reminds me... with two routers... what would I typically put in front? a load balancer or would round robin DNS do? is this stateless or not?
[17:28:37] <kali> Fetch: it's a very bad idea. the mongo client and server exchange adresses of replica set members to be ready to switch over or adresse a secondary.
[17:28:38] <Fetch> kali: alternatively, I run a zookeeper cluster, so I could have replica set members add themselves to a config space there, if there's any real client support for that
[17:29:27] <kali> Fetch: not that i know of
[17:30:33] <Fetch> kali: so, generally speaking, everyone keeps their mongo clients configured with a full array of replica set members?
[17:31:23] <kali> Fetch: more or less. but you don't need the array to be exact. as soon as the client manage to connect to one working member, it will pull the actual configuration from the replica set
[17:33:16] <kali> Fetch: you can imagine to have one dns alias that you use to configure the client, a CNAME pointing to one member. the client will connect and pull the full correct config when starting
[17:34:18] <kali> Fetch: but if your "special" node is down, a new client will fail to start. better to list all the replicas in the configuration string to the best of your knowledge, and let mongo adjust what's wrong
[17:34:29] <Fetch> kali: what would be the issue with having multiple entries for the same CNAME record? The client would pull one at randomly, connect, and pull a proper config
[17:35:44] <kali> Fetch: and if it pulls a broken one, you need to wait for a timeout
[17:36:31] <doug1> I'm trying to set up auth... where would I typically run the addUser() command? the shard? the config server? the mongos? the docs don't say
[17:48:28] <MTughan> I'm making a python program to help set up a sharded cluster and am trying to find a way to determine if a database and a collection has been sharded. I don't see any commands to do this in the Python API or in the database commands section, although the shell makes this available through sh.status().
[17:48:38] <MTughan> How can I get that info from Python using PyMongo?
[17:50:18] <doug1> i just dont get it. Which instance in a cluster do I run admin commands on?
[17:50:50] <MTughan> doug1: Typically mongos. That will modify the config servers as necessary.
[17:51:07] <doug1> MTughan: kinda what I figured but wasn't clear. thanks
[17:56:34] <doug1> so... I added the admin user on mongos box. Seems to work... also seems to have 'replicate' to config server.... but the shards I can still mongo to without a password...
[17:56:55] <MTughan> Yes.
[17:57:20] <MTughan> I don't actually know how users are supposed to propagate, so maybe I shouldn't say anything…
[17:57:40] <doug1> very strange.
[17:58:16] <doug1> I tried to connect from the config server box to the shard box, and auth denied. Ok... so I did it again passing in user/pass and it fails. Huh?
[17:59:25] <doug1> works tho from shard to config box... so obviously the user isn't being replicated to shards (but it is to config server)
[18:23:47] <MTughan> I'm making a python program to help set up a sharded cluster and am trying to find a way to determine if a database and a collection has been sharded. I don't see any commands to do this in the Python API or in the database commands section, although the shell makes this available through sh.status(). Is it possible to get that from Python without querying the config database?
[18:56:44] <jbrechtel> Is there a 'right way' to create mongo users using the Ruby mongo driver? I'm finding db.eval() to be a painful way to do it. In particular, I'm unable to create a second user after I create an admin because I get an 'unauthorized' error.
[18:57:19] <jbrechtel> I've tried authenticating as the admin after I do that but then I still get unauthorized. Am I perhaps racing with the create action by executing the authentication immediately following the create?
[18:57:44] <IndianaJoe> once you have created the first[admin] user, you'll need a db.auth() before you can create others
[18:57:56] <jbrechtel> To be clear, when I try to authenticate as an admin after creating the admin I get unauthorized on the db.auth() for the admin user I just created
[18:58:17] <jbrechtel> I can later log in via the console as that admin user though.
[18:58:21] <IndianaJoe> you've got a problem with your Roles
[18:59:10] <jbrechtel> hmm.... I'm using these: ["userAdminAnyDatabase","readWriteAnyDatabase","clusterAdmin"] ...and mongo 2.4
[18:59:16] <jbrechtel> Maybe I'm using 2.6 roles by accident
[18:59:41] <IndianaJoe> those look fine?
[19:00:09] <IndianaJoe> those look fine. using 'admin' database?
[19:01:08] <jbrechtel> Yes
[19:01:25] <jbrechtel> I should mention that I'm using a replicaset
[19:01:29] <jbrechtel> and am connected to the primary
[19:01:49] <IndianaJoe> hmm
[19:28:13] <jbrechtel> Is eval even the right way to do this?
[19:28:17] <jbrechtel> https://gist.github.com/jbrechtel/603475bc8b03e020203c
[19:29:12] <jbrechtel> Contrary to what I said earlier, authenticate does not fail. authenticate DOES fail if I try db.eval(db.auth()) but db.authenticate() does not fail. However, even with db.authenticate() the subsequent adduser fails.
[19:29:29] <jbrechtel> at this point I feel like I should just shell out to the command line
[19:41:40] <jbrechtel> I don't know why I care about creating that user in the admin database. The annoying thing seems to be trying to authenticate as an 'any database' admin with the Ruby driver. The authentication, for whatever reason, doesn't seem to carry to operations across databases. It's not the same as doing a 'use someotherdb' after authenticating in the mongo console.
[19:41:53] <jbrechtel> If I just create my admin user in my appDb then everything works fine.
[20:14:16] <ekristen> I’m trying to dump documents from a collection where a date is great then and less then two dates
[20:14:26] <ekristen> the query works and count returns a number I’d expect
[20:14:38] <ekristen> but when I go to run mongodump, it wants to dump the entire contents of the collection
[22:46:32] <PXER> Mac OS Mongo installation of 2.6: Every executable is around the same size. What gives with that?
[22:47:03] <federated_life> PXER: must be a human cron job
[22:48:14] <PXER> I've looked at your statement like 5 times and can't make sense out of it.
[22:48:18] <PXER> :)
[23:46:52] <ngoyal> with the node/js driver, is the native parser a lot more performant?