PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 19th of August, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:56:39] <asher^> can anyone advise which user roles are optimal for monitoring/backup?
[02:01:47] <joannac> asher^: https://mms.mongodb.com/help/reference/authentication/
[02:01:58] <joannac> or https://mms.mongodb.com/help/reference/user-roles/
[02:02:13] <joannac> (i'm not sure which side you're asking about roles for)
[02:25:31] <asher^> thanks joannac
[02:26:31] <asher^> I'm running 2.4.9 and I cant seem to create new users for some reason. I'm using a user that has userAdminAnyDatabase on admin but I'm getting the error couldn't add user: not authorized for insert on admin.system.users at src/mongo/shell/db.js:128
[02:26:45] <joannac> are you authenticated?
[02:26:48] <asher^> yeah
[02:27:06] <joannac> use admin; db.system.users.find()
[02:27:07] <asher^> also tried with user with root permissions
[02:27:31] <asher^> { "_id" : "admin.userAdmin", "user" : "userAdmin", "db" : "admin", "credentials" : { "MONGODB-CR" : "3744eb0bff2414bce0f4a9e8c732e9bc" }, "roles" : [ { "role" : "userAdminAnyDatabase", "db" : "admin" } ] }
[02:28:31] <joannac> but adding a user doesn't work?
[02:28:44] <asher^> yeah
[02:29:21] <joannac> what are you typing? (remove the password)
[02:30:45] <asher^> http://pastie.org/9484614
[02:32:34] <asher^> its in a replica set if that makes a difference
[02:32:46] <joannac> are you sure you're on 2.4?
[02:32:52] <joannac> that looks like a 2.6 user
[02:33:08] <asher^> > version()
[02:33:09] <asher^> 2.4.9
[02:33:31] <joannac> db.version()
[02:33:42] <asher^> oh shit.
[02:33:52] <asher^> 2.6.1
[02:34:20] <asher^> thanks, let me try this again
[02:37:14] <asher^> TypeError: Property 'createUser' of object admin is not a function
[02:37:27] <asher^> thats the error that first made me think i wasnt on 2.6
[02:40:17] <asher^> http://pastie.org/9484624
[02:40:21] <asher^> im so confused :-|
[02:40:37] <asher^> what does version() (rather than db.version()) return?
[02:41:11] <asher^> the client version? maybe this is the problem
[02:42:52] <asher^> ok, it was. i feel stupid now. thanks for your help joannac
[04:56:46] <user123321> Is it really impossible to make a replica using only 2 DB servers?
[04:57:13] <user123321> I would just like to make the backup DB come active immediately when the main goes down.
[04:59:14] <joannac> user123321: the way replication works in mongodb, yes
[04:59:53] <joannac> benefit: no split brain. downside: can't auto-failover with only 2 hosts
[05:00:25] <user123321> joannac, I was going through the mongodb docs, and I read that I need a minimum of 3 DB servers, OR, 2 Db servers + arbiter :/, any advice?
[05:01:01] <joannac> what kind of advice are you looking for?
[05:01:08] <joannac> I recommend what the docs say
[05:09:21] <user123321> joannac, So I should not go with 2 DB servers only? (without even an arbiter)
[05:12:58] <Boomtime> it is not recommended, having 2 servers will mean that (by default) you are dependant on both of them being up or no primary will exist
[05:13:03] <joannac> No, having an even number of nodes can cause problems if you ever need to elect a new primary
[05:14:04] <user123321> Oh ok, so an arbiter would do the job for me right? Thanks :D
[05:17:09] <joannac> well, it would help you in elections
[05:19:06] <user123321> Cool
[08:45:38] <prologic> Anyone had a chance to look over https://gist.github.com/therealprologic/c85697889f0f834180ce ? I asked before and I'd appreciate if anyone has either run into this or can give me some direction to fixing this particular edge-case I've run in to?
[09:04:55] <Siyfion> I have an array of objects that I am allowing the user to modify, I (ideally) want to be able to $push and $pull objects into the same array... However I get the "have conflicting mods in update" issue...
[09:05:20] <Siyfion> Is there a better way of doing this, other than splitting the update operation into two separate queries?
[09:06:00] <Siyfion> (The only other way I can think of is to overwrite the array entirely with the new set... but it's a bit inefficient?)
[09:10:50] <Siyfion> My query: https://gist.github.com/Siyfion/615e68b4ebc72e25c2c3
[09:51:00] <rspijker> I think I’m going insane… Why does db.coll.find({“field”:{$not:/value/}}) say no results, yet db.coll.count({“field”:{$not:/value/}}) gives me 11000?
[09:56:37] <rspijker> so… if I do db.coll.find(…).count() it still gives me 11000
[09:56:48] <rspijker> db.coll.find(…).hasNext() is false though
[09:56:49] <Derick> indexes?
[09:56:56] <rspijker> only the default
[09:57:15] <rspijker> so, _id
[09:57:22] <rspijker> which is not what I’m querying on
[10:00:37] <rspijker> an explain on the find also tells me it uses a BasicCursor and the nScanned corresponds to the number of docs in the collection, n is also the same as the count. Yet the cursor is empty and there are no actual results to be had
[10:01:23] <Derick> rspijker: sounds like a bug then? running the latest version? :-)
[10:01:40] <rspijker> Derick: 2.4.10
[10:02:13] <Derick> hmm
[10:02:49] <Derick> rspijker: I think you might want to put this in a jira ticket :S
[10:03:18] <rspijker> Derick: yeah, I was beginning to suspect I was, in fact, not insane. Good to have some confirmation :)
[10:15:38] <rspijker> hmmm, it does work (the mecahnism) on different collections on the same DB system
[10:15:56] <rspijker> as in, $not:{/regex/}
[10:29:28] <bin> guys is it just me or i can't any info in docs about batch inserts
[10:48:19] <Siyfion> Anyone able to suggest anything on my question?
[11:11:09] <rspijker> Siyfion: fairly sure you have to use 2 queries
[11:11:37] <Siyfion> rspijker: Okay, that's kinda my first thought, just a shame, as it means that it's not atomic :/
[11:11:37] <rspijker> bin: they’re called bulk inserts: http://docs.mongodb.org/manual/core/bulk-inserts/
[11:11:46] <bin> yeah yeah cheers ;) i found them out :)
[11:27:28] <rspijker> Siyfion: vote for this, I suppose: https://jira.mongodb.org/browse/SERVER-1050
[11:27:29] <durre> hey! if I want to query a field case insensitively with regex, will I be using the index then?
[11:28:29] <Siyfion> rspijker: Thanks for pointing that out :D
[11:30:21] <rspijker> durre: well… depends on how you define using...
[11:30:39] <rspijker> it will (I think) use it to match against, as in, match against the index instead of the actual documents
[11:31:00] <rspijker> not sure if it will do ranging, even if you;re using a prefix regex
[11:32:33] <durre> what I'm trying to decide is. If I have a collection with 4 million documents, will a regex query be troublesome? the alternative is storing a lowercase representation
[11:32:50] <kali> durre: go for LC
[11:33:03] <rspijker> fairly sure the case insensitive version can’t use an index...
[11:33:09] <kali> yes
[11:33:26] <kali> and the regexp will only work with the index if you search by fixed prefix
[11:33:38] <durre> cool, I'll go that route then :)
[11:33:40] <kali> something in the form of /^kali/
[12:04:19] <Viesti> hmm
[12:05:20] <Viesti> trying to switch the primary of my replica set
[12:05:53] <Viesti> doing "rs.reconfig" on the current primary gives me this: exception: initiation and reconfiguration of a replica set must be sent to a node that can become primary
[12:06:14] <Viesti> doing the same on a secondary gives me this: replSetReconfig command must be sent to the current replica set primary.
[12:06:17] <Viesti> wat? :)
[12:12:24] <Viesti> am I missing something? :)
[12:13:33] <Viesti> just wanted to specify which of the secondaries becomes primary
[12:14:22] <kali> Viesti: show us a rs.config(), a rs.status() and what you tried to do
[12:14:32] <kali> Viesti: on gist or partie
[12:14:41] <kali> pastie
[12:18:13] <Viesti> here's what I did on primary: http://pastebin.com/Bg1vzVQv
[12:19:31] <Viesti> and on secondary: http://pastebin.com/AqDuwrCD
[12:22:50] <kali> Viesti: i did not know about that. reconfig accepts a "force" argument that may help
[12:23:35] <kali> Viesti: or you try it in two step. first remove the priority on the current primary, then add it on the new wanted primary
[12:24:56] <Viesti> hmm that might be it
[12:25:00] <Viesti> let me try :)
[12:27:57] <Viesti> odd, same thing
[12:28:00] <Viesti> so maybe force then
[12:31:26] <Viesti> https://jira.mongodb.org/browse/SERVER-3815
[12:31:43] <Viesti> there's a ticket for that, doh
[12:32:15] <Viesti> I guess I should not have used priority value 2...
[12:40:30] <chris31jct> hi all
[12:41:01] <chris31jct> looking for some help with connection string issue. anyone wanna help?
[12:43:13] <tscanausa> chris31jct: I recommend just telling everyone one what string are using and what error you are getting.
[12:43:32] <chris31jct> i'm trying to connecto mongodb to informatica cloud
[12:44:56] <chris31jct> i don't know my url for the connector requirement. mongodb is all new to me, but i have a client requesting to use informatica cloud for interacting between salesforce and mongodb
[12:45:59] <chris31jct> i just installed mongodb, created a collection of Accounts and now I can't see it at Informatica Cloud
[12:47:29] <tscanausa> https://community.informatica.com/mpresources/docs/Userguide_2368.pdf ?
[12:47:54] <chris31jct> been there. i figure url default is http://localhost:8080/query
[12:49:33] <chris31jct> i test the connection and infa cloud says its fine. but when i do a task, says there is no object in mongodb. but i have a collection in my db with data
[12:51:42] <tscanausa> localhost doesnt seem right but I know nothing about informatica cloud maybe you can ask them for help?
[12:52:53] <chris31jct> yes i can do that. but just wanted to know if there is a way to get the url where i installed it.
[12:53:08] <tscanausa> where did you instal it?
[12:53:35] <chris31jct> in my laptop, just clicked install and that's it. i mean the url where it is located.
[12:54:18] <tscanausa> you installed mongo by just clicking install?
[12:57:05] <chris31jct> yeah. downloaded the setup, clicked install. followed some steps to begin mongo services, created a collection of accounts in mydb database and the went to infa cloud
[12:57:55] <tscanausa> ok, is infa cloud a service on the web?
[12:58:21] <chris31jct> yes
[12:58:26] <chris31jct> informaticacloud.com
[12:58:41] <tscanausa> does it install on your local computer?
[12:58:45] <chris31jct> no
[12:59:31] <tscanausa> is your computer publicly accessible on the internet ( which does not mean does it have internet access but can it be accessed like a server)?
[13:04:44] <chris31jct> eh... not sure. guess i gotta read some more
[13:05:03] <tscanausa> well here is my conclusion, infa cloud is a web service that needs to be able to access mongo, http://locahost:8080/query is a local address to the service accessing it. so infa cloud would try to access mongo at its install location ( aka on the same server as the web service ).
[13:06:30] <tscanausa> I am 99% sure your computer is not access able to the public internet, if it were you would be able to change your connection string in infa cloud to be http://PUBLIC_IP:8080/query . this proble goes away when using another cloud service like in the user docs like AWS.
[13:06:59] <tscanausa> because it has a public ip address accessable by both you and infa could and so each can access it the same way
[13:09:09] <chris31jct> ok. let me read this. was afk.
[13:15:04] <chris31jct> i think infa can connect to mongo db because when i test connection it says is successful
[13:15:29] <chris31jct> im getting a The selected DSS target connection has no associated objects. Select a different target connection. error
[13:15:36] <chris31jct> so will keep digging
[13:15:50] <chris31jct> anyway, thanks for your help tscanausa
[13:16:27] <tscanausa> but what does that test connection do?
[13:18:46] <chris31jct> after i input the required information for the connector as per the pdf you sent me, it check if information is correct and accessable
[13:19:50] <chris31jct> infa cloud uses a secure agent in my computer and i think it is the one actually making the connection between the infa cloud services and my computer which is where i connect for uploading flat files and now mongodb
[13:22:21] <chris31jct> I have sqlserver installed also in my computer and have made a successful connection to infa cloud and can see my tables.
[13:36:05] <chris31jct> well, thanks. have a good day tscanausa,
[14:01:17] <nomiz> In node-mongodb-native I get an error when I drop an not existant collection, where I would expect a result = false, like in the mongo shell. Why?
[14:03:52] <tscanausa> nomiz: as in you get an error in the error param of the call back?
[14:10:32] <nomiz> tscanausa: correct
[14:11:13] <tscanausa> it does that because that is what the client says it will do. http://mongodb.github.io/node-mongodb-native/api-generated/db.html#dropcollection
[14:15:35] <saml> node.js is async web scale. that's why
[14:16:19] <rspijker> yeah, because buuzwords
[14:16:26] <rspijker> buzzwords*
[14:27:47] <dob_> Why is my mongodb logging every query to the logfile?
[14:27:51] <dob_> Can i stop that?
[14:28:08] <dob_> db.getProfilingLevel() == 0
[14:28:50] <kali> dob_: it's not logging every query, but merely the slow ones
[14:29:03] <kali> dob_: so it might actually be interesting
[14:29:19] <dob_> kali: I don't think that it's only the slow ones.
[14:29:37] <kali> dob_: well, that's the default setting
[14:29:59] <kali> dob_: with slowness being 100ms and more
[14:31:39] <dob_> it even logs my authentication requests etc...
[14:32:02] <rspijker> it does log quite a bit by default
[14:32:10] <dob_> level 0 means no profile, correct?
[14:33:01] <kali> yes, 1 is profile slow ones, 2 all of them
[14:33:34] <dob_> my profile setting is 0 and it seems to log every connection and authentication.
[14:33:42] <dob_> is that correct?
[14:34:37] <Shakyj> mongoimport docs say --drop drop all collections, is there a version that just drops the collection you are importing to
[14:34:49] <kali> yeah, these are not impacted by the profiling level, only the actual queries
[14:35:27] <kali> Shakyj: well, don't take my word for it, but i think it is what it does
[14:35:28] <dob_> kali: Can i change the timeout for the queries?
[14:35:43] <kali> dob_: the 100ms ? yes
[14:36:16] <kali> dob_: http://docs.mongodb.org/manual/reference/configuration-options/#operationProfiling.slowOpThresholdMs
[14:36:32] <dob_> kali: Thanks a lot!
[14:37:53] <dob_> is it correct that the ubuntu packages doesn't include a log rotate conf?
[14:38:12] <tscanausa> mongo does not support log rotate
[14:38:31] <tscanausa> you can use syslog that then can log rotate
[14:39:35] <dob_> tscanausa: Yes, i know, but other packages are providing configs for logrotate...
[14:41:02] <rspijker> it’s not in the package dob_, I just wrote my own
[14:41:18] <dob_> rspijker: Okay, thanks!
[14:42:04] <tscanausa> the ubuntu mongodb package by default uses standard logging and so it might be of MongoDB's opinion or the packagers opinion that a log rotate file is not needed since it is not used by default. there is also a ticket somewhere that would have mongoDB rotate its own logs
[15:59:02] <Shakyj> kali: fyi --drop on mongoimport only drops the table it will overwrite
[16:14:56] <gustavnikolaj> Hi. I have a question that I cannot find the answer for. What is considered best practice when writing an API based on express; Making one connection per worker, or making a new connection per request?
[16:15:22] <gustavnikolaj> Or a third option?
[16:15:28] <tscanausa> connections are expensive, pool where you can
[16:16:21] <gustavnikolaj> tscanausa: do you have any resources, off the top of your head, of how to do that? All the examples I find make a new connection.
[16:18:31] <gustavnikolaj> tscanausa: never mind. I figured it out. Thank you!
[16:21:06] <tscanausa> no problem
[17:39:11] <Diplomat> Hey guys I have a weird problem.. For some reason mongodb doesnt start on ubuntu
[17:39:16] <Diplomat> also it doesnt write anything to logs
[17:40:34] <mango_> restart the server?
[17:40:43] <Diplomat> tried it
[17:42:32] <mango_> have you enabled a logpath?
[17:42:48] <mango_> --logpath mongod.log
[17:43:24] <jordz> what happens when you run mongod from the bin?
[17:43:43] <jordz> is there any output?
[17:43:49] <mango_> yes there should be
[17:44:33] <mango_> there should a default configuration file mongod will go and find.
[17:44:55] <mango_> I'm not sure where it's stored in Ubuntu
[17:45:10] <mango_> but that config file will tell how MongoDB is starting
[17:45:20] <mango_> try running through: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
[17:45:40] <jordz> /usr/bin/mongod
[17:46:31] <jordz> it should be in the path by default if installed correctly
[17:46:42] <jordz> well, through APT
[17:48:21] <Diplomat> @mango_ I restarted again.. and yes logs are going to var/log/mongod
[17:48:32] <mango_> ok that's good
[17:48:46] <mango_> just check your logpath option
[17:52:25] <Diplomat> nope
[17:52:41] <Diplomat> it appears it like starts up for a moment and then shuts down and then its impossible to start it
[17:52:44] <Diplomat> and logs dont show anything
[17:54:37] <Diplomat> dafuq it didnt install it correcly or something because when i tried to install it again then it wants to install itself again
[17:55:02] <Diplomat> um.. it works now
[18:59:45] <brammator> pymongo question: is there any difference between "find({..}, sort={..}, limit=..., skip=...)" and "find({...}).sort(...).skip(...).limit(...)"?
[19:29:48] <jasondockers> I can't seem to append a BSONObjectBuilder with the return value of a map? I can't pinpoint the problem with it. The map is defined as std::map<std::string, std::string>, I'm appending like: cDoc << theMap[q] /*(where q is a string)/* << q;
[19:30:18] <jasondockers> q is guaranteed to be a correct key
[20:18:39] <kali> Shakyj: mmm that's what i said it would do, right ?
[20:23:07] <baegle> Is there a way to get a document from one database into another database via the mongo shell?
[20:26:46] <mango_> perhaps in a script
[20:28:58] <mango_> http://docs.mongodb.org/manual/core/import-export/#data-type-fidelity
[20:35:38] <amcrouse> I am trying to setup a geographically distributed replica set of four members. I am following the docs at http://docs.mongodb.org/manual/tutorial/deploy-geographically-distributed-replica-set/ however I have a question. Under the topic “Deploy a Geographically Redundant Four-Member Replica Set” the first point states that “One host (e.g. mongodb4.example.net) must be an arbiter. This host can run on a system that is also used for an application
[20:35:38] <amcrouse> server or on the same machine as another MongoDB process.” On the arbiter page at http://docs.mongodb.org/manual/core/replica-set-arbiter/#replica-set-arbiter-configuration it states “Important: Do not run an arbiter on systems that also host the primary or the secondary members of the replica set.” These two statements seem to be contradictions. Can I please have some clarification. I think having an arbiter running on the secondary in site A w
[20:35:39] <amcrouse> ould not have any adverse effect on voting however I am not sure.
[20:37:50] <mango_> amcrouse
[20:38:06] <mango_> how many sites is your architecture spread over?
[20:38:24] <amcrouse> two sites
[20:38:36] <mango_> is it as illustrated in the diagram?
[20:39:13] <mango_> why have you got 4 members?
[20:40:09] <amcrouse> The sysadmin wanted to have 2 in each site. If site A went down for a long time then we would manually switch site B over to the the primary.
[20:41:03] <joshua> If one site goes down you only have 2 members and can't get a consensus on a vote
[20:41:39] <joshua> Sounds like it could get messy
[20:41:50] <mango_> the documentation says it's only for a testing environment
[20:42:14] <baegle> is copyTo() non-destructive
[20:42:23] <amcrouse> Yes, that is why it would need to be a manual process to switch. Our business requirements state this need.
[20:42:30] <mango_> having an arbiter in Site A will just end up with consensus not happening
[20:42:36] <cheeser> amcrouse: it's probably safe to run a mongos and an arbiter on the same box, e.g.
[20:42:47] <cheeser> but *not* one with a mongod
[20:43:07] <mango_> cheeser, are you saying run arbiter on Site B?
[20:43:18] <amcrouse> we are currently not sharding
[20:43:26] <cheeser> mango_: um. no?
[20:43:47] <mango_> ah ok, sorry misread.
[20:44:18] <joshua> Ideally you would want an arbiter in each location so you have an odd number of members, or get a 3rd location. But the ideal isn't always the reality. :)
[20:45:10] <amcrouse> joshua: From reading the docs it states that I only want 1 arbiter in site A
[20:45:28] <joshua> Yeah I mean 1 in A and 1 in B
[20:45:32] <mango_> and the docs also say it's ideal for testing.
[20:45:40] <mango_> joshua is ideal for production
[20:45:46] <mango_> joshua is saying*
[20:45:54] <joshua> Testing you can do whatever floats your boat
[20:46:14] <amcrouse> ah okay, so what would be your suggestion for a production setup?
[20:47:21] <joshua> Hrm actually if you have an arbiter in each location that might have other complications. They went over all this in the DBA course but its been a while
[20:47:56] <joshua> http://docs.mongodb.org/manual/core/replica-set-elections/
[20:48:14] <cheeser> 2 arbiters would bring the cluster to 6 making it theoreitcally possible for both sides to elect a primary in the even of a network partition
[20:48:29] <joshua> yeah thats not good, you need one network section to have more
[20:48:35] <jeffj> it's almost like mongodb doesn't really have a real solution for not fucking itself in the event of a network partition.
[20:48:49] <joshua> Cause if they both are voting and both have a primary, when the network comes back you might have data collision
[20:49:02] <cheeser> it's almost like mongo does but you have to know what you're doing in the first place.
[20:49:54] <jeffj> i love distributed databases where it's possible to have both sides of a partition elect a primary. what happens when the partition heals. how is conflict resolved?
[20:50:22] <joshua> In the MongoDB course that was actually one of the homework tasks
[20:50:40] <kali> amcrouse: arbiters are meant to act as tie-breaker in a two "data" node replica set
[20:50:50] <joshua> They had you bring back things in certain order after adding data but I don't remember half of how it plays out. hah
[20:51:49] <kali> amcrouse: i don't think there is really a point in having more than one in a replica set. anyway, you must break the symmetry between your two datacenter: if they are split, only one of them can elect a primary
[20:52:32] <amcrouse> mango_: I don't see where in the docs it says its for testing. I was under the impression that the guide was valid for production. Sorry, I've been reading all day and my eyes are old
[20:52:37] <jeffj> joshua: i'm speaking tongue in cheek for the most part. i know what happens.
[20:54:04] <amcrouse> kali: So do you think running an arbiter on the same machine as the secondary in site A would be okay? Or would it be best to run it on a separate machine?
[20:57:33] <mango_> amcrouse: what you suggest is useful if Site B goes down.
[20:58:07] <kali> amcrouse: well, the recommend approach is to put the arbiter on a host that you want on the same side of a potential split than the primary. a good place is often you application server (not the mongodb server, but whatever uses mongo)
[20:58:27] <mango_> anyone here doing M102?
[20:58:50] <joshua> I started it, but then I got too busy to devote time to it
[20:59:28] <joshua> Wait thats M202
[20:59:38] <joshua> I passed M102 about a year ago
[20:59:48] <kali> amcrouse: you will not be able to have automatic failover for a failure of dc A and automcatic failover for a failure of dc B. you have to pick one. it's the same problem as replica set, but at another scale
[21:00:04] <kali> amcrouse: or set an arbiter on a third DC
[21:00:25] <jeffj> or use something like riak that knows how to handle cross-dc failure.
[21:02:29] <joshua> Get one of those networks that never goes down
[21:02:59] <kali> or unplug everything right away
[21:03:11] <kali> at least you know it's a split
[21:03:30] <kali> well, i guess it depends which plug you unplug
[21:04:09] <amcrouse> I don't think mongo is capable of doing automatic failover from sites (Nor do I think most programs are able to). The fact that you have to place a majority in site A makes it somewhat clear that site A will never give up priority. I'm wondering if placing an arbiter in site A's secondary would have any adverse effects during an election.
[21:05:05] <kali> amcrouse: not much, but in that case, i would rather tamper with the votes weight (even if i know it's frown upon)
[21:05:44] <amcrouse> kali: How do you mean?
[21:06:23] <kali> amcrouse: you can give one node two votes
[21:07:11] <kali> ha ! it's been deprecated in 2.6
[21:07:17] <kali> amcrouse: forget i said this
[21:07:41] <joshua> You can use the priority system though
[21:07:52] <joshua> Or have hidden members
[21:07:59] <joshua> Or both
[21:08:07] <joshua> http://docs.mongodb.org/manual/tutorial/adjust-replica-set-member-priority/
[21:08:11] <kali> joshua: it's not the same. priority have no impact of the existence of a consensus
[21:09:15] <joshua> True true, but if you want to make primaries go back to where you want when the network is optimal again it helps
[21:09:40] <joshua> Just do everything in threes
[21:09:59] <kali> joshua: sure, but in the end it is a completely orthogonal problem to the consensus building
[21:10:37] <joshua> I might have to start thinking about this stuff again once I switch jobs next month.
[21:11:42] <kali> joshua: if you have 3 nodes in DC A, 3 in DC B, no arbiter and no vote tampering, in case of a split, you get two DC with 50% of the votes. no matter what you do with priorities, you have six nodes doing nothing :)
[21:12:25] <kali> with three DCs, it's better
[21:12:26] <joshua> Nah I mean, 3 locations instead
[21:12:54] <amcrouse> How is it solved by 3 DC's?
[21:13:23] <joshua> Very carefully
[21:14:06] <kali> amcrouse: if one DC is splitted out (or down), the two remaining still have 66% of the votes and can choose a primary
[21:14:37] <kali> amcrouse: exactly the same mechanism as a three-node replica set
[21:15:25] <kali> amcrouse: it might be usefull for you to setup a test replica set (you can do it on a laptop) and simulate the various failure scenario to get a feel on how this things react
[21:15:41] <mango_> joshua: I started M102 as well, but gave up too, Im going to start next month, it seems very in depth.
[21:15:51] <mango_> M202 i mean
[21:16:30] <joshua> When it got to the ones where it was like your business requirements are XYZ and ABC happens and its asking how long before blah blah blah. I got fed up and stopped there
[21:17:05] <joshua> I guess doing all those calculations to figure out how long you can leave a DB down without doing anything made me think I wouldn't want to work there. heh
[21:17:13] <amcrouse> kali: However this does not solve for if the DC's cant see each other. Nor does this allow for automatic failover for DC's. Only one DC will be eligible for priority since http://docs.mongodb.org/manual/core/replica-set-architectures/ "Keep a Majority of Members in One Location" and "Distribute Members Geographically"
[21:18:08] <kali> amcrouse: well, consider this: just three nodes, each one in a different DC. let's forget about the performance implications
[21:18:31] <joshua> One example I saw had 2 nodes in the primary, then a second location with a single node and arbiter, and a third location with just a single node
[21:18:41] <kali> amcrouse: as long as two DCs can "see" each other you have a working replica set
[21:19:49] <joshua> If A and B are up, and you have 3 members plus arbiter the arbiter won't vote for itself
[21:20:12] <joshua> If A and C are up, you have 3 members
[21:20:36] <joshua> if B and C are up then you have 2 members and an arbiter
[21:20:42] <kali> joshua: yeah, it's nice, as long as A and (B or C) is up and can see each other, A stays primary
[21:20:56] <kali> joshua: and if A fails, B will take over
[21:23:33] <kali> but there are dozen of options. two nodes in A, two nodes in B, one arbiter in C would work too (and you have two locations that can handle write traffic as well as read-on-secondary)
[21:25:34] <amcrouse> kali: According to the docs you should not do automatic failover of datacentres. All examples that I have seen have placed a 0 priority on mongod instances outside of the primary site
[21:27:08] <amcrouse> I would tend to agree with that as split brain can happen if their were certain conditions. Then reconciliation would result in data loss or an incorrect state.
[21:27:50] <kali> amcrouse: ok. let me state that i never managed cross DC operations, only cross "zones" (as in ec2), so there might be practical issues. i was merely trying to give example of working and/or broken voting pools
[21:28:04] <joshua> It also depends on how your application servers are configured
[21:29:17] <kali> cheeser: do you know if people manage to get cross-DC working replica set ? with actual working failover strategies ?
[21:29:43] <kali> cheeser: or is it limited to offsite backup and manual disaster recovery ?
[21:31:14] <Matadoer> question guys... would mongodb be good to use for storing financial stuff? or should I just use a MySQL cluster
[21:32:25] <amcrouse> Matadoer: Use a ACID complete database. No mongodb would NOT be good
[21:34:03] <Matadoer> gotcha
[21:38:14] <Matadoer> what if there wasn't any transactions and we were just storing bitcoin wallets (no private keys being stored)
[21:39:39] <kali> Matadoer: like flexcoin did ? :)
[21:41:30] <mango_> You can do transactions in MongoDB, but it's cumbersome
[21:41:43] <mango_> and doesn't beat a traditional RDBMS.
[21:41:47] <Matadoer> we're not going to be storing actual "coins"
[21:42:06] <mango_> MongoDB is a document store.
[21:42:14] <Matadoer> we just store the encrypted wallet payload and then the user decrypts it with the private key on the client side
[21:42:15] <mango_> that's all you really need to know.
[21:42:27] <Matadoer> we have no access to the private keys
[21:43:15] <Matadoer> no actual balances are being stored, transferred etc
[21:43:27] <Matadoer> basically blockchain.info but with mongodb
[21:59:16] <jeffj> > don't think mongo is capable of doing automatic failover from sites (Nor do I think most programs are able to) <- this isn't true, there are a number that are. and in the days of cloud, even a single location at a single provider can encounter very significant partitions.
[23:03:18] <melvinrram> When doing an aggregate and using grouping, how do you get the first instance of a combination?
[23:06:14] <cirwin> hi guys, i have a sharded cluster with 5 replica sets; and for some reason one of the replica sets has 2x the volume of data than the others
[23:06:32] <cirwin> same number of chunks, but the average chunk size is 123Mb instead of 60ish
[23:06:45] <cirwin> any idea why the chunk splitter wouldn't be touching chunks on that machine?
[23:07:20] <Boomtime> @melvinrram: $first: http://docs.mongodb.org/manual/reference/operator/aggregation/first/#grp._S_first
[23:08:04] <Boomtime> @cirwin: what is your shard key
[23:08:15] <cirwin> hash(project_id, id)
[23:08:20] <cirwin> so the chunks can be split
[23:08:31] <Boomtime> what is "id", do you mean "_id"?
[23:08:33] <cirwin> yeah
[23:08:54] <Boomtime> was the collection presplit?
[23:09:05] <cirwin> what does presplit mean?
[23:09:43] <cirwin> we did a resync of this replica set recently, so I assume it was part of that process that broke things
[23:10:21] <Boomtime> shards and replica-sets are two different things
[23:10:34] <Boomtime> a shard can be made from a replica-set
[23:10:38] <cirwin> I know, that's why I'm very confused that I'm seeing one replica set behave differently from the other 4
[23:10:54] <cirwin> as far as I'm aware mongos is responsible for chunk splitting
[23:11:09] <cirwin> yet on one replica set, chunks are double the size of the others
[23:11:24] <cirwin> (120Mb, vs 60Mb) our chunksize setting is 64Mb
[23:11:25] <Boomtime> what do you mean when you say "resync this replica-set" <- this statement makes no sense, you can resync a member of a replica-set, or you can drain and re-add a shard
[23:11:43] <cirwin> resync replica set => resync a new member, then failover to that new member
[23:12:28] <Boomtime> then you just re-sync'ed a member of a replica-set, that does not affect the cluster overly much
[23:13:03] <cirwin> right, it's the only difference about the "broken" replica set which is why I brought it up
[23:13:10] <cirwin> but I have no idea what's going on
[23:14:07] <Boomtime> do you know how the collection was originally sharded?
[23:14:32] <cirwin> about a year ago we followed the instructions on the mongo site to set up the index and then shard
[23:14:45] <cirwin> we've grown from 2 to 5 replica sets since then without a hitch
[23:15:14] <Boomtime> fyi, you would be better off saying "shards" there, the fact they are replica-sets is incidental
[23:16:24] <Boomtime> the imbalance is new?
[23:17:24] <Boomtime> also, have you checked sh.status() to see where the imbalance is occurring?
[23:17:25] <cirwin> we had a slight imbalance with the broken "shard" being the fullest
[23:17:34] <Boomtime> you said the chunks are even
[23:17:39] <cirwin> they are even
[23:17:41] <cirwin> except on this machine
[23:17:44] <cirwin> they are twice the size
[23:17:46] <cirwin> s/machine/shard
[23:18:02] <Boomtime> size = storage size?
[23:18:21] <Boomtime> and how are you measuring that
[23:19:05] <cirwin> https://gist.github.com/23fd998fa799948e85bf
[23:19:17] <cirwin> spot the odd one out :)
[23:19:41] <cirwin> (this is sh.getShardDistribution() FYI)
[23:20:25] <Boomtime> i would have to check what it measures, but that might include unsharded collections in the total
[23:20:38] <cirwin> there are no unsharded collections on that machine
[23:21:49] <alejandrocgf> hello, has anyone manage to auth with x509 in node.js? whatever i do, the driver crashes :(
[23:24:25] <Boomtime> then my bet is the chunk ranges are not consistent, yuo would need to go through the chunk collection
[23:24:48] <cirwin> what do you mean by "not consistent"
[23:24:50] <cirwin> with gaps?
[23:25:30] <Boomtime> i mean, the ranges are different sizes
[23:25:40] <melvinrram> Boomtime - how do you do it for multiple fields?
[23:26:26] <melvinrram> I have it working with one field but I want it for the first combo of multiple fields
[23:27:24] <Boomtime> it only makes sense to select $first on the group, so if you grouped by multiple fields then i believe it selects the first item that is in that group
[23:30:58] <melvinrram> I don't think I fully understand yet but I believe I have my answer inside http://stackoverflow.com/questions/11418985/mongodb-aggregation-framework-group-over-multiple-values so I'll go do some experiments.
[23:39:21] <edrocks> is it better to use an ssh tunnel between all your api/web server nodes and your db or to make a cross zone vpn that includes all api/web/db nodes?
[23:39:31] <SubCreative> Can someone give me the best way to scan/loop over a collection and execute a function if a value = true?
[23:39:39] <SubCreative> would a simple while loop work?
[23:39:47] <edrocks> SubCreative: use an iter
[23:40:33] <edrocks> a loop would be slow and prone to an out of memory crash because you need to keep the whole dataset in memory to loop over it. With an iter it just grabs one at a time from the db
[23:41:52] <SubCreative> Ill take a look, thanks.
[23:44:24] <joshua> melvinrram: If you haven't read it yet, this has some good info about choosing a shard key http://docs.mongodb.org/manual/tutorial/choose-a-shard-key/
[23:46:55] <melvinrram> joshua - hmm not sure what that has to do with what I need but I'll definitely take a look.
[23:48:12] <edrocks> why are you suppost to use exactly 3 config servers in production? Wouldn't more be better?
[23:48:28] <joshua> melvinrram: sorry wrong person :)
[23:48:48] <melvinrram> :D gotcha
[23:51:10] <SubCreative> edrocks: Looks like Iterator() is not JSC standard.
[23:51:21] <SubCreative> Where you referring to some other iterating method?
[23:51:26] <SubCreative> while? for?
[23:52:01] <edrocks> idk what jsc is but in golang its called iter http://godoc.org/gopkg.in/mgo.v2#Iter
[23:52:48] <SubCreative> javascript core.
[23:52:48] <edrocks> then you would do you would use iter.next if your data could be large to step through 1 by 1
[23:52:53] <SubCreative> They have a interator for mozilla
[23:52:57] <joshua> I'm guessing you don't want more config servers than you need cause it has to make more connections and keep more of them in sync.
[23:53:11] <SubCreative> But not for node.js/v8
[23:53:46] <SubCreative> Maybe this is it...
[23:53:47] <SubCreative> http://docs.mongodb.org/manual/reference/method/cursor.forEach/
[23:53:49] <edrocks> just do whatever the equivalent would be of fetching one document do work on it then get the next then instead of grabbibg everything at once
[23:55:12] <edrocks> that looks right