[00:16:45] <poz2k4444> Hi guys, one quick question, when I create a replication infrastructure, do I need to do the rs.initiate() on each member or just on one?
[00:33:49] <Boomtime> @poz2k4444: rs.initiate on only one member - if you have data already be sure to run that command on the member you want to preserve
[00:34:09] <Boomtime> when you want to add other members, use rs.add from the host where you ran rs.initiate
[00:34:27] <poz2k4444> so the replica wont be done in the secondaries right?
[00:34:54] <Boomtime> wut? the replica-set is all members combined - not sure what you are asking
[00:35:41] <Boomtime> all members of the replica-set must be started with the same value for replSet name and keyFile if using auth (cert subject if using x509)
[00:36:05] <Boomtime> the replica-set is then initalized from exactly one member
[00:36:18] <Boomtime> that one member will contact the others, and replicate the configuration
[00:36:37] <poz2k4444> Boomtime: ok, so every configuration file (in my case) has the same name of the rs, then I run rs.initiate() in only one member and then I add the others members?
[00:38:59] <Boomtime> you'll need to wait a few seconds after rs.initiate before you try rs.add
[00:46:05] <poz2k4444> Boomtime: aight man, thank you, i'll give it a try tomorrow though
[03:43:23] <TheTank111> can someone tell me why update({},{"$set":{"groups":[]} }) won't clear the contents of an array that contains other json objects?
[03:43:44] <TheTank111> db.Logins.update(....) (I'm doing the command from the shell)
[03:50:06] <TheTank111> i fugred it out i needed to add ,{multi:true} at the end
[08:43:58] <gregf_> is there much difference between mongodb and dynamodb?
[08:45:06] <gregf_> im using dynamodb atm and there is a restriction on #indexes that can be created. also adding a index for example takes quite some time.
[08:45:24] <gregf_> so was thinking about moving to mongodb
[10:49:55] <jacoscaz> Hello everyone. I'm experiencing a weird issue with the nodejs driver version 2.x for which I haven't been able to find a solution no matter how much time I throw at it. Basically, let's assume M1 and M2 are two different machines running the same code and connecting to the same replicasets R1 and R2. Using the 1.x driver, the avg. query for both M1 and M2 is ~10ms both on R1 and R2. Using the 2.x driver, the avg.
[10:49:55] <jacoscaz> query for both M1 and M2 is ~50ms, both on R1 and R2. The query itself is the same (a simple find by id), the codebase is the same.
[10:51:35] <kurushiyama> jacoscaz What was the reason for updating the driver?
[10:51:44] <jacoscaz> However, machine M3 and machine M4 - which are identical to M1 and M2 - do not experience this difference. Their query times are all around ~10ms.
[10:52:58] <kurushiyama> jacoscaz Well, the evidence proves that there _is_ a difference.
[10:55:29] <jacoscaz> @kurushiyama yes, there is a difference. I just haven't been able to find it.
[10:56:25] <kurushiyama> jacoscaz With identical, you are talking of the hardware, I assume? Versions and storage engine are identical, too? You sure the disk storage is identical?
[10:57:39] <jacoscaz> @kurushiyama I should have worded that in a different way. What I mean is that for what I can see (which is clearly not enough), they're identical. Hardware and disk storage is identical across all replica sets. The client machines all share the same hardware specs, the same OS, the same nodejs codebase.
[10:58:32] <kurushiyama> Ok, then check the mongod versions and the respective config.
[10:58:47] <jacoscaz> Same versions, same configs.
[11:00:06] <kurushiyama> jacoscaz I doubt that. MongoDB is pretty predictable when it comes to scaling. Since presumably you did not change the network, there has to be a difference.
[11:03:29] <jacoscaz> I have triple-checked. Also, I don't think it's a matter of scaling as some clients are seeing the different query time while some other clients are not for the replicaset/database.
[11:16:04] <kurushiyama> chujozaur As soon as you added one, you should remove one, even during initial sync. Reason: You do not want to sit around the whole night, do you?
[11:16:12] <kurushiyama> chujozaur Use Pastebin!!!
[11:16:48] <chujozaur> why I would have to sit around all night?
[11:17:46] <chujozaur> I know that 4 node has the same fault tolerance as 3
[11:18:08] <jacoscaz> @kurushiyama that is my experience, too, and the reason why I've spent hours looking for a difference that would explain this. I'll keep looking...
[11:19:17] <chujozaur> but apart from paying more for the additional node that brings no value in terms of cluster durability
[11:19:25] <kurushiyama> jacoscaz What I tend to do in those situations is to use diff (vim-diff) actually for the config files. Take a known good and diff the others against it.
[11:19:47] <chujozaur> is there any serious risk related to that?
[11:20:01] <kurushiyama> chujozaur You actually increase the chance of your replica set entering secondary state.
[11:20:11] <kurushiyama> chujozaur Since more nodes are invloved.
[11:20:59] <kurushiyama> chujozaur The probability is simple higher that one of two nodes fails than that a single node fails.
[11:21:08] <jacoscaz> @kurushiyama did that already, both server-side and client-side. Client-side, we've also written a couple of scripts that do not go through the rest of our system but merely connect through the native drivers (1.x and 2.x) to make sure it's something code-related.
[11:25:25] <chujozaur> anyway, what I can check to tell about actual progress of replication after adding that node?
[11:26:05] <chujozaur> I'd like to have some kind of +/- estimate of when I can expect my newly added node to be 100% valid, up-to-date secondary machine
[11:26:22] <Derick> chujozaur: the log should show progress, does it not?
[11:26:57] <cheeser> you could rsync the files over and then let replication pick up from there.
[11:27:35] <kurushiyama> A snapshot comes in handy, there.
[11:33:12] <cheeser> i would think it would be since you're *just* copying bytes. oplog sync requires adjusting bits in flight.
[11:36:17] <chujozaur> my log says nothing about replication progress
[11:36:27] <chujozaur> is any rs.* command to check that?
[11:51:00] <jamiel> Don't think so - disk space used can be a decent indicator if you replicas aren't heavily fragmented - if you are using WiredTiger you will see the collections being created in the data directory.
[11:51:26] <jamiel> When it's creating indexes it should print in the log
[12:06:18] <kurushiyama> cheeser Well, rsync needs to validate the files first, iirc. This can cause quite an overhead.
[12:07:42] <dddh_> I've seen several times this month that initial syncing to new replica set members on modern hardware is limited by network bandwidth
[12:09:33] <dddh_> of course data could be compressed before transferring to new nodes with rsync -rltpvaz --compress-level=9
[12:10:37] <dddh_> or something like tar -I'pixz -p4'
[12:10:56] <kurushiyama> chujozaur To give you an impression. A 800GB data set which I used to resync regularly took some 3h over a bonded 2* 1Gb network, exclusive for database access. including index rebuild and oplog application.
[12:12:02] <kurushiyama> dddh_ Well, and then you can hear the fans from miles away and the lights will start to flicker in the datacenter ;)
[12:14:13] <dddh_> kurushiyama: that is why I use only -p4 and not all possible cpus/cores
[12:15:04] <kurushiyama> dddh_ Funny when only 2 are there ;)
[12:16:09] <kurushiyama> dddh_ Actually, I use snappy when transferring stuff. But then, I tend to pipe tar | snap | nc ;)
[12:21:58] <wtiger> Hi! is mongodb persistent by default?
[12:28:16] <dddh_> kurushiyama: usually there are about 32 available cores on modern production servers
[12:34:24] <kurushiyama> dddh_ Less cores, higher clock rate as for MongoDB. and RAM. Tons of RAM. As for frontends and middleware: I rather scale out than up with that.
[12:35:33] <wtiger> btw, how can I configure mongodb(setup username/password, create database) on manjaro/arch? using mongo-tools?
[12:36:45] <kurushiyama> wtiger First peace of advice: If you start out with MongoDB, use a) a supported distribution (or Docker for development) b) The documentation. Heavily. c) MongoU.
[12:37:49] <kurushiyama> wtiger I had a few things to say about codeigniter as well, but since this is not bash #php, I'll refrain. If you want to hear my thoughts on that, PM me.
[12:58:15] <Gnjurac> hi can somone help me i am kinda noob in web dev, can i use php7 with MongoDB 2.4
[12:59:15] <Gnjurac> in my nigx folder config/php.d #extension=mongodb.so is uder comment i think
[13:13:33] <cheeser> instead of limit(1).pretty() do .count()
[13:14:25] <Gnjurac> can somone pls tell me how to make a a db that stores , name , score , time. cuz want my cilent wen send post request to read/write that stuff
[13:14:25] <kurushiyama> Gnjurac I do not think so. Think of Gall's law.
[13:18:13] <jacoscaz> @kurushiyama we tried bisecting our way through the different driver versions. Reverting to mongodb@2.0.33 makes the issue disappear. Upping the version to mongodb@2.0.34 makes it reappear.
[13:18:58] <edrocks> What's the benefit of having a broken count
[13:19:03] <kurushiyama> edrocks Because it is expensive?
[13:19:14] <kurushiyama> edrocks Even pretty much so.
[13:19:49] <kurushiyama> edrocks Well, it is a delicate problem, actually.
[13:19:54] <edrocks> Are you kidding me? "After an unclean shutdown of a mongod using the Wired Tiger storage engine, count statistics reported by count() may be inaccurate."
[13:20:37] <kurushiyama> edrocks If you run this "incomplete-returns" you will actually see that it is pretty easy to cause enough noise to make count return wrong results.
[13:21:23] <kurushiyama> BUT: The only remedy would be a RWMutex on the indices.
[13:22:06] <kurushiyama> Not much of a problem with MMAPv1's collection level locking, I guess.
[13:22:55] <cheeser> lfamorim: you can make something awesome :)
[13:25:14] <edrocks> kurushiyama: Has this caused you any issues? I only use count for pagination totals
[13:27:45] <edrocks> kurushiyama: At least I don't use shards. But it could screw me with invoices. Thanks for warning me
[13:29:04] <jacoscaz> @kurushiyama I confirm - the downgrade to 2.0.33 fixed the issue on all the machines that had it.
[13:29:28] <jacoscaz> @kurushiyama we're using SSL on a host and not using it on the other - doesn't seem to be a factor.
[13:30:19] <kurushiyama> jacoscaz Well, iirc, there was a bug that each connection openened in the pool actually recertified the complete SSL chain.
[13:31:07] <jacoscaz> But wouldn't that come up at connection time? What we're experiencing comes up at query time.
[13:36:38] <kurushiyama> jacoscaz The driver maintains a connection pool, in case you did not notice ;)
[13:37:32] <kurushiyama> edrocks For invoices, I would definetly walk the mile and use an aggregation.
[13:38:31] <edrocks> kurushiyama: Is there any way to tell if you need to run validate to fix the wired tiger info after a crash? I just have a replica set
[13:38:38] <jacoscaz> @kurushiyama yeah. However, I presume that a single connection before the process exits only causes a single entry in the pool. We always wait until the connection has been established before querying.
[13:38:52] <edrocks> I assume logs would be one way
[13:39:15] <kurushiyama> edrocks Yes. Other than that – I tend to resync after a hard crsah, anyways.
[13:39:32] <jacoscaz> @kurushiyama do you think this is worth opening an issue on JIRA?
[13:39:58] <Derick> jacoscaz: check whether there is one first
[13:40:35] <Derick> but otherwise, yeah, I think so
[13:59:34] <dino82> I think I found my replication problem -- [reSync] 9001 socket exception [SEND_ERROR]
[13:59:44] <dino82> Wipes all progress of the replication and starts over
[14:22:09] <jayjo_> When I run a mongoimport, can I specify that I want a field to be writtento disk as a ISODate() if it's currently an integer of seconds since epoch?
[17:08:18] <Forbidd3n> If I have a sub-set list of objects and I am assigning an id to each one, how would I get $addToSet to ignore the id on insert if a property value matches
[17:09:13] <Forbidd3n> for example. I have lines -> ships -> _id,name : I want it to add to ships with $addToSet only if the name doesn't exist. Right not it is adding them all because it is basing it on _id and name
[17:20:41] <Forbidd3n> basically is it possible to $addToSet based on one field and not all fields?
[17:56:05] <nob> Hi, I am new to mongodb and I ran into problems with the BSON size limit. Does anyone know, if using the $pushAll (or $push with $each) operator does any querying before the update? I ask, because the data I try to push should not be anywhere near the limit, but the data contained in the target array of the document may be.
[20:39:44] <cn28h> probably a basic question, but can't seem to get a good answer. If I have a replica set with 3 members (2 + 1 arbiter), what might cause the "real" members to get stuck in STARTUP2 state? I see logs like "replSet initial sync pending" and "replSet initial sync need a member to be primary or secondary to do our initial sync"
[20:40:43] <cn28h> and the arbiter says "replSet I don't see a primary and I can't elect myself"
[20:41:13] <cn28h> and fwiw, the members have priorities set to 2, 3
[20:43:10] <cn28h> and as far as I can tell, there isn't any connectivity issue between the members