edelight/chef-mongodb

mongod.conf or mongodb.conf?

joelmoss opened this issue · 13 comments

It seems that even tho this cookbook sets the config in /etc/mongodb.conf, when Mongo is started, it uses mongod.conf which is the default config used by Mongo. Looks like a bug?

There are also two services: mongodb and mongod, with mongod being the one that is started.

Of course, changing the following fixes it, but seems that it shouldn't

default[:mongodb][:default_init_name] = 'mongod'
default[:mongodb][:instance_name] = 'mongod'
default[:mongodb][:dbconfig_file] = '/etc/mongod.conf'
default[:mongodb][:sysconfig]['DAEMON_OPTS'] = "--config #{node[:mongodb][:dbconfig_file]}"
default[:mongodb][:sysconfig]['CONFIGFILE'] = node[:mongodb][:dbconfig_file]

looks like they changed the file names again or we didn't catch this one.

It was intentional that we picked a config file name.

Which OS and install source?

@joelmoss this sounds very similar to #262, could you confirm?

Ah yes, i think it is.

Having the same issue.

Here as well. Ubuntu 12.04 and mongo 10gen

Hi guys,

We ran into this issue couple of days when a node in replicaset failed and new one failed chef provisioning.

The issue is that the package installs /etc/init/mongod.conf and the cookbook (by default) creates /etc/init/mongod.conf

Problem is specially bad if you use a replicaset:
mongodb.conf (made by chef) does have the replicaset config
mongod.conf (made by package does NOT.

mongod.conf is started by default and it prevents chef from starting mongodb.conf up. So the new node has a standalone mongo instance that doesn't fix itself on subsequent chef runs.

a 'solution' was to rename the init_config variable in the wrapper cookbook:
node.override['mongodb']['default_init_name'] = 'mongod'
However that feels a little hacky. Any thoughts on better solution?

Using Ubuntu 12.04 and 10gen repo.

yeah, I need to update/verify the config. One thing I did notice before on this was that (once) a package maintainer changed the name of the config before.

👍

Chef creates starter file to /etc/init/mongodb.conf, as defined here and ubuntu loads mongod. So, for ubuntu-precise-64 I removed mongod files. And it worked for me.

include_recipe "mongodb::mongodb_org_repo"
include_recipe "mongodb"

file('/etc/mongod.conf') { action :delete }
file('/etc/init.d/mongod') { action :delete }
file('/etc/init/mongod.conf') { action :delete }

Trying to upgrade from 2.4.x to 2.6.x and tripping over this. Is changing the default_init_name the recommended workaround at this point?

Also, are there guidelines somewhere for the "correct" way to upgrade a chef managed mongo cluster?

Still exists with 2.6.x

I am also facing same issue. Putting package version :2.6.8 creating separate init, and configuraiton file.
Any help would be great.

Doing node.override['mongodb']['default_init_name'] = 'mongod' as @Igorshp mentioned worked for me as well, but it's not ideal. If anything, it's rather confusing that setting it to mongod means that the mongdb config is loaded.