sc-mongodb icon indicating copy to clipboard operation
sc-mongodb copied to clipboard

Facing 400 "Bad Request" when trying to configure a replica

Open JustLeo opened this issue 8 years ago • 2 comments

Hello, I'm trying to configure a replica using the cookbook but it fails when autoconfigure is set to true giving me the following error message:

================================================================================ Recipe Compile Error in /var/chef/cache/cookbooks/sc-mongodb/recipes/replicaset.rb

Net::HTTPServerException

400 "Bad Request"

Cookbook Trace:

/var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:236:in block in from_file' /var/chef/cache/cookbooks/sc-mongodb/recipes/replicaset.rb:36:in from_file'

Relevant File Content:

/var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:

229: notifies :create, 'ruby_block[config_sharding]', :immediately if new_resource.is_mongos && new_r esource.auto_configure_sharding 230: # we don't care about a running mongodb service in these cases, all we need is stopping it 231: ignore_failure true if new_resource.name == 'mongodb' 232: end 233: 234: # replicaset 235: if new_resource.is_replicaset && new_resource.auto_configure_replicaset 236>> rs_nodes = search( 237: :node, 238: "mongodb_cluster_name:#{new_resource.cluster_name} AND "
239: 'mongodb_is_replicaset:true AND '
240: "mongodb_config_mongod_replication_replSetName:#{new_resource.replicaset_name} AND "
241: "chef_environment:#{node.chef_environment}" 242: ) 243: 244: ruby_block 'config_replicaset' do 245: block do

Platform:

x86_64-linux

What am I missing here? from where this cookbook is getting/generating the replicaset_name? Any help will be appreciated.

Thanks,

Leo

JustLeo avatar Oct 26 '17 15:10 JustLeo

I haven't investigated farther but at the time of 1.0.0 you have to set it yourself, even though the docs don't indicate as such:

"mongodb": { "cluster_name": "wesawesomecluster", "config": { "mongod": { "replication": { "replSetName": "wesawesomeset" } } } }

I would expect the replica set name to inherit from the cluster name if shards aren't configured.

wdeviers avatar Jan 08 '18 18:01 wdeviers

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] avatar Sep 30 '20 00:09 github-actions[bot]