PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 4th of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:07:40] <Boomtime> brotatochip: then it sounds like the right configuration for the use case you want addressed
[00:10:54] <brotatochip> unfortunately I can't seem to get a working replica set period. No matter what kind of configuration I use, the initial sync fails
[00:10:56] <brotatochip> replSet initial sync exception: 13106 nextSafe(): { $err: "assertion src/mongo/db/storage/extent_manager.cpp:109" } 4 attempts remaining
[00:36:21] <joannac> brotatochip: how large is the data you're syncing?
[00:36:37] <joannac> how heavy a write load do you have?
[00:37:12] <joannac> pastebin the whole section of logs so we can see the errors around it
[01:13:52] <brotatochip> joannac there is no load at all as I'm using a test environment, and the /var/lib/mongo dir in the primary is 3.6gb
[01:14:43] <brotatochip> here is a pastebin of my config and log, but the log is the same regardless of the config settings, and logs the same thing any time I try to add a secondary http://pastebin.com/p7T4zZ5F
[01:26:48] <joannac> brotatochip: what version?
[01:30:26] <joannac> brotatochip: ls -la <dbpath> on your primary
[02:39:12] <ctcg> Apparently you cannot modify multiple array elements in a single update operation, what would be the most efficient way to do so then?
[02:40:05] <ctcg> Here is some sample code i'm working with: http://pastebin.com/4y52YxCF
[02:40:29] <ctcg> I would like to be able to update all matching elements in an array in case there are duplicated skus
[04:44:35] <ev4l> Is it possible to expire a single filed of a schema at a certain date / time? I see it is possible to expire the netire schema
[04:45:12] <joannac> for what purpose?
[04:45:38] <joannac> you could write your own script for it
[04:50:35] <ev4l> Was using it for caching, but I guess i should just use Redis for that
[07:28:13] <techie28> what if I do not repair database after improper shutdown?
[07:28:21] <techie28> just removed the .lock file manually and the database started again and I am able to connect to it
[07:28:31] <techie28> would this be problematic at times?
[07:30:44] <joannac> yes
[07:31:02] <joannac> well, maybe. do you have journalling on?
[09:02:18] <jelle> what's the best way to use the pymongo with flask, for example now I create a mongodb connection every time a request comes in, but might it be more performant / better to just keep it open?
[10:26:24] <Naeblis> Hi. I upgraded to latest mongoose and am getting mongoose.mongo.BSONPure as undefined.
[10:26:27] <Naeblis> How to fix this?
[13:29:37] <miwa> as I understand it, to provide document-level access control I need to implement Field Level Redaction (basically redacting the whole document I assume). How does this apply when using CRUD-methods rather than aggregate?
[13:59:03] <snuggles> is this still valid? http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/
[13:59:20] <cheeser> it wasn't valid then.
[13:59:22] <StephenLynx> >never
[13:59:27] <StephenLynx> I doubt it was ever valid.
[13:59:33] <StephenLynx> aaaah
[13:59:35] <StephenLynx> that project.
[13:59:46] <StephenLynx> fucking idiots used a non-relational db for a very relational project.
[13:59:53] <StephenLynx> HURR ITS MONGO'S FAULT, WE ARE NOT RETARDS
[14:00:02] <snuggles> ok, so mongodb no longer stored everything in a big blob?
[14:00:10] <StephenLynx> I think it never did.
[14:00:44] <snuggles> ok, so i can have one document relate to others? and query that structure? awesome
[14:00:52] <StephenLynx> no.
[14:00:59] <StephenLynx> I just said, its non-relational.
[14:01:11] <StephenLynx> mongo doesn't enforce relational integrity.
[14:01:17] <snuggles> no talking about that
[14:01:23] <cheeser> http://ayende.com/blog/164483/re-why-you-should-never-use-mongodb
[14:02:16] <StephenLynx> also mongo doesn't implement joins.
[14:02:31] <snuggles> i have products and customers, and these are stored separately, yet i need to related customers to products so i can figure out which customers have purchased a given product, and which products a given customer has purchased
[14:02:37] <snuggles> so far, i'm stumped
[14:02:37] <StephenLynx> so even if you use dbref, the driver will just perform multiple queries to "join" it.
[14:02:56] <StephenLynx> you can have a fake relation.
[14:03:06] <StephenLynx> but you won't be able to join the data when querying.
[14:03:08] <snuggles> ok, sounds like it's still valid.
[14:03:22] <StephenLynx> you either query just for that fake relation or you perform multiple queries.
[14:03:37] <StephenLynx> like
[14:04:02] <StephenLynx> purchases:{customer:customerId} and customers:{customerId}
[14:04:13] <StephenLynx> when you query the purchase you will get the customerId
[14:04:15] <StephenLynx> but nothing else.
[14:04:32] <StephenLynx> and if the customerId changes, you will have to update everywhere you related it.
[14:04:39] <snuggles> idiotic
[14:04:44] <StephenLynx> again
[14:04:49] <StephenLynx> mongo is NOT a relational database.
[14:04:58] <StephenLynx> if you want a relational database you use a relational database.
[14:05:10] <snuggles> i'm talking about relating one document to another. You know, because, like, that's a basic need.
[14:05:10] <StephenLynx> don't complain about how bad your design ends up if you misuse the tool.
[14:05:17] <snuggles> right
[14:05:38] <snuggles> StephenLynx: trying to determine if mongodb is useful for non-trivial stuff. Seems like it's not.
[14:05:41] <snuggles> thanks
[14:06:17] <cheeser> he's a known agitator from other channels. i'm unsurprised he's unwilling/unable to consider larger concepts.
[14:06:25] <StephenLynx> I wonder if he will eventually find out that "trivial" is a very BROAD term.
[14:06:35] <cheeser> i have little hope for that one.
[14:06:38] <StephenLynx> meh
[14:06:49] <StephenLynx> w/e, I don't make an effort throwing pearls at pigs.
[14:08:04] <cheeser> pretty much
[14:09:22] <snuggles> oh forgot to ask, is this still valid? https://aphyr.com/posts/284-call-me-maybe-mongodb
[14:09:35] <snuggles> i may try this relationless thing, but not if it loses my data
[14:09:48] <snuggles> i guess this applies http://hackingdistributed.com/2013/01/29/mongo-ft/
[14:10:27] <StephenLynx> lol, chill
[14:10:51] <StephenLynx> I heard mongo had a bug a year ago or so.
[14:11:07] <StephenLynx> and it actually suffered from corrupting lots of data. Don't got any sources though.
[14:11:16] <StephenLynx> but the answer would be "no".
[14:11:18] <StephenLynx> that is not valid.
[14:11:40] <StephenLynx> I have been around this channel almost every day and haven't heard once about people having this issue.
[14:12:50] <StephenLynx> plus I wouldn't mind much a writer that tries so hard to be funny with images like in that first link.
[14:13:19] <StephenLynx> the second article is pretty old too.
[14:13:25] <StephenLynx> lots have changed since 2013
[14:13:41] <StephenLynx> its default write concern is not even what it used to be.
[14:23:42] <crised_> what is sharding?
[14:24:02] <cheeser> crised_: http://docs.mongodb.org/manual/sharding/
[14:24:02] <crised_> shard the data?
[14:24:19] <crised_> cheeser: you're an expert at mongodb as well? lol
[14:24:26] <saml> think of it as splitting a large collection into multiple smaller collections
[14:24:32] <crised_> I thought you just were a java expert
[14:24:40] <crised_> samthanks
[14:24:44] <crised_> saml: thanks
[14:24:45] <cheeser> a little bit of both :)
[14:24:49] <crised_> 8-)
[14:56:31] <eba> hi all
[14:56:41] <eba> why mongo decreased max namespace name 128 to 120?
[14:56:44] <eba> any idea?
[14:57:42] <eba> how to solve this? i dont want to go back to 3.0
[14:58:40] <eba> any staff here?
[15:01:17] <Boomtime> @eba: when did this change occur?
[15:01:32] <Boomtime> http://docs.mongodb.org/manual/reference/limits/#Namespace-Length
[15:01:38] <eba> after upgrade to 3.0.3
[15:01:41] <eba> from 3.0.1
[15:01:46] <Boomtime> http://docs.mongodb.org/v2.6/reference/limits/#Namespace-Length
[15:01:54] <eba> now i have to change my model names
[15:02:01] <Boomtime> http://docs.mongodb.org/v2.4/reference/limits/#Namespace-Length
[15:02:01] <eba> inorder to make it run
[15:02:23] <Boomtime> there was a change from 2.4 to 2.6 from 123 to 120 bytes, that is the only one i know of
[15:02:53] <Boomtime> it was never 128 bytes
[15:03:00] <eba> i'll show
[15:03:02] <Boomtime> ok
[15:03:06] <eba> http://docs.mongodb.org/manual/faq/developers/
[15:03:18] <eba> 3.0 current, faq for developers. it is written as 128
[15:03:30] <eba> Are there any restrictions on the names of Collections?
[15:03:38] <eba> look at that title.
[15:04:06] <eba> Boomtime it is written as The maximum size of a collection name is 128 characters, including the name of the database. However, for maximum flexibility, collections should have names less than 80 characters.
[15:04:07] <Boomtime> erk.. i think there are several things wrong with that statement
[15:04:21] <Boomtime> characters != bytes
[15:04:51] <eba> how much byte is 1 character????!
[15:05:02] <Boomtime> it's UTF-8 so it can be 1 or more
[15:05:36] <eba> upps yes
[15:05:40] <eba> if it is utf8..
[15:06:26] <Boomtime> anyway, i'm pretty sure that FAQ is wrong.. or at least, something is wrong because these docs references appear to be in conflict
[15:06:31] <Boomtime> imma raise a docs ticket
[15:06:44] <eba> but it was working before the update
[15:06:56] <eba> it was working for a least 3 months
[15:07:04] <eba> at least-.
[15:07:42] <eba> you may say that my orm's fault, but nope.
[15:07:59] <eba> anyways
[15:08:00] <eba> thanks for all
[16:10:38] <__mph__> Hey guys quick question about a query. Is there a way to match where a subdocument field is ONLY EQUAL to a certain value?
[16:11:09] <__mph__> my db is threads. and I want to find where messages.author_id is ONLY equal to a certain value
[16:11:33] <StephenLynx> {author_id : value} ?
[16:12:52] <__mph__> StephenLynx: messages.author_id: value will still return thread documents where message id is another value
[16:13:46] <deathanchor> so you just want the subdoc that has that author_id?
[16:14:05] <StephenLynx> ah
[16:14:20] <deathanchor> or you only want threads that only has that author_id in the subdocs and no other?
[16:14:27] <__mph__> Correct
[16:14:28] <__mph__> the latter
[16:14:33] <StephenLynx> {messages:{$elemMatch: value}}
[16:14:54] <StephenLynx> {messages:{$elemMatch: {$in:value}}} perhaps
[16:15:01] <StephenLynx> [value*]
[16:16:17] <deathanchor> StephenLynx: I don't know if there is a way to eliminate matchs where another message.author_id is there
[16:16:58] <redsand> dont' forget $unwind messages
[16:17:09] <redsand> and match for "messages.author_id"
[16:17:16] <deathanchor> that's if he using the aggregation framework
[16:17:31] <redsand> oh right
[16:17:44] <redsand> he can swap to aggregation framework ;)
[16:18:21] <redsand> i have 2 issues, still outstanding and looking for an answer
[16:18:26] <__mph__> I'm using aggregation
[16:18:47] <__mph__> I've dont that one sec
[16:18:49] <redsand> 1. why can i use partial(true) on find cursor, but there is no equivilent to the aggregaion framework
[16:19:01] <redsand> 2. why does mongo not compress the wire traffic
[16:19:04] <__mph__> { '$unwind': '$messages' }, { '$unwind': '$recipient_ids' }, { '$match': { 'messages.author_id': membership.id } },
[16:19:15] <redsand> its KILLING everyone with 1gbps switches
[16:19:21] <redsand> and also plain dumb
[16:21:06] <brotatochip> just an FYI, this documentation does not necessarily work: http://docs.mongodb.org/v2.6/tutorial/convert-standalone-to-replica-set/
[16:21:35] <__mph__> The unwinding and matching still returns documetns where the subdocument matches other cases :/
[16:21:49] <redsand> you'll only get the whole document
[16:22:01] <brotatochip> The only way to convert my standalone instance to a replica set that worked was to dump the db, wipe /var/lib/mongo, restart mongodb as a replica set, add the members, then mongorestore.
[16:22:10] <redsand> you can try pushing those elems that match into its own array maybe? with elemmatch and $push ?
[16:22:41] <brotatochip> so StephenLynx it's the documentation that's broken, not the feature
[16:22:42] <__mph__> redsand: I want the whole document.. I just don't want the documents that match other cases
[16:23:01] <__mph__> Basically, I'm looking for the case where the current person I'm looking at sent a message and it was never ever responded to
[16:23:02] <redsand> then check your find
[16:23:11] <redsand> doesn't sound like its constructed correctly
[16:23:19] <redsand> we do this in our application
[16:23:26] <redsand> for calculating distinct values
[16:23:39] <redsand> in combination with a sum or avg et al
[16:24:10] <StephenLynx> hm
[16:24:12] <__mph__> https://gist.github.com/michaelhelmick/6573e4e95cf407fc5ca1
[16:24:15] <StephenLynx> still its 2.6
[16:24:19] <StephenLynx> so yeah, whatever.
[16:24:23] <__mph__> redsand: ^
[16:24:30] <redsand> bro im not tech support
[16:24:34] <redsand> i'm the cto of a company
[16:24:39] <redsand> i am giving you guidance
[16:24:39] <brotatochip> and? 2.6 is supposedly fully supported...
[16:24:42] <__mph__> redsand: didn't assume you were.
[16:24:43] <redsand> keep hammering away at it
[16:24:47] <redsand> you'll figure it out
[16:24:54] <redsand> i can take a look in like ... 6 hours
[16:25:05] <redsand> can you stay idle here?
[16:25:15] <__mph__> lol
[16:25:22] <redsand> also, you have a sample of the documents
[16:25:26] <redsand> ?
[16:26:38] <redsand> well let me know if you get a sample of the documents
[16:26:46] <redsand> otherwise eyeballing this just won't be enough
[16:30:20] <__mph__> redsand: https://gist.github.com/michaelhelmick/adf07197ff46dbc92762
[16:30:56] <redsand> thanks michael
[16:31:30] <redsand> i just starred ur repo so you can see my user
[16:32:04] <__mph__> :thumbsup:
[16:36:42] <__mph__> Can I match on a case in the thread
[16:36:59] <__mph__> like $eq: 1, $nin: '$recipient_ids'
[16:43:10] <__mph__> can I match on a case based off of values in the document? (i.e. like $eq: 1, $nin: '$recipient_ids)
[16:54:03] <brotatochip> is anyone available to help explain to me the best way to set up a failover for disaster recovery? i tried following this guide http://docs.mongodb.org/v2.6/tutorial/deploy-geographically-distributed-replica-set/ but when both the primary and the arbiter become unreachable, the secondary does not elect itself a primary.
[16:54:54] <brotatochip> what worked was spinning the arbiter back up, however, that document recommends that you keep the arbiter in the same DC as the primary, so if SHTF in that main DC, there is no failover...
[16:57:35] <deathanchor> are you talking about hot failover, warm failover or cold recovery?
[16:58:27] <deathanchor> and are you also talking about machine failure, DC failure or nuclear winter failover?
[16:58:28] <brotatochip> any of the above deathanchor, none work when following that guide with a 3 member set - 1 primary, 1 secondary, and 1 arbiter
[16:58:36] <brotatochip> DC failure
[16:59:25] <deathanchor> is your app (accessing the DB) in the same DC as primary or secondary?
[17:00:00] <brotatochip> i have redundant hardware in both sites, i will configure the DR environment to read/write from the secondary, spin them up in the event of a disaster
[17:00:25] <brotatochip> so like i said, cold, warm, or hot failover will all work
[17:00:26] <deathanchor> your app should know about the primary and all secondaries
[17:00:46] <deathanchor> voting works as majority of the known number of voters
[17:01:01] <brotatochip> no, my app shouldn't, as my main production app is on the east coast and my DR site is on the west coast
[17:01:13] <deathanchor> assuming primary secondary and arbiter has 1 vote, you need two to communicate so that you have quorum
[17:01:31] <jigax> is it possible to use $set with $push in one query?
[17:01:34] <brotatochip> ok, so should I disregard the guide and put my arbiter in the DR site?
[17:02:03] <deathanchor> no, because if it ever loses communication with your primary, your primary will stepDown
[17:02:23] <brotatochip> hm
[17:03:11] <deathanchor> my setup is 3 replicas, 3rd one is hidden we make backups from it nightly
[17:03:19] <deathanchor> all in same DC.
[17:03:37] <deathanchor> if the DC dies, we can just bring up a backup if needed
[17:04:05] <brotatochip> right, my boss has tasked me with setting up geographical redundancy, so I'm just trying to find the best way to keep the DBs in sync so we lose as few writes as possible
[17:04:26] <deathanchor> you don't want elections then switching your primary from region to region
[17:05:05] <brotatochip> well i tried master slave replication using a replica set, and I was unable to force the secondary to become primary
[17:05:38] <deathanchor> you have to think with quorum requirements for your scenarios
[17:06:08] <brotatochip> do you think I should try to use the legacy master/slave replication deathanchor ?
[17:06:14] <deathanchor> you can do secondary+arbiter in one DC, and primary in another. Then set priority to primary higher
[17:06:41] <brotatochip> yeah but like you said if the primary loses contact with the arbiter, won't it step down?
[17:06:50] <deathanchor> but know that any drop of network between DC will cause eletion and the secondary would take over
[17:07:23] <brotatochip> the secondary stepping up won't cause any headache, I can force it to step back down manually if needed, i just can't have the primary stepping down
[17:07:25] <deathanchor> that's what I like to call the "hot" failover
[17:07:58] <deathanchor> the primary will stepdown if there is a disconnect between DC
[17:08:10] <deathanchor> Like Highlander: there can be only one
[17:08:52] <unseensoul> Hi
[17:09:12] <unseensoul> What's the best way to retrieve the highest value from a column?
[17:09:22] <brotatochip> right, so do you know of any configuration that would give me any kind of failover while keeping 2 members in sync deathanchor, without the risk of the primary stepping down?
[17:09:45] <jigax> hi, anyone know if its possible to use $set and $push in the same query? i'm currently getting an error
[17:11:36] <Boomtime> @unseensoul: sort by the field you want, limit to 1 result
[17:12:03] <deathanchor> brotatochip: that's not how mongo works as far as I know
[17:12:11] <Boomtime> @jigax: yes, you can use $push and $set in the same *update* (i assume this is what you meant), but they must refer to different fields
[17:12:49] <jigax> @Boomtime im currently trying exactly that. but get an error
[17:13:12] <Boomtime> "an error", can you elaborate?
[17:13:27] <brotatochip> so looks like my only option is to try legacy master/slave replication, or have a 3 member set with 2 arbiters
[17:13:55] <deathanchor> brotatochip: you will always have 1 primary, you can't have 2 for one set.
[17:13:57] <Boomtime> @brotatochip: what are you trying to do? sorry, i missed the start
[17:14:03] <brotatochip> i know
[17:15:20] <brotatochip> i'm just thinking maybe a 5 member set - 2 in the main DC with 1 arbiter, 1 in the DR site with the other arbiter - should prevent the primary from stepping down if my VPN goes down
[17:15:59] <brotatochip> And it also should cause a failover if the main DC goes down
[17:16:02] <Boomtime> brotatochip: the arbiters in that arrangement are redundant
[17:16:19] <brotatochip> Yes, but I still have an odd number of votes
[17:16:46] <deathanchor> brotatochip: it's not odd number it's majority that wins
[17:16:53] <Boomtime> if you have 5 members, where 2 are arbiters, and you remove the 2 arbiters, then you still have an odd number of votes
[17:16:53] <jigax> @Boomtime please check this jsbin http://jsbin.com/hepixoqazi/1/edit?html,css,js,output
[17:16:54] <jigax> @Boomtime if i comment out $set or $push the code works fine. but not with both
[17:16:56] <deathanchor> your failover won't win if 3 votes are missing from the first DC
[17:17:07] <brotatochip> yes Boomtime, I'm aware of that
[17:17:18] <brotatochip> oh, damn
[17:17:34] <brotatochip> so how the fuck do you configure mongodb replication for disaster recovery
[17:18:06] <brotatochip> I've spent nearly 3 days of work on this...
[17:18:23] <Boomtime> @jigax: and what is the _error_?
[17:18:50] <Boomtime> @brotatochip: if you have only 2 DCs then one of them is critical, it is logistically impossible to have a majority in both places
[17:19:01] <Boomtime> you need 3 DCs
[17:19:21] <Boomtime> the usual recommendation is to have 2 data-bearing DCs, and one arbiter (light-weight) DC to break the tie
[17:19:23] <brotatochip> http://docs.mongodb.org/v2.6/tutorial/deploy-geographically-distributed-replica-set/ so what's the point of this then?
[17:20:05] <unseensoul> What's the best way to retrieve the highest value from a column?
[17:20:07] <jigax> @Boomtime error 500 and record is not updated
[17:20:18] <deathanchor> brotatochip: the second DC has a replicamember with priority:0 it will never win.
[17:20:37] <Boomtime> @brotatochip: you are conflating disaster recovery with availability - with 2 DCs you get data protection, but you might not have a primary, you might not have availability
[17:21:13] <brotatochip> right, so that document provides exactly zero DC fault tolerance
[17:21:28] <Boomtime> it provides distaster recovery, you lose no data
[17:21:46] <Boomtime> if you want to maintain availability in the face of any fault, then you need 3 DCs
[17:21:48] <brotatochip> how exactly does it provide disaster recovery if you can't elect a new primary?
[17:22:18] <Boomtime> you can recoer from a disaster
[17:22:18] <vinayus> hi i'm facing this error when i run mongodump on windows 8.1
[17:22:18] <jigax> @Boomtime also see undefined in the console but not sure what is undefine. because when i comment either line query works just fine
[17:22:24] <deathanchor> brotatochip: reconfig( configurationjson, {force :1 })
[17:22:29] <vinayus> Failed: error getting collections for database `nCloudR`: error running `listCollections`. Database: `nCloudR` Err: WSARecv tcp 127.0.0.1:49356: i/o timeout
[17:22:38] <brotatochip> deathanchor reconfig only works on the primary
[17:22:41] <Boomtime> @jigax: please try the command in the mongo shell
[17:22:42] <vinayus> can anyone help me with this issue?
[17:22:51] <deathanchor> brotatochip: note the { force : 1 }
[17:23:14] <Boomtime> @brotatochip: reconfig can be forced at any member, but it isn't recommended since that would cause that member to go rogue
[17:23:16] <deathanchor> but that will break the replicaSet
[17:23:20] <brotatochip> so that command will work on a secondary, regardless of priority or voting deathanchor ?
[17:23:27] <brotatochip> ...
[17:23:30] <MacWinner> do object id's need to be globally unique? eg, user1 = { _id: 1, name: 'joe', bikes: [{_id: 1, type: 'mountain'}, {_id: 2, type: 'racing'}]} i'm migrating from mysql and some of my tables have same ids..
[17:23:38] <deathanchor> brotatochip: correct, but it breaks the replicaSet
[17:23:49] <brotatochip> define "breaks"
[17:24:09] <Boomtime> @MacWinner: _id only needs to be unique per collection
[17:24:27] <MacWinner> got it. thanks!
[17:24:34] <brotatochip> like, could I just do another reconfigure and fix it? or do I need to rebuild the entire replica set deathanchor ?
[17:25:00] <deathanchor> let's use the setup on the webpage. if DC1 got nuked, you only have DC2, you make that member a single member replicaSet and spin up new machines to become secondaries.
[17:25:03] <Boomtime> @brotatochip: can you please explain what you think mongodb should do in the case of 2 DCs where either one is lost?
[17:25:28] <brotatochip> that is a separate issue outside my use case Boomtime
[17:25:43] <Boomtime> so you have 3 DCs?
[17:26:52] <vinayus> guys any help for me?
[17:27:21] <StephenLynx> have you tried using GNU/Linux?
[17:27:34] <Boomtime> @vinayus: "i/o timeout" <- network problem?
[17:28:05] <brotatochip> Boomtime I've explained my use case I think, but let me explain further - I have 2 DCs, one on the east coast, one on the west coast, the east coast DC hosts production with a standalone mongodb instance. I simply need any kind of failover so that if the east coast DC goes down, my DR site can take its place.
[17:28:17] <vinayus> yes i think.. but i dont know why thats happening in localhost..
[17:28:40] <vinayus> i'm new so not much experience with it..
[17:28:42] <deathanchor> hence my hot/warm/cold questions...
[17:29:09] <brotatochip> yes deathanchor, to which I replied any of them will work
[17:29:51] <brotatochip> hot would be great but not necessary, I can do a manual one
[17:31:26] <brotatochip> adding a 3rd DC increases failure points and reduces fault tolerance
[17:31:34] <Boomtime> @brotatochip: impossible with only 2 DCs, how can the DR site know that it isn't simply a connectivity problem? i.e that east coast is actually operationally fine
[17:32:04] <vinayus> @Boomtime any tips on how to fix that in win8.1?? Any network interface issue?
[17:32:24] <Boomtime> the only physically possible way the two sites can determine which one is actually at fault, is by having an arbiter break the tie and vote for the one it can see
[17:33:21] <brotatochip> Boomtime: what about a manual election to primary in the event of a DC failure?
[17:33:22] <Boomtime> if you host that arbiter in one of the 2 DCs, then that DC becomes critical, the other one can never determine the difference between a connectivity problem and a meteorite
[17:33:48] <Boomtime> there is no such thing as a manual election - do you mean a forced reconfig?
[17:34:11] <Boomtime> if you reconfigure the replica-set, then you have broken the symmentry - this can be done safely if you are batman
[17:34:51] <brotatochip> what if I have 2 arbiters - one in the prod site, one in the DR site, keep the DR arbiter offline until SHTF, spin it up, will it elect the secondary to become primary if it can't reach the primary?
[17:35:19] <Boomtime> you have 5 members, 3 in primary site, 2 on the other, same problem
[17:35:49] <Boomtime> it is mathematically impossible to divide a number by 2 and have more than a half in each of the two parts
[17:35:51] <brotatochip> no actually I'm thinking a 4 member set -1 primary, 1 secondary, 2 arbiters, but keep the second arbiter offline until I actually need it
[17:36:08] <Boomtime> no, it is either part of the set or it is not
[17:36:27] <Boomtime> if the other members know about it, they'll want it around, and expect it to vote
[17:36:39] <Boomtime> if the other members don't know about it then it's of no use
[17:36:44] <brotatochip> Well I have no other options here other than to test that theory
[17:36:53] <brotatochip> but they will know about it Boomtime
[17:36:55] <Boomtime> then you will need to reconfig
[17:37:15] <brotatochip> there will be 4 members in the set, one will just be offline until its vote is needed as the main DC goes down
[17:37:16] <Boomtime> again, it can be done, but it can be dangerous
[17:37:36] <Boomtime> if you have 4 members in the set, then you lose majority no matter which DC goes down
[17:37:47] <Boomtime> you will have no primary if you even have a connectivity problem
[17:37:48] <brotatochip> even if there are only 3 members online
[17:37:56] <Boomtime> there are 4 members in the ste
[17:37:59] <Boomtime> *set
[17:38:05] <brotatochip> no, let me try to explain this again
[17:38:07] <Boomtime> "offline" is not a condition
[17:38:14] <brotatochip> health would be 8
[17:38:15] <Boomtime> it is either in the set, or it isn;t
[17:38:29] <Boomtime> is it in the set?
[17:38:41] <brotatochip> yes, however, it would be unreachable
[17:38:56] <Boomtime> then you have 4 members
[17:39:01] <brotatochip> right
[17:39:10] <Boomtime> the 3 functional ones just see one as down at all times
[17:39:16] <brotatochip> exactly
[17:39:23] <Boomtime> you lose either DC, you don't have a primary
[17:39:45] <Boomtime> "majority" of 4 is 3
[17:40:02] <Boomtime> when the set has 4 members, you need 3 votes to obtain primary
[17:40:04] <brotatochip> ok, how about in this 4 member set, the DR secondary is non voting, and I keep both arbiters up all the time?
[17:40:26] <Boomtime> then if you lose the DC with 2 votes you have no primary
[17:40:37] <brotatochip> ugh
[17:40:42] <Boomtime> yeah, maths
[17:40:58] <brotatochip> so I would need an odd number in both sites
[17:41:09] <brotatochip> how about a 6 member set, 4 arbiters
[17:41:14] <brotatochip> that seems so utterly ridiculous
[17:41:15] <brotatochip> lol
[17:41:20] <Boomtime> and it does nothing
[17:41:27] <Boomtime> just stop
[17:41:40] <Boomtime> it is mathematically impossible to divide a number by 2 and have more than a half in each of the two parts
[17:41:42] <brotatochip> so basically i'm fucked and I've wasted over 2 days of work
[17:41:54] <brotatochip> because mongodb does not support disaster recovery failover
[17:42:00] <brotatochip> unless you have 3 data centers
[17:42:11] <Boomtime> you cannot achieve write availability with only 2 DCs under all possible fault conditions
[17:42:20] <Boomtime> right!
[17:42:22] <Boomtime> you got it
[17:42:36] <brotatochip> so now I can join the bandwagon of mongodb hating sys admins
[17:42:36] <brotatochip> yay
[17:42:39] <Boomtime> NO DATABASE does what you want
[17:42:42] <redsand> yeah
[17:42:44] <Boomtime> if they say they do, they are lying
[17:42:45] <brotatochip> uh, bullshit
[17:42:46] <StephenLynx> lol
[17:42:48] <brotatochip> mysql replication works just fine
[17:42:53] <redsand> g'luck with keeping the replication in sync
[17:42:58] <Boomtime> indeed
[17:43:01] <brotatochip> RDS handles that quite well so far
[17:43:13] <Boomtime> aparently you haven't tested it very far
[17:43:16] <redsand> we can't do geo location due to replication with no compression
[17:43:22] <cheeser> mongo replication works just fine, too.
[17:43:27] <redsand> if you have no writes
[17:43:28] <brotatochip> i don't need geolocation
[17:43:29] <redsand> yes
[17:43:38] <brotatochip> i just need a secondary to become primary in the event of a DC failure
[17:43:43] <redsand> if you try and write 10k/sec ... which should be fairly easy
[17:43:46] <redsand> it will shit itsself
[17:43:49] <redsand> even with wired tiger
[17:43:58] <redsand> i have mongo showing up onsite monday to prove it
[17:44:11] <MeStesso> Hi! I’m looking at setting up a local (in-house) MongoDB instance to replicate the contents of the database on EC2, for backup purposes. Our budget is very limited so I can’t get VPN equipment… We’re also behind a firewall so we can’t accept connections from outside; however, we do have a static ip. I’ve been reading all the docs and I assume that I can’t do a replica set (with an hidden slave), but I can do master-slave
[17:44:12] <MeStesso> replication… is that correct?
[17:44:32] <brotatochip> ROFL MeStesso gl with that
[17:44:44] <cheeser> use MMS backup
[17:44:48] <MeStesso> brotatochip: what’s so funny? try working in a startup
[17:44:58] <MeStesso> cheeser: can’t do that for comliance requirements
[17:45:04] <redsand> MeStesso: i work for a startup. lemme save you 2 years
[17:45:05] <redsand> don't use mongo
[17:45:07] <cheeser> compliance with what?
[17:45:07] <brotatochip> oh actually your use case isn't so bad, sorry, we've been discussing mongodb replication in here for some time
[17:45:11] <redsand> go elsewhere
[17:45:21] <redsand> if its write heavy app
[17:45:22] <Boomtime> @brotatochip: replication is not your problem
[17:45:28] <redsand> if its update heavy or read heavy... great
[17:45:34] <redsand> better success factor
[17:45:46] <Boomtime> replication across 2 DCs works just dandy, and no matter what happens to one DC your data will be safe in the other one
[17:46:01] <redsand> until you begin to push "big data" to the other DC
[17:46:03] <MeStesso> cheeser: some customers of ours are companies with some requirements. they authorized us to keep data in EC2 but not in MMS
[17:46:08] <Boomtime> and when you get the second DC rebuilt, or decide you don;t need it anymore, you can use the data in the second location
[17:46:09] <redsand> hope you have OC192
[17:46:10] <brotatochip> Boomtime what about legacy master/slave replication?
[17:46:22] <cheeser> what about it?
[17:46:47] <Boomtime> @brotatochip: i want you to explain your understanding of the "primary" role
[17:46:51] <brotatochip> would the slave be able to become a master without it breaking anything
[17:46:59] <Boomtime> i think there is a misunderstanding here
[17:47:03] <MeStesso> so… about my question… can I do that or not?
[17:47:03] <cheeser> why would you use master/slave today?
[17:47:26] <brotatochip> cheeser should I copy paste my use case again?
[17:48:10] <cheeser> does it require master/slave? because there's almost 0 reason to use that today.
[17:48:25] <brotatochip> cheeser I have 2 DCs, one on the east coast, one on the west coast, the east coast DC hosts production with a standalone mongodb instance. I simply need any kind of failover so that if the east coast DC goes down, my DR site can take its place.
[17:48:41] <cheeser> that works
[17:48:46] <cheeser> i worked at a shop that did just that.
[17:48:54] <brotatochip> what configuration do I need to achieve this?
[17:49:22] <cheeser> iirc, it was just replSets and arbiters
[17:49:23] <MeStesso> brotatochip: from my understanding of the docs, replset with an hidden slave
[17:49:47] <brotatochip> cheeser: how many?
[17:49:53] <cheeser> or a lower priority to favor the east coast
[17:49:57] <cheeser> brotatochip: i don't recall
[17:50:20] <brotatochip> again, i've been through this discussion with Boomtime, the maths don't work
[17:50:31] <Boomtime> it is not possible, without a reconfig
[17:50:44] <cheeser> though Boomtime(?) is right that you'd need a 3rd location to ensure quorum voting
[17:50:45] <MeStesso> so can anyone answer my question. i don’t think it’s hard… do you think I can do what I’m planning to do? use master/slave for backing up, as I can’t use replSet because the office is behind a firewall?
[17:50:58] <brotatochip> which means in the event of a disaster, i'd have to do a forced reconfig
[17:51:06] <Boomtime> that is only to assure a primary - if all you want to maintain is read capability then you get that already
[17:51:12] <cheeser> MeStesso: don't use master/slave
[17:51:13] <deathanchor> MeStesso: set your slave to hidden it will never vote for itself
[17:51:36] <brotatochip> yeah unfortunately I need write capability too Boomtime :/
[17:51:48] <MeStesso> deathanchor: but I can’t use hidden slaves (replset) if I’m behind a firewall… because they can’t communicate with each other. correct?
[17:51:53] <Boomtime> then you have to have either 3 DCs, or learn how to do reconfigs safely
[17:52:09] <Boomtime> the 3rd DC can be very lightweight btw
[17:52:17] <Boomtime> you would get away with a micro in AWS
[17:52:18] <deathanchor> MeStesso: your sets need to beable to connect to each other
[17:52:22] <brotatochip> Boomtime if there are docs or guides or anything you could point me to to learn how to execute safe reconfigs, I'm all ears
[17:52:32] <MeStesso> deathanchor: that’s why i was thinking of master/save.
[17:52:34] <MeStesso> *slave
[17:53:20] <deathanchor> set a replSet of { primary : votes 1 and hidden secondary votes 0 if anything}
[17:53:22] <MeStesso> deathanchor: so… other option?
[17:53:42] <cheeser> MeStesso: you've been given several multiple times now
[17:53:44] <MeStesso> but the primary can’t connect to the secondary
[17:53:49] <deathanchor> your members need to be able to talk to get the data.
[17:53:51] <MeStesso> because there’s a firewall
[17:54:16] <MeStesso> that’s why i’m asking about master/slave. it’s my understanding only the slave needs to connect to the master, but not vice versa. am i correct?
[17:54:33] <deathanchor> it is two way communication
[17:54:57] <deathanchor> how can the primary verify that the secondary says who it is?
[17:55:05] <brotatochip> MeStesso: you don't have any access to add a firewall rule?
[17:55:26] <MeStesso> brotatochip: if I had, i’d tell you :) I can control the firewall behind the master, but not behind the slave
[17:55:46] <brotatochip> damn, yeah, I don't think you can do anything there without a two way communication
[17:55:50] <MeStesso> brotatochip: we’re renting office space in a coworking place, so we share the network. that’s the best I can do
[17:55:54] <Boomtime> @brotatochip: http://docs.mongodb.org/manual/tutorial/reconfigure-replica-set-with-unavailable-members/
[17:56:07] <brotatochip> how about a VPN?
[17:56:20] <MeStesso> deathanchor: what does “verify that the secondary says who it is” mean?
[17:56:39] <MeStesso> brotatochip: need new networking equipment and ~$40/month for Amazon VPC. boss says no
[17:57:09] <brotatochip> Thanks Boomtime ! also thanks deathanchor and cheeser and Boomtime again for explaining these things to me. You've really helped my understanding of MongoDB and replication and now I at least know what my options are, however limited
[17:57:18] <Boomtime> @brotatochip: you should consider forced reconfigruation to be dynokryptonite to be used in anger only if you are covered in petrol near open flames
[17:57:49] <brotatochip> right, because how would I get all the new writes back to the original primary after the fact
[17:57:57] <Boomtime> very carefully
[17:58:42] <cheeser> new writes would sync back to the now secondaries in the original DC. when that's done, you can step down the DR primary
[17:59:00] <Boomtime> and reconfig to remove the spare members you added to achieve that situation
[17:59:13] <Boomtime> *after* the original DC has caught up
[18:00:03] <Boomtime> btw, if the original DC comes back, you must kill it fast unless it can communicate with the restore DC - otherwise the original DC wil believe it can see a majority of the original members
[18:00:48] <Boomtime> this is the danger of force reconfig - you should test this, make sure you understand the permutations, understanding is key to making that situation work
[18:00:49] <brotatochip> it's actually ok if that happens Boomtime because then I can just rs.stepDown that primary as no traffic will be hitting it until I reconfigure route 53
[18:01:15] <brotatochip> oh you bet I'm going to test it lol
[18:01:47] <Boomtime> if the original DC votes in it's own primary, with you forcing another one to exist in the remote location, the replica-set will have diverged and cannot be reconciled easily
[18:03:03] <brotatochip> ok, the thing is, i think i'll just have to kill the VPN so that when the original primary comes back up, it will just pick up where it thinks it left off
[18:04:17] <cheeser> you could just go in to read only mode during the DC down time
[18:12:20] <svm_invictvs> Well, my lucene/gridfs storage driver seems to work like a charm
[18:12:20] <MacWinner> hi, I'm using the latest versions of mongo 3.0.3 and mongoose 4.0.4. I have a simple model method to save some usersettings. http://pastebin.com/hdvwYFnR Anyone know why this hangs when I call self.save() ? my OS shows 100% cpu usage and the save never seems to return. I'm using iojs + promises as well
[18:12:31] <svm_invictvs> After I finally figured out how Mongo seeks files.
[18:12:33] <MacWinner> it seems like I'm missing something simple
[18:13:04] <svm_invictvs> I have a silly question, is there a reason why the Java grid FS drivers can't just seek to any point in a file and open an input stream from there?
[18:13:12] <svm_invictvs> or...just seek the stream?
[18:21:29] <brotatochip> cheeser I can't go into read only mode during the downtime, mongodb is the back end of our social platform with over a million users
[18:21:49] <deathanchor> Boomtime: i do worse than force reconfig, I drop local dbs and set up new shardsets.
[18:23:02] <cheeser> brotatochip: fair enough
[18:23:06] <brotatochip> our client would be pretty pissed if their customers were unable to "like" each others posts :-P
[18:23:20] <brotatochip> let alone post comments and what not
[18:26:50] <StephenLynx> MacWinner I have been using mongo and io for a while
[18:26:57] <StephenLynx> I suggest not using mongoose.
[18:27:03] <StephenLynx> nor promises.
[18:27:58] <MacWinner> StephenLynx, do you use something else for ODM? particularly interested in simple hooks into update/save/delete as well as having custom methods
[18:28:00] <StephenLynx> brotatochip hm, using mongo for a social platform seems like a bad decision, if you ask me. but I know that is unrelated to your issue.
[18:28:05] <StephenLynx> MacWinner no.
[18:28:09] <StephenLynx> just the driver.
[18:28:57] <MacWinner> StephenLynx, do you create your own custom object? that makes the mongo calls? any pointers to some example projects..
[18:29:03] <StephenLynx> no.
[18:29:11] <StephenLynx> you get objects from the driver.
[18:29:18] <StephenLynx> so theres is no need in creating them.
[18:29:29] <StephenLynx> gitlab.com/mrseth
[18:29:32] <StephenLynx> my projects.
[18:30:07] <StephenLynx> lynxchan and bck_lynxhub uses mongo. io-boot is some sort of minimalist framework for an issue I had at work.
[18:31:03] <MacWinner> thanks, I'll check it out
[18:31:29] <brotatochip> StephenLynx I've read the rant from the webapp programmer at Diaspora if that's what you are referring to, unless you have another reason that MongoDB is not a good backend for a social app
[18:32:06] <StephenLynx> you don't have joins.
[18:32:12] <StephenLynx> just because of that.
[18:32:29] <brotatochip> right, so there is redundant data
[18:32:29] <cheeser> brotatochip: that's a terrible post
[18:32:39] <brotatochip> i agree completely cheeser
[18:32:50] <StephenLynx> and you have to update all the data on every change.
[18:33:27] <StephenLynx> the other option being querying the database like crazy.
[18:33:49] <StephenLynx> that is why, from what I have seen so far, mongo is not a very good choice for general social applications.
[18:33:55] <brotatochip> right
[18:34:03] <StephenLynx> but again, that is not the topic at hand.
[18:34:17] <brotatochip> no but it's a good point of discussion and I thank you for bringing it up StephenLynx
[18:34:22] <StephenLynx> np
[18:34:33] <StephenLynx> after all, the system is already built, isn't it?
[18:34:37] <StephenLynx> so you can't change it now.
[18:35:00] <brotatochip> yeah pretty much, it would take a pretty hard case to get it to switch
[18:35:06] <brotatochip> do you think redis would be any better?
[18:35:14] <StephenLynx> I haven't used redist. but
[18:35:22] <StephenLynx> from what I read, it serves mostly JUST as a chace.
[18:35:24] <StephenLynx> cache*
[18:35:35] <brotatochip> ah, hm
[18:35:39] <StephenLynx> I read that as soon as your data is larger than your RAM, it becomes really bad.
[18:36:06] <StephenLynx> I would personally just use a relational DB for that case and a cache for whatever needs a cache.
[18:36:14] <StephenLynx> maybe redis, maybe another tool.
[18:36:49] <brotatochip> I'm not sure if that's true in our case as mongodb data dir is 32gb, the machine has 30gb ram and there is 3.2gb ram free StephenLynx
[18:36:59] <brotatochip> oh, you mean for redis?
[18:37:03] <StephenLynx> yes.
[18:37:28] <StephenLynx> mongo uses the disk and has its own cache.
[18:37:31] <brotatochip> hm, I'm not sure if our social platform is engineered for a relational db
[18:37:38] <StephenLynx> really?
[18:37:41] <StephenLynx> that would be odd.
[18:38:03] <StephenLynx> I mean, mostly you are referencing and joining data.
[18:38:09] <StephenLynx> in social applications.
[18:38:42] <StephenLynx> so you just need to know the id of the user that did what.
[18:39:00] <MacWinner> so if you have a document retreived from mongo, and you need custom methods like "sayHello()" or whatever other business logic you have, what's the best way to do this? I'm coming from mysql+php way of doing things, so I'm guessing I'm just htinking about it wrong with mongo+nodejs.
[18:39:01] <StephenLynx> of course the application in its current state is not engineered for a rdb
[18:39:20] <StephenLynx> what do you mean custom methods?
[18:39:39] <StephenLynx> have functions in the returned objects like they are instances of classes?
[18:39:46] <MacWinner> yeah
[18:39:48] <brotatochip> StephenLynx: our social platform only supports redis, mongodb, and Level
[18:39:50] <StephenLynx> javascript has no classes, so that is kind of pointless.
[18:40:02] <StephenLynx> what does that social platform does?
[18:40:11] <brotatochip> www.nodebb.org
[18:40:15] <StephenLynx> lets see
[18:40:34] <StephenLynx> ah, a forum.
[18:40:37] <StephenLynx> that makes more sense.
[18:40:38] <brotatochip> it's like a forum with topics, posts, comments, friends, chats, etc
[18:40:59] <StephenLynx> ok, nevermind. when you mean "social platform" I think more of facebook.
[18:41:21] <brotatochip> ah, yeah, it's not quite facebook, although we do have activity streams
[18:41:25] <MacWinner> so is the pattern to apply some sort of decorator to the returned objects from mongo? or set the prototype of the returned object to something with all yoru custom methods you need?
[18:41:52] <StephenLynx> I just have a function that uses the array of objects, MacWinner
[18:42:23] <StephenLynx> I want to save X? saveX(myX)
[18:42:29] <StephenLynx> and not myX.save
[18:42:41] <StephenLynx> because, again, js doesn't have classes.
[18:42:56] <StephenLynx> fiddling with prototypes is good for libraries.
[18:43:07] <StephenLynx> so you need new Something()
[18:44:00] <MacWinner> cool, alrighty, thanks for the tips
[18:44:04] <StephenLynx> np
[18:44:48] <StephenLynx> lol look at that
[18:44:52] <StephenLynx> they are selling forums now.
[18:45:01] <MacWinner> StephenLynx, i'm looking at this project calling mongorito.. seems interesting too
[18:45:09] <StephenLynx> and its proprietary
[18:45:16] <StephenLynx> what a crazy world we live
[18:45:27] <StephenLynx> MacWinner lets see
[18:45:48] <StephenLynx> look like crap.
[18:46:15] <StephenLynx> any project that starts with "awesome" in its description and says it is failing its tests goes straight to my trash bin.
[18:46:52] <StephenLynx> plus its built on top of another ODM
[18:46:59] <StephenLynx> so its bloat ^2
[18:49:47] <StephenLynx> brotatochip funny thing you guys have that product. I released something similar a couple of months ago.
[18:49:59] <StephenLynx> but I had only an android client
[18:50:18] <StephenLynx> so getting users was impossible without promotion
[18:50:23] <StephenLynx> and I wasn't in the mood to promote.
[18:50:35] <StephenLynx> so I shut it down 2 weeks after release :v
[18:53:52] <brotatochip> lmao
[18:54:36] <StephenLynx> it surprises me that people pay to have forums.
[18:55:22] <Derick> forums, ew
[18:55:51] <StephenLynx> forums rule
[19:18:46] <deathanchor> you mean like google groups?
[19:34:14] <StephenLynx> me?
[19:41:38] <_ari> hmm
[19:41:56] <_ari> can i do an update on my aggregation?
[19:42:13] <_ari> in mongo or mongoose
[19:42:51] <StephenLynx> no
[19:43:57] <_ari> bleh
[19:44:22] <deathanchor> _ari: you have reached a point where coding needs to involved
[19:45:43] <_ari> well
[19:56:52] <_ari> deathanchor: i'm outputing my aggregation and looping over the aggreagation to update
[19:56:58] <_ari> but it doesn't seem to be updating
[19:58:37] <_ari> what's a good method to group all elements in a document together and update
[20:39:18] <Iniglo> Hey guys, I'm trying to create a blog with Mongo as the database but it won't allow me to store blog post content in the database. I keep getting an ILLEGAL error because of the newlines inside the content entries. Anyone know how to work around that?
[20:39:36] <cheeser> doesn't sound like a mongo error.
[20:39:54] <cheeser> (having helped build a CMS on top of mongodb)
[20:40:24] <Iniglo> Yeah you're right I'm calling an insert using meteor, sorry that probably makes a huge difference lol
[20:40:59] <Iniglo> So it's a meteor issue not a mongo issue with the newlines?
[20:41:12] <Iniglo> I just figured it was database related, first time working with mongo
[20:43:06] <Iniglo> still getting the same error inside the mongo console
[20:43:19] <Iniglo> SyntaxError: Unexpected token ILLEGAL
[20:45:44] <StephenLynx> I suggest not using frameworks or ODMs.
[20:46:12] <StephenLynx> unless you already already familiar with the base tools and know what kind of compromises you are making in using these additional tools.
[21:08:49] <okwodepi> hi
[21:08:53] <okwodepi> i am using mongoose
[21:08:59] <okwodepi> but I can't create an instance
[21:09:07] <okwodepi> after I define the model and schema
[21:34:47] <StephenLynx> okwodepi I suggest not using mongoose.
[21:45:22] <okwodepi> why?
[21:56:35] <StephenLynx> its bad.