[08:59:51] <cm13g09> morning all - Need to create a replica set out of an existing standalone instance with next to no downtime (a reload is fine, anything else probably isn't)
[09:00:15] <cm13g09> I have two new servers to add (one as a full instance, one as an Arbiter)
[09:00:34] <cm13g09> How can I instantiate a replica set without reloading all my data
[09:00:55] <cm13g09> The docs only seem to document the case of instantiating on a new install
[09:21:47] <kke> trying to use a TTL index. doesn't seem to work. i enabled TTLMonitor logs and see this : 2016-09-02T08:51:35.257+0000 D INDEX [TTLMonitor] TTL -- ns: dev20160906114743.tokenskey:{ deleted_at: 1 } query: { deleted_at: { $lt: new Date(1472806294257) } } <-- that date is about a week ago, my expireAfterSeconds is 1
[09:22:16] <kke> does it have some setting somewhere that i only want to clean up stuff that is over a week old already or what? :)
[09:50:07] <Derick> we have docs on how to do a rolling upgrade too
[09:50:16] <Derick> (the order makes things a bit tricky sometimes)
[09:51:02] <cm13g09> My boss' experience of Mongo to date hasn't exactly been stellar (we've had a few random mongodb just dieing for no obvious reason issues)
[09:51:13] <cm13g09> which is why I was very very cautious about things
[09:54:00] <Derick> cm13g09: would it be possible to *try* out doing the upgrades on some random extra VMS so that you're familiar with it? like a dry-run?
[09:54:10] <Derick> cm13g09: WT likes concurrent writes a lot more
[09:54:32] <cm13g09> Derick: I can in theory - but I'm a bit short on disk space
[09:54:44] <Derick> cm13g09: I meant on other nodes
[09:54:53] <cm13g09> this is the issue... what other nodes?
[09:55:09] <cm13g09> I'm short of VM hosts with disk space
[09:55:21] <Derick> other servers? For a replicaset set, the three nodes need to be on different VMs - otherwise, it's kinda pointless
[10:05:23] <Derick> I'd check, but I'm not at home with my big machine today
[10:05:41] <cm13g09> the actual data instances are 4 vCPU / 8GB / 250GB
[10:06:46] <cm13g09> Derick: Basically the issue has come about because we need to fix the DC network in DC1, meaning we have to take the whole DC out for a day
[10:11:18] <nalum> Yeah, I was hoping to get a bit more info as to why it failed. I'm able to connect to the replica set without trouble usign the same connection string
[10:33:24] <cm13g09> If it was how we wanted it....
[10:35:58] <cm13g09> Derick: we're considering spinning up a brand new copy of the service in DC2 now, dumping the data out of DC1 and migrating it over later
[10:37:00] <cm13g09> It'd avoid an interruption of service, at the expense of history going slightly missing for a week or two
[10:37:01] <Derick> in that case, you can probably go straight to 3.2
[10:37:14] <Derick> you've nothing to lose anyway - if it doesn't work, you can try again?
[10:37:30] <cm13g09> it's the least likely method to fail
[10:38:07] <cm13g09> and yes, it doesn't touch DC1
[11:08:05] <kke> asking again. i'm trying to use a TTL index and it doesn't seem to work. i enabled TTLMonitor logs and see this : 2016-09-02T08:51:35.257+0000 D INDEX [TTLMonitor] TTL -- ns: dev20160906114743.tokenskey:{ deleted_at: 1 } query: { deleted_at: { $lt: new Date(1472806294257) } } <-- that date is about a week ago, my expireAfterSeconds is 1 there's no other index on the same field
[11:09:40] <kke> so why is it trying to find entries that are over a week old only?
[11:41:38] <SimpleName> Does mongodb support left join inter
[11:41:55] <SimpleName> I just saw $loopup for left join outer
[11:46:53] <SimpleName> and it ’s just workon non-shard collection
[13:11:37] <StephenLynx> even though I never used one, I'd look into them before anything else.
[13:12:52] <deathanchor> I read about neo4j, but since I left my last job which it would have been useful, I never followed up on it.
[13:18:20] <deathanchor> I'm just curious if you think if you would use graph DB soley or RDB or NoSQL, or hybrid for a "recommended items based on purchase" feature?
[13:20:09] <StephenLynx> i'd try to stick to the one that provides the most important features.
[13:20:28] <StephenLynx> unless I'd REALLY needed core features of another db.
[13:23:21] <cheeser> people build recommendation engines on mongo, fwiw.
[13:25:58] <deathanchor> cheeser: yeah, that's what I figured, but some the neo4j docs I read said graphing dbs are "better" for it, but I didn't see how it would efficient unless you precached it to something like mongo and updated the doc in mongo regularly.
[13:26:23] <deathanchor> eh, let me focus on real problems :D
[16:08:37] <suicidel> I'm trying to start up mongodb on ubuntu. I get Failed global init: FileNot Oepn failed to open the logfile. I checked the permissions and they are fine. Any ideas?
[16:28:08] <suicidel> @Derick: got it working. It's true . I wasn't starting it as mongodb user, so no access ot log. As a test i chowned to tv and it worked
[16:29:11] <Derick> you should fix/restrict permissions to only start it as the mongodb user though
[16:57:29] <wwwd> I'm trying to start mongdb with a replSet in Ubuntu 16.04. When I issue this command "mongod --replSet zappa --dbpath data/1 --port 27001 --smallfiles --oplogSize 50" I get connection refused...Anyone know why?
[17:06:41] <jokke> i think replace_one isn't what i need.
[17:06:54] <jokke> it probably actually creates a new doc with a new _id
[17:08:39] <StephenLynx> id argue that update is faster.
[17:29:03] <GitGud> GothAlice, hello are you here?
[17:29:29] <GothAlice> Sorta; I'm rather occupied at work at the moment, GitGud.
[17:30:08] <GitGud> GothAlice, i just had one question
[17:30:21] <GothAlice> Ask, don't ask to ask. There may be several able to answer. :)
[17:31:17] <GitGud> GothAlice, well its specific to you. because i was going to ask if you guys host your own work servers or if you do it remote. because i hear without proper equip, its bad to host it yourself
[17:32:26] <GothAlice> GitGud: We have physical servers managed by another company in a local DC, plus nodes managed in-house for offsite replication / backup purposes. For some clients we use MongoDB Inc.'s cloud services.
[20:37:16] <android6011> I have a collection and each record has a geojson point, i want to run a query that orders them by date_time, and computes distance between each record, to give me a total distance. Not really sure where to start
[20:38:21] <spacecrab> hello folks - i am new to mongodb and have a question about best practices, or rather simple designs... it seems there is a lot of different ways in which i can get off the ground with a database and start working.
[20:38:22] <spacecrab> i'm curious, is it preferred to work in the mongod.conf file, and have all changes defined from there, or should i have my scripts always calling mongod from bash and running with the parameters preferred? it seems they are one in the same but i am not sure which is preferred... any help/corrections/etc appreciated :p
[20:39:18] <spacecrab> essentially i'm simply working to create a 3-member replica set for the first time. i've been watching conference talks and reading documentation about it, but everyone seems to do it a little differently between bash and defining from .conf
[20:58:48] <spacecrab> or further yet, should i just be modifying the init script? i assume the conf should be used for all of this though
[20:58:55] <spacecrab> anyone out there willing to chime in? :)
[21:14:54] <GothAlice> spacecrab: Production environments should use .conf files; this better protects the security of the configuration itself, given proper file permissions.
[21:16:03] <GothAlice> spacecrab: Command-line arguments can sometimes be exposed via the process list. In other ways, this would let you do things like git-manage the config, ensure configurations are consistent and re-deployable with stock initialization scripts (since most will already look for a /etc/mongod.conf).
[21:16:21] <GothAlice> spacecrab: In development, running mongod through custom shell scripts or directly from a command line is entirely reasonable.
[21:23:13] <spacecrab> GothAlice: i'd rather learn and simply do it from the .conf file(s) then -- understanding the command line parameters was easy anyways it seemed, but the .conf file is actually very specific
[21:23:46] <spacecrab> i'll see if i can set up this replica set strictly through mongod.conf then :) thanks so much for the input! i'll let you know when i succeed
[21:23:53] <GothAlice> The options between command-line and configuration file are equivalent, from what I recall, FYI.
[21:24:02] <GothAlice> They might not have quite the same names, but they have the same meanings.
[21:24:48] <GothAlice> Compare https://docs.mongodb.com/manual/reference/program/mongod/ vs. https://docs.mongodb.com/manual/reference/configuration-options/ — they're very close.
[21:25:22] <GothAlice> The conf file is just semi-hierarchical.
[21:25:42] <spacecrab> GothAlice that's what i observed as well -- not 1:1, but the meanings themselves you can derive/associate with little effort
[21:26:16] <spacecrab> i'm reading this right now for the sake of reference/different sources -- is it normal to manually add replica systems via rs.add in the shell? http://www.serverlab.ca/tutorials/linux/database-servers/how-to-create-mongodb-replication-clusters/
[21:26:46] <GothAlice> spacecrab: Yes, or have automation to run that command for you, such as https://www.mongodb.com/cloud
[21:26:48] <spacecrab> i don't understand why someone would want to do that instead of defining it from source/conf... but it seems that everyone favors that option when it comes to tutorials/guides
[21:27:14] <GothAlice> The exact layout of your replica set is a runtime configuration, stored in the database itself, not in a configuration file.
[21:27:37] <GothAlice> spacecrab: ^ should help illuminate the issue. ;)
[21:27:55] <spacecrab> GothAlice: oh, interesting. so i should actually be maintaining it with my own bash/python deployment scripts, rather than being concerned about pre-start configuration changes
[21:27:57] <GothAlice> Similar to user accounts for authentication.
[21:28:16] <spacecrab> (or $cloud service, as you mentioned)
[21:29:32] <spacecrab> i'll probably dig into it certainly -- but for now i'd like to learn this stuffs :p coming from a history of light oracle DBA stuffs it's very interesting
[21:29:59] <spacecrab> and in a "devops"-y role it's super relevant. haven't had an excuse to touch nosql yet, and from what i've learned so far it's very easy to find one!
[21:30:19] <GothAlice> MongoDB can be… refreshingly lightweight in terms of setup for things like high availability, which can be somewhat more difficult elsewhere.
[21:30:45] <AvianFlu> quick question, if I've got a TTL index on a field, and then update that field before the ttl expires, it resets the countdown, yeah?
[21:30:55] <GothAlice> spacecrab: "Set up three nodes… have them shake hands… and wait, I'm done?" ;)
[21:30:58] <AvianFlu> (assuming I updated it to "now")
[21:31:28] <GothAlice> AvianFlu: It's implemented similar to a cron, running once per minute. Any record with a time <= now is cleaned up, so altering the TTL field is a-OK.
[21:32:15] <AvianFlu> so yeah I might lose the race if it's T-1 second when I update it, that makes sense
[21:32:20] <GothAlice> AvianFlu: There are caveats, however. Not all expired records might be cleaned up in a single sweep (it's optimistic), and since it's once per minute, records may easily be stale by up to 59.99 seconds.
[21:32:22] <AvianFlu> it also wouldn't matter for what I'm building right now
[21:33:23] <GothAlice> cheeser: My crazy auth configs I leave to MMS/cloud. They're pretty… confusing at times, I will admit. T_T
[21:33:56] <spacecrab> GothAlice yeah i was watching some linuxconf talks from a couple years ago, and reading through the docs and i was actually over-thinking that at first... "wait it's that simple?"
[21:34:08] <GothAlice> spacecrab: A common issue. ^_^
[21:34:10] <spacecrab> thank you so much for the insight ^^ do you work with the project?
[21:34:34] <GothAlice> spacecrab: I've only been a vocal user and advocate until recently. Hopefully my patch will get in sometime in the next few weeks. :)
[21:34:48] <Derick> GothAlice: which patch is that again?
[21:34:56] <GothAlice> (Allowing negative $push $position indexes to allow insertion from the end of the array.)
[21:35:06] <GothAlice> It's a really trivial patch.
[21:35:23] <spacecrab> GothAlice: very cool. well rock on! i've been getting into a couple different projects and it's just as redeeming to see you reciprocating valuable information to new users and potential evangelists, as it is to help out myself!
[21:35:58] <GothAlice> spacecrab: It never hurts to help.
[21:37:53] <GothAlice> Derick: Some silly bean decided to use size_t for $position offsets. Because a single document can totally store 2^64 array elements. (Hint: it can't. 2 million NULLs is about the limit of a 16MB document. ;)
[21:37:56] <Derick> GothAlice: the size_t to int change is probably not right
[21:38:31] <Derick> 16MB is a define, not hardcoded...
[21:39:27] <Derick> I don't get the change to INT_MAX either (from std::numeric_limits<std::size_t>::max() )
[21:39:52] <GothAlice> I'm using int, not int_32 C++ mocked structure, so I'm using the C99 INT_MAX def.
[21:40:02] <GothAlice> Had some issues finding a std:: to go with int_32.
[21:40:26] <GothAlice> The default to "push to the end" relies on using the maximal value, there.
[21:42:05] <GothAlice> Derick: In my first local draft I accidentally set that to zero and all my $push w/o $position were suddenly head pushes, not tail pushes. ;P
[21:50:08] <GothAlice> Derick: An array of 2 billion NULLs would take up… a hair under 22.35 GiB — if my math is correct: (4+1+1+1+4+2000000000*(1+10+1)+1+1)/1024/1024/1024
[21:50:50] <GothAlice> (Each number in parens there represents an individual "field" from the BSON spec, e.g. int32 prefix size, CString nulls, etc., assuming a 1-character field name for the array.)
[21:51:36] <GothAlice> (A hair under since 9-digit indexes would take one byte less, 8-digit two, etc.)
[22:04:20] <GothAlice> Derick: Honest question, then, what sizes do customers actually override the 16MB limit to? I'd like to keep that in mind with somewhat accurate figures in the future. ;)