PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 22nd of July, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[03:22:12] <comfytoday> trying to add user to admin, with root role. Error: coudln’t add user: not master… first time using 3.2.7, can’t find anything in docs…
[03:22:31] <comfytoday> i’m using db.createUser({user:"admin",pwd:"<password>",roles:["root"]});
[03:28:24] <_Cory_> Is there any examples on 3.* usage of the com.mongodb.ReflectionDBObject? I keep getting ClassCastExceptions, the BSON string appears valid however.
[03:37:31] <cheeser> why are you using that class directly?
[03:44:08] <_Cory_> Codec's are soo long, why use them when you can use reflection, I was tempted to use Gson or the JSON class, but I wanted it to deseralize with the collection
[03:44:24] <_Cory_> I can't find anything in the docs on how to use it though
[03:44:52] <cheeser> codecs are what now?
[03:45:02] <cheeser> are you just trying to serialize a pojo?
[03:45:49] <_Cory_> Indeed I am, erm they're a trumendous amount of effort for the end result
[03:46:51] <cheeser> why not just use morphia?
[03:49:12] <_Cory_> Out of curiosity, how comes it's not bundled?
[03:49:38] <cheeser> bundled with what?
[03:52:04] <_Cory_> With the driver.
[03:53:03] <cheeser> well, funny story about that. i'm working on that at the moment. at least in broad strokes.
[03:53:27] <cheeser> but it's just a maven pom entry either way. just add morphia to your pom and you get the driver for "free."
[04:01:57] <_Cory_> Hahah sexy, might I say good job and thank you! Morphia looks and seems perfect ;)
[04:04:50] <cheeser> great. i'm here if you run in to problems.
[04:23:16] <_Cory_> Thanks man, I'll stick around ;P
[04:23:58] <cheeser> mv cheeser /dev/bed
[05:25:27] <_Cory_> That makes two
[06:10:41] <rihbyne> hi anyone there
[07:44:44] <rihbyne> hi anyone ther
[08:30:22] <obiwahn> hi
[08:30:44] <obiwahn> i want to use the mongo-cxx-driver
[08:30:50] <obiwahn> and have trouble compiling it
[08:31:01] <obiwahn> i am on ubuntu trusty
[08:31:26] <obiwahn> and i have trouble with bson
[08:31:38] <obiwahn> i have installed it in /usr/local
[08:32:25] <obiwahn> i call cmake with "-DCMAKE_PREFIX_PATH=/usr/local" but the driver will not build
[08:44:46] <obiwahn> The bson repo does not contain LibBSONConfig.cmake or libbson-config.cmake and it does not seem to be generated
[08:49:47] <obiwahn> https://docs.mongodb.com/ecosystem/drivers/downloads/ -- why does the c++11 release link take me to a legacy download page?
[09:16:10] <livingBEEF> Is there a way to check if a reference is valid (the referenced document exists)?
[12:51:33] <SeiGGy> Has anyone gotten MongoDB to run in a docker container with the /data/db volume attached to an NFS share? I'm having issues where it gives a "Permission Denied" error trying to write the mongod.lock file, but all my other containers are able to write to similar shares just fine.
[12:51:57] <SeiGGy> and when I start the container attached to a normal folder on the file system, it works just fine
[12:52:05] <SeiGGy> it's only when I attach the volume to a NFS share that I get the error
[13:01:10] <SeiGGy> hrm...seems mongodb doesn't like running on NFS shares...anyone know if SMB or another sharing protocol would work?
[15:45:41] <SeiGGy> is it possible to run mongodb in docker with any shared storage solution? NFS/CIFS/SMB/ etc? I can't seem to get it to work
[15:48:04] <AndrewYoung> Docker can share a folder with the host system. You can use that functioanlity to place your data directory somewhere "outside" the docker instance.
[15:49:09] <AndrewYoung> I'm not sure that running Mongo with its data directory located on networked storage would be a very good idea, to be honest. It seems like that would introduce latency and contention issues.
[15:49:49] <AndrewYoung> But if your goal is just to store the mongo data in a folder that can be mounted by the container so that loss of the container doesn't mean loss of your data, then you can use the mapped folder featuer of docker to do that.
[15:50:27] <AndrewYoung> https://docs.docker.com/engine/tutorials/dockervolumes/
[16:03:12] <AndrewYoung> What's your goal SeiGGy?
[16:31:53] <SeiGGy> Andrew: goal is that no matter which host in a swarm the container comes online on, that the data isn't lost
[16:32:29] <SeiGGy> Andrew: latency shouldn't be a problem, as it's all fiber channel between the NAS and the VMX
[16:32:50] <AndrewYoung> Ah, makes sense.
[16:33:25] <SeiGGy> so I've got a cluster of 3 nodes, and if something happens and one node goes down, I don't want to loose the data, and I don't want to have to manually replicate the database across hosts
[16:34:07] <SeiGGy> is there a better way to handle it if I need to do something like this? since i can't get NFS or CIFS working
[16:34:08] <AndrewYoung> If you're having problems getting NFS, etc. working in the client instances, try mounting the data directory from a mount point on the host and then mount that mount point on the host via NFS, etc.
[16:34:20] <SeiGGy> yeah, that's what I was already doing
[16:34:48] <AndrewYoung> What sort of errors are you seeing?
[16:35:04] <SeiGGy> exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
[16:35:16] <AndrewYoung> Oh, interesting.
[16:35:49] <SeiGGy> and I've verified that it's only mongodb that has this issue. I have other containers that are writing to other NFS / CIFS fileshares, and they don't have any issues
[16:36:31] <AndrewYoung> Can you touch a file in that folder as the user that docker is running as on the host system?
[16:37:02] <SeiGGy> yep
[16:37:03] <AndrewYoung> Also, you might try to do a docker exec -it /bin/bash and try to touch a file in the guest system in that folder.
[16:37:13] <SeiGGy> yeah verified that all that works just fine
[16:37:15] <AndrewYoung> (Just trying to elimitate the actual mount point as the issue)
[16:37:22] <AndrewYoung> Bizarre.
[16:37:48] <SeiGGy> yeah, I've also tried changing storage drivers from devicemapper to overlay
[16:38:01] <AndrewYoung> Does it work ok if the docker container is mounting that folder from a local drive instead of a network drive?
[16:38:07] <SeiGGy> yep
[16:38:12] <SeiGGy> works fine if I mount a local drive folder
[16:38:20] <AndrewYoung> Man, that's bizarre.
[16:38:59] <AndrewYoung> I'm out of ideas on this one. Can you reach out to support about it? They might have seen this before.
[16:39:20] <SeiGGy> I guess I'm gonna have to...because my google-fu is running dry on this as well
[16:41:53] <SeiGGy> might also try and see if I can get it to work on a data volume
[16:43:05] <AndrewYoung> And then just store the data volume on the NFS share?
[16:43:31] <SeiGGy> thinking so...gonna see if that's possible.
[16:43:48] <AndrewYoung> Seems like it should work, at least in theory.
[16:45:40] <SeiGGy> yeah, looks like I might have to use something like Flocker
[16:48:28] <AndrewYoung> Huh, interesting.
[18:18:45] <FuzzySockets> I'm running a mongo replica set on a small ec2 cluster (1 primary, 1 secondary, and 1 arbiter). The primary and secondary each have their dbPath configured to an EBS device formatted as XFS. What is the standard practice for taking backups while the replica set is up and running? Can I just snapshot the block storage?
[18:19:39] <SeiGGy> aha! I got it to work AndrewYoung!
[18:20:06] <SeiGGy> I had to install the netshare plugin for docker, and then mount the share into the container using it, instead of mounting the share to the filesystem first
[18:21:14] <AndrewYoung> SeiGGy: Cool. :) Make sure to read this stuff if you haven't already. https://docs.mongodb.com/manual/administration/production-notes/#remote-filesystems
[18:22:00] <AndrewYoung> (Mainly the mount options)
[18:22:42] <AndrewYoung> FuzzySockets: Check out https://docs.mongodb.com/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2/
[18:29:12] <FuzzySockets> AndrewYoung: Thanks, that was quite in depth :P
[18:59:22] <FuzzySockets> AndrewYoung: Is it typically better practice to backup the secondaries storage device?
[19:01:21] <tonlika> can mongodb save closure functions in a document?
[19:06:20] <tonlika> ??/
[19:08:44] <AndrewYoung> FuzzySockets: I'm not sure. I'm still fairly new to MongoDB.
[19:09:10] <FuzzySockets> roger that
[19:09:11] <AndrewYoung> tonlika: The document is not actually javascript, it is JSON, and technically BSON.
[19:09:31] <tonlika> ok so the function is serialized as text?
[19:09:48] <AndrewYoung> Yes
[19:09:50] <tonlika> so any lexical scope is lost
[19:09:52] <tonlika> ok thanks
[19:09:53] <AndrewYoung> That is my understanding.
[19:10:13] <tonlika> AndrewYoung, ok thanks
[19:10:37] <tonlika> AndrewYoung: I'm just starting in mongo
[19:12:41] <AndrewYoung> No worries. :)
[19:13:07] <AndrewYoung> FuzzySockets: Sounds like it is common practice to take a secondary out of rotation and then backup the secondary.
[19:13:27] <AndrewYoung> You just have to be aware of whether or not the secondary is behind the primary and by how much.
[19:13:39] <AndrewYoung> That way you don't affect the primary during the backup.
[19:14:12] <AndrewYoung> tonlika: If you're curious, the BSON spec is located here: http://bsonspec.org/spec.html
[19:14:34] <AndrewYoung> It looks like code does in fact contain scope according to that document, so I might be wrong.
[19:14:36] <FuzzySockets> AndrewYoung: Why would it affect the primary?
[19:14:53] <FuzzySockets> (not saying it wouldn't... just trying to understand)
[19:15:04] <AndrewYoung> FuzzySockets: I mean that you can perform the backup without needing to touch the primary at all.
[19:16:07] <AndrewYoung> Not that it would affect the primary while you were running the backup, just that this removes all possibility of it. :)
[19:16:30] <FuzzySockets> AndrewYoung: I see... is it necessary to take the secondary out of rotation? I combed through the article you sent me earlier, but now I'm going through it step by step and writing stuff down.
[19:17:48] <AndrewYoung> I think it's safer to do so.
[19:18:02] <AndrewYoung> Check out https://docs.mongodb.com/manual/tutorial/backup-sharded-cluster-with-filesystem-snapshots/
[19:18:52] <AndrewYoung> It talks about locking the secondary so that it stops processing oplog updates during the backup, and then unlocking it again once the backup is complete. That way there's no chance that the database contents are changing underneath you while you're backing up.
[19:19:22] <AndrewYoung> I don't think it's strictly necessary, but it decreases possible problems, and I'm all for removing as many possible issues as one can. :)
[19:19:32] <FuzzySockets> That looks like it's only if your journal and data files aren't on the same LV
[19:19:38] <FuzzySockets> "If the journal and data files are on the same logical volume, you can use a single point-in-time snapshot to capture a consistent copy of the data files."
[19:20:14] <AndrewYoung> Yeah, if you can take a point-in-time snapshot of the LV and both are there it's probably fine without.
[19:20:29] <FuzzySockets> I'll be giving this a test run anywho :)
[19:20:47] <AndrewYoung> I'm just especially paranoid. ;)
[19:21:30] <AndrewYoung> tonlika: From the spec: "Code w/ scope - The int32 is the length in bytes of the entire code_w_s value. The string is JavaScript code. The document is a mapping from identifiers to values, representing the scope in which the string should be evaluated."
[19:22:05] <AndrewYoung> However, server side javascript has performance implications because there is a global lock involved.
[19:22:15] <AndrewYoung> So it should be used sparingly.
[20:17:30] <_Cory_> Anyone got some example webapps using mongo on Github or something, just want to see how I should go about things.
[20:18:22] <AndrewYoung> What programming language are you looking for?
[20:18:34] <_Cory_> Java, sorry should have added that.
[20:20:52] <AndrewYoung> https://github.com/deftlabs/mongodb-examples
[20:21:11] <AndrewYoung> Not sure if that's helpful or not.
[20:21:40] <AndrewYoung> Also, you should check this out. It's free. https://university.mongodb.com/courses/M101J/about
[20:28:05] <StephenLynx> _Cory_, craiglist uses mongo
[20:28:14] <StephenLynx> ah
[20:28:20] <StephenLynx> didnt read the whole sentence :v
[20:28:21] <StephenLynx> nvm
[20:28:31] <StephenLynx> cheeser is a java driver dev agaik
[20:28:33] <StephenLynx> afaik*
[20:28:45] <StephenLynx> so he might be able to give you something
[20:32:12] <AndrewYoung> Are you using an ORM framework? JPA, Spring-Data, Hibernate? (It's been a couple years since I worked in Java full-time, so I might be out of the loop with my technologies.) :)
[20:32:52] <AndrewYoung> Also, I found this: https://github.com/rackerlabs/atom-hopper
[20:33:13] <AndrewYoung> But it's using MongoDB through an adapter.
[20:41:58] <_Cory_> Yeah I was speaking with him this morning, I'm in no rush just learning the mongo ways :P
[20:48:07] <AndrewYoung> SeiGGy: You still around?
[20:49:05] <AndrewYoung> If you feel so inclined, I bet the support folks would benefit from a bug report about the NFS problems you were having and your solution to them over at https://jira.mongodb.org/.
[20:49:34] <_Cory_> Ahh thanks AndrewYoung nothing's set in stone, it'll be Hibernate along with Wicket
[20:49:50] <sumobob> so there is a $push element in mongodb, is there also a $slice or $splice? how can i reverse a $push
[20:50:39] <AndrewYoung> You can $pop.
[20:50:55] <AndrewYoung> Actually, there are several options depending on exactly what you want to do.
[20:51:03] <AndrewYoung> https://docs.mongodb.com/manual/reference/operator/update-array/
[20:51:44] <sumobob> so my scenario is a user has an array of unavailableObjects { start: Date, end: Date, reason: String}
[20:51:56] <sumobob> i push into that array elements like
[20:52:34] <sumobob> when they have an event happening, now if that event gets deleted, I need to slice that specific element out
[20:53:45] <sumobob> hmmm is it possible to have a remove apply only to a nested object in an array?
[20:55:17] <AndrewYoung> I think you want $pull.
[20:55:29] <sumobob> excellent
[20:55:31] <AndrewYoung> https://docs.mongodb.com/manual/reference/operator/update/pull/#up._S_pull
[20:56:13] <AndrewYoung> You give it a sub-query and it removes all documents from the array that match the sub-query.