PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 21st of August, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:20:20] <jasondockers> Can I fix bad utf8 with mongo?
[01:27:24] <joannac> define "fix"
[01:32:45] <topwobble> rebuilding indexes takes forever!
[01:33:47] <Boomtime> yep
[01:39:08] <topwobble> I had to do a repair on our db
[01:40:46] <topwobble> the indexes seem to be rebuilt, but simple mongo queries that should use indexes are taking a long time (minutes)
[01:41:05] <topwobble> .explain() shows that it used an index too
[01:45:51] <topwobble> Index queries are taking a long time, depsiting using the index. Any thoughts?
[01:46:10] <topwobble> here’s the explain() of a find() https://gist.github.com/objectiveSee/c979f3676089dcd94e4a
[01:48:44] <Boomtime> "(11:46:51 AM) topwobble: I had to do a repair on our db"
[01:48:51] <Boomtime> are you running a replica-set?
[01:49:09] <topwobble> Boomtime: no, we just repaired the db
[01:49:39] <topwobble> running the find() takes ~3 min. Running it again took 10 seconds, running a third time took ~4 seconds
[01:49:51] <Boomtime> you know that repair might delete documents right?
[01:50:06] <topwobble> Boomtime: yes, thats fine
[01:50:10] <Boomtime> meanwhile, your query is on a boolean field?
[01:50:22] <topwobble> but we rebuilt all our indexes, so not sure why it was so slow
[01:50:31] <Boomtime> because the index doesn't do anything
[01:50:38] <Boomtime> what do you expect it to do?
[01:50:38] <topwobble> why not?
[01:50:52] <topwobble> queries on indexed fields are faster
[01:50:53] <Boomtime> because the cardinality is 2
[01:51:11] <Boomtime> no, indexes on HIGH cardinality fields are faster
[01:51:34] <topwobble> hmm. i actually dont understand that :D
[01:51:44] <Boomtime> "nscannedObjects" : 2559492,
[01:51:57] <Boomtime> your query matches 2 million documents
[01:52:13] <Boomtime> the index certainly found those 2 million documnents pretty damn fast
[01:52:19] <Boomtime> then what?
[01:53:14] <topwobble> isn’t that it?
[01:53:19] <Boomtime> do you seriously need to find 2 million documents and return them to the client?
[01:53:37] <Boomtime> and you expect that to be fast?
[01:53:38] <topwobble> Boomtime: no. this was just a test to ensure that our indexes are working before we turn our game server live again
[01:53:51] <Boomtime> that index is pointless, delete it
[01:54:05] <stefandxm> topwobble: what Boomtime is trying to say is; indexes will only make sense if you use them with constraints
[01:54:09] <stefandxm> topwobble: or sorting
[01:55:58] <stefandxm> toothrot: think of indexes as presorted data. if you have one million random numbers spread out in a file and add constraint number > 3 and number < 1 million it will have to loop through all numbers because there is no order. if you add an index it will be able to jump to 3 and start the loop linear.
[01:56:27] <stefandxm> toothrot: but if you take all of them, ie 0..max it will loop through the same amount of data anyways
[01:57:01] <stefandxm> of course, if you want them sorted, then the index can help, because then it is presorted so no extra sorting is required
[02:05:47] <topwobble> stefandxm: i thought you cant do an index on a range
[02:06:12] <stefandxm> dont think of it as a range
[02:06:23] <topwobble> We use indexes with constraints… just in this example I was not using them to excersise the existense of indexes
[02:06:28] <stefandxm> the range is just because you make constraints
[02:06:49] <stefandxm> but since you are not using constraints, the index will not be used
[02:06:54] <stefandxm> since it will not matter
[02:10:59] <topwobble> a query like : {foo: {$gt:3, $lt :1000} is compound and can’t be indexed… if i am not confused
[02:13:15] <joannac> No, you're quite confused
[02:13:23] <joannac> If you have an index on foo
[02:14:13] <joannac> you can use that index, find the first entry for which foo > 3, continue reading index entries until the one where foo > 1000, and bam, you're done
[02:14:25] <joannac> and you only looked at index entries and documents that match your query
[02:15:08] <topwobble> cool thx. that would be much better ;)
[03:12:40] <d0tn3t> i'm setting up replica mongodb, i set my server1 is Primary but after i use rs.initiate(....) my server1 become SECONDARY
[03:12:50] <d0tn3t> anyone can help me
[03:14:23] <joannac> what's the ... inside your rs.intitiate()?
[03:14:50] <joannac> also, what's the output of rs.status()?
[03:14:59] <joannac> (pastebin both please)
[03:29:41] <d0tn3t> http://pastebin.com/0Q6tXA51
[03:29:45] <d0tn3t> help me
[03:33:06] <joannac> output of 'mongo 192.168.100.222:27017 --eval 'db.version()'
[03:33:18] <joannac> and output of rs.status() again since that one seems to be cut off
[03:36:59] <d0tn3t> what??
[03:37:41] <d0tn3t> what command i must try?
[03:37:54] <joannac> mongo 192.168.100.222:27017 --eval 'db.version()
[03:37:59] <joannac> rs.status()
[03:38:15] <d0tn3t> ok
[03:39:49] <d0tn3t> my version i 2.6.4
[03:40:13] <d0tn3t> rs.status dose seem before
[03:41:23] <joannac> for the second time, your first rs.status() is cut off. please pastebin a new one
[03:42:37] <joannac> also, the aim is to verify you can connect from your first host 192.168.100.111 to your second host 192.168.100.222
[03:42:40] <d0tn3t> http://pastebin.com/t1sSPzz6
[03:42:56] <d0tn3t> connect ok
[03:43:06] <Boomtime> cut off again... srsly?
[03:43:34] <d0tn3t> http://pastebin.com/t1sSPzz6
[03:44:06] <joannac> okay, pastebin the last 100 lines of your mongod log on 192.168.100.111
[03:44:20] <d0tn3t> ok
[03:47:03] <d0tn3t> http://pastebin.com/5D4CykvM
[03:50:26] <joannac> yeah, I'm not convinced your nodes can talk to each other
[03:50:52] <d0tn3t> ok, tks
[03:53:10] <d0tn3t> what must i do to make my SECOnDARY node become PRIMARY???
[03:54:18] <joannac> make sure they can talk to each other
[03:57:43] <d0tn3t> my nodes can talk together
[03:57:55] <Boomtime> they really can't
[03:58:03] <d0tn3t> yes
[03:58:33] <d0tn3t> Boomtime > can u help me
[03:58:55] <Boomtime> joannac has already told you what you need to know
[03:59:13] <Boomtime> the two members of your set cannot talk to each other
[03:59:44] <Boomtime> either an address is wrong, or a port, or one of them isn't running, or a firewall is blocking them, or some other network problem
[04:00:24] <Boomtime> the members of your replica-set cannot see each other, that is all we can know, you must investigate why
[04:01:00] <d0tn3t> ok, tks, i will investigate now
[04:03:07] <d0tn3t> tks all
[04:03:09] <d0tn3t> :D
[04:11:41] <d0tn3t> tks
[04:23:06] <topwobble> I can’t even drop a collection if it’s corrupt. `db.collection.drop()`
[04:25:44] <topwobble> https://gist.github.com/objectiveSee/2bae662dbaa90e16adef
[04:28:03] <topwobble> Can I delete a collection directly from the file system
[04:28:14] <topwobble> Since db.collections.drop() fails
[04:28:46] <Boomtime> no, you should tell us why collection.drop() fails
[04:29:18] <Boomtime> erk, in that link?
[04:29:44] <Boomtime> is this a replica-set?
[04:30:27] <topwobble> Boomtime: https://gist.github.com/objectiveSee/7fd98829efcf36fcd4ce
[04:31:07] <Boomtime> is this a replica-set?
[04:31:45] <topwobble> Boomtime: no it is not
[04:32:21] <Boomtime> http://docs.mongodb.org/manual/reference/method/db.repairDatabase/
[04:33:22] <topwobble> I just started running that. I estimate it’ll take hours on a 30GB db
[04:33:31] <Boomtime> probably
[04:33:44] <topwobble> with 16 CPUS even
[04:34:12] <Boomtime> it's largely IO bound, like most database operations, so yeah, probably
[04:47:38] <AlecTaylor> hi
[04:48:45] <joannac> hi
[04:48:53] <joannac> did you need help with something?
[05:00:18] <AlecTaylor> joannac: Yeah, playing around with map reduce to emulate joins
[05:01:58] <AlecTaylor> fooRec = {‘bar’: ‘can’, ‘haz’: ‘foo’}, barRec = {‘foo’,’can’, ‘haz’,’foo’}; - How do I join the first 50 fooRec’s with their corresponding barRec?
[05:02:19] <AlecTaylor> (assuming same schema as above throughout with no nulls)
[05:08:42] <joannac> how do they correspond?
[05:11:02] <AlecTaylor> joannac: They have equal ‘haz’ values
[05:11:18] <AlecTaylor> fooRec = {‘bar’: ‘can’, ‘id’: ‘foo’}, barRec = {‘foo’,’can’, ‘fid’,’foo’}; - How do I join the first 50 fooRec’s with their corresponding barRec?
[05:11:25] <AlecTaylor> ^That may make it easier
[05:11:48] <Boomtime> are these in the same collection?
[05:32:19] <AlecTaylor> Boomtime: No, different collections
[05:32:36] <AlecTaylor> (this “join” is rarely required, but when it is I don’t want to kill my db)
[05:34:33] <Boomtime> mongodb does not have joins, you cannot access 2 collections in one operation
[05:35:08] <Boomtime> if this were one collection then what you are doing is trivial using aggregation (though you could do it with map-reduce too)
[05:46:03] <AlecTaylor> Hmm, looking at: http://www.noppanit.com/merge-documents-two-collections-together-mongodb/
[05:48:40] <Boomtime> the relationship between documents is 1:1 ?
[05:49:36] <AlecTaylor> 1:n
[05:50:01] <AlecTaylor> for each orange_id there are multiple pears
[05:51:17] <Boomtime> then the lnked article will not work, it sets the _id of the merge result to a value from the left-hand source, there is no way for the right-hand merge to multiply that by it's own occurrences
[05:52:09] <Boomtime> monogdb does not have joins, you must do at least some of the work on the client, or write a better schema
[05:54:36] <AlecTaylor> Hmm - http://stackoverflow.com/questions/5681851/mongodb-combine-data-from-multiple-collections-in-to-one-how
[05:56:33] <Boomtime> heh, i was about to say that looks like a lot of work, but the author already did:
[05:56:35] <Boomtime> "This technique should definitely not be performed on the fly. It's suited for a cron job or something like that which updates the merged data periodically."
[06:53:41] <AlecTaylor> Ya
[06:55:13] <jdj_dk> Ya
[07:55:02] <Genitrust> Hi everyone!
[07:55:22] <Genitrust> is it possible with mongodb to allow a user to *only* insert new data in the mongodb?
[07:55:33] <Genitrust> (as in, this user is not allowed to edit data...)
[07:57:31] <frsk> Doesn't look like it according to http://docs.mongodb.org/manual/reference/built-in-roles/
[08:06:49] <joannac> http://docs.mongodb.org/manual/tutorial/define-roles/
[08:07:25] <joannac> you could give them "insert" but not "update"
[08:15:41] <Genitrust> joannac: ahhh ty :)
[10:05:48] <cipher__> I'm getting a utf8 decoder failed invalid continuation byte at something the rather from python? I'm trying to load in data from a mongo database, is there a way to repair utf-8 before doing this?
[13:10:23] <tscanausa> can you run repair database on a slave?
[13:15:12] <jordana> why not resync?
[13:21:39] <tscanausa> jordana: I could. I just need to feel up disk space on all of the nodes with out blocking.
[13:21:43] <sfix> hi guys, on the latest build of MongoDB the /var/run/mongodb directory is deleted every time the machine reboots, why's that?
[13:22:02] <tscanausa> because mongo is not running?
[13:23:32] <sfix> tscanausa, that's no reason to delete that directory
[13:24:04] <sfix> it's not created when i try to restart the service
[13:24:22] <jordana> tscanausa, but repairDatabase does block?
[13:25:21] <tscanausa> I dont care about blocking the slaves just not writes to the master. I didnt know if repairDatabase was a master only operation.
[13:25:44] <jordana> tscanausa: no, you can use it on slaves
[13:26:01] <jordana> tscanausa, but you'll need a lot of space to use that method
[13:26:31] <tscanausa> I just emptied all of the collections.
[13:26:39] <emacsen> anyone here use pymongo?
[13:27:12] <jordana> tscanausa: meaning there's no data left inside the collections?
[13:27:21] <tscanausa> jordana: correct
[13:27:39] <jordana> tscanausa: then you should be able to use it. If the database is empty though why don't you just delete the db files?
[13:28:55] <tscanausa> its an analytics cluster where the amount of data get out of hand. I need the indexes to stay around. I used to just drop the entire database, but I cant do that any more.
[13:29:16] <tscanausa> jordana: if you have a recommendation let me know
[13:32:58] <jordana> tscanausa: interesting, how big is the db?
[13:43:23] <sfix> so to ask again, is there any reason why MongoDB no longer creates /var/run/mongod when started?
[14:01:53] <tscanausa> jordana: sorry morning scrum. 150GB
[14:09:38] <dragoonis> Derick, you around ?
[14:11:11] <Derick> sure
[14:11:20] <Derick> just ask your questions though... there are more people here
[14:33:34] <kees_> is it possible to find out what type the data in mongodb is ie: float or int?
[14:49:10] <Derick> kees_: yes, there is a $type operator
[14:49:14] <Derick> kees_: let me find out where
[14:49:45] <Derick> http://docs.mongodb.org/manual/reference/operator/query/type/
[14:52:59] <kees_> thanks
[15:29:06] <jasondockers> I'm using mongo::bsonobjbuilder with std::strings of header and body info from emails. It inserts and looks correct in mongodb, yet python is giving me errors that indicates it's invalid utf8- doesn't the mongo driver ensure it's utf8 encoded, or it can't be inserted?
[15:39:10] <sebastian_o|> hi guys, after upating/upgrading via breew, mongd command doesn't start mongodb anymore here. Any hint in how to get it loading the .conf again?
[15:55:39] <jasondockers> Can I fix utf-8 encoded improperly in mongo documents?
[16:13:17] <kees_> using PHP, what could be the reason for this behaviour?; I'm storing an integer (confirmed with var_dump just before i do save()), but when i retrieve that value i get a float
[16:13:43] <Derick> kees_: how large is the integer?
[16:13:50] <Derick> and, which driver version are you using?
[16:14:01] <kees_> smallish, float(68908)
[16:14:18] <kees_> version 1.5.5
[16:14:32] <Derick> 32 or 64 bit platform?
[16:14:38] <kees_> 64 bits
[16:14:58] <Derick> hmm, makes no sense. Can you show me a very simple script that shows this behaviour?
[16:15:21] <kees_> i'll try to create one
[16:21:51] <sebastian_o|> anybody knows what's the path that mongodb expects to find mongodb.conf by default in a OS X brew installation?
[16:22:05] <Derick> kees_: any luck?
[16:22:29] <kees_> not yet.. if i use the very basics it works, if i use our entire codestack it doesn't :/
[16:22:46] <Derick> :-) That's what I'd figured :)
[16:23:18] <kees_> only started doing that when i upgraded it from php 5.3 to 5.5
[16:25:06] <kees_> and ofc it only happens in production
[16:26:33] <Derick> not sure what advice I can give
[16:39:19] <kees_> well, it isn't a known bug at least :)
[16:41:38] <hubertus> Hi Everyone. I have a question regarding an aggregate problem. I basically have a collection which stores impressions of an article by a visitor. I want to get some stats for a certain article. I have a writeup of my problem here: http://paste.ofcode.org/a6J3Ni4cEbgFWFWCLneJRM Could someone assist me with the question at the end?
[16:50:32] <blizzow> I have a db(mydb) with a few collections within it. The collections are named A,B,C,D... From the mongo shell, how would I remove a specific collection? Say C. I already logged in and did: use mydb. but I'm mildly stumped from there. The db.collection.drop documentation says it takes no arguments and I don't want to drop A,B, or D.
[16:50:50] <cheeser> db.C.drop();
[16:56:57] <jasondockers> Can I export as hex?
[16:58:56] <cheeser> what?
[17:06:19] <jordana> export the bson file and open in hex editor?
[17:14:27] <jasondockers> jordana, does mongoexport use a flag to indicate bson?
[17:14:48] <jasondockers> because I can only export json
[17:15:14] <Derick> mongodump exports to bson
[17:49:45] <hubertus> Hi Everyone. I have a question regarding an aggregate problem. I basically have a collection which stores impressions of an article by a visitor. I want to get some stats for a certain article. I have a writeup of my problem here:  http://paste.ofcode.org/a6J3Ni4cEbgFWFWCLneJRM  basically what I want is to group and count distinct.
[17:50:10] <kees_> Hmpf. got to love the fact how random this is and i still haven't figured it out.. tcpdump shows me inserting a Int64(0x12)46943, and when i query it is get a Double(0x01)46942.. but not always
[17:50:26] <kees_> *46943
[19:17:35] <SkramX> in an aggregate query, how can i round numbers?
[19:36:38] <JonSno> Im new to mongodb land and need advise on how I can easily import my json file into mongodb
[19:37:30] <whaley> JonSno: http://docs.mongodb.org/manual/reference/program/mongoimport/
[19:38:19] <whaley> JonSno: or use one of the api clients if you need to do it programmatically
[19:39:16] <JonSno> currently I have a wordpress site that generates a 124k json file of all posts and pages. I will then import into mongodb
[19:39:33] <dberry> mongodb config server question: I have mongo1,mongo2,mongo3 as my config servers. If I use host files can I change the name to mongo{1,2,3}-cfg (same IP) and restart mongos?
[19:40:22] <JonSno> whaley: that would be my next question, is their a mongodb api for php
[19:40:39] <cheeser> yep
[19:41:08] <cheeser> http://docs.mongodb.org/manual/applications/drivers/
[19:41:18] <whaley> "drivers" not "api clients"
[19:41:58] <cheeser> <austinpowers>oh, behave!</austinpowers>
[19:43:56] <JonSno> cheeser:Im looking to add objects into the db with php
[19:49:41] <jasondockers> can I strip bad utf8 bytes from documents?
[19:49:55] <Zelest> what driver are you using?
[19:49:59] <jasondockers> c++
[19:50:10] <Zelest> then I'm clueless.. was hoping you were using ruby :P
[19:50:33] <meonkeys> a = new ISODate(); b = a; // but a === b is false. Why?
[19:50:53] <meonkeys> whoops, my bad, they are equal.
[19:51:19] <Zelest> jasondockers, string.chars.select{|i| i.valid_encoding?}.join.strip .. if you were using ruby.. can't you do something similar in c++?
[19:51:22] <SkramX> in an aggregate query's project, how do i reach into an array and get just the first item?
[19:53:58] <svinay> hi! In our mongo logs, we see a lot of entries like "insert <our_db_name>.system.indexes keyUpdates:0 locks(micros) w:93" ... does it mean that an index rebuild happened at that instant?
[19:55:05] <svinay> too many such entries, around 1000 such entries in a time span of 50 mins, for a minimal load of around 1000 connections at the max
[19:57:35] <SkramX> i have an array of [lat, lon] - is it possible to index that?
[20:00:21] <meonkeys> (FYI, related to my earlier question: http://stackoverflow.com/questions/25434872/why-are-two-equivalent-isodate-values-not-equal )
[20:02:10] <SkramX> nvm
[20:11:05] <darkpassenger> is there such a thing as "if not found, create, if not found, don't do anything" query ?
[20:11:10] <darkpassenger> dammit
[20:11:15] <darkpassenger> let me rephrase that
[20:11:28] <SkramX> ive always seen that in the application logic
[20:11:50] <darkpassenger> "if not found , insert, if found, don't do anything"
[20:12:00] <darkpassenger> hehe
[20:16:24] <cheeser> insert with a unique constraint?
[20:43:03] <SkramX> how can i ensure an index is being used for a specific aggregate function?
[21:04:44] <cheeser> you can do an explain to check.
[21:17:07] <ngl> Hi all. I'm doing some research and wanting to make an alert system of sorts. I don't mean on mongo metrics, but a simple example would be: A user is expected to log in by a specific time. But, that user failed to login... send alert.
[21:17:51] <stefandxm> use smtp!
[21:18:09] <ngl> Really?
[21:19:17] <ngl> I can use that to send, but can I watch a value within mongo and cause some event... hmm.
[21:21:27] <ngl> I was just trying to utilize mongo, but maybe my idea isn't going to work. I didn't want to keep... ah, I can keep just the next expected "login" in memory and when that is reached I'll do alert and grab the next from mongo.
[21:21:41] <ngl> Thanks :D
[23:13:16] <jaraco> I want to reset the authentication state for a MongoDB instance. Can I simply wipe admin.system.users?