edelight / chef-mongodb

MongoDB Chef cookbook
https://community.opscode.com/cookbooks/mongodb
Apache License 2.0
362 stars 3 forks source link

mongod.conf or mongodb.conf? #316

Open joelmoss opened 10 years ago

joelmoss commented 10 years ago

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]
jamesonjlee commented 10 years ago

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?

josephholsten commented 10 years ago

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

joelmoss commented 10 years ago

Ah yes, i think it is.

iceydee commented 10 years ago

Having the same issue.

luntzel commented 10 years ago

Here as well. Ubuntu 12.04 and mongo 10gen

Igorshp commented 9 years ago

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.

jamesonjlee commented 9 years ago

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.

brodock commented 9 years ago

:+1:

Zhomart commented 9 years ago

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 }
samperman commented 9 years ago

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?

castro1688 commented 9 years ago

Still exists with 2.6.x

sahilsk commented 9 years ago

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

seeafish commented 9 years ago

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.