Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JustLeo opened this issue Oct 26, 2017 · 2 comments
Open

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

JustLeo opened this issue Oct 26, 2017 · 2 comments

Comments

@JustLeo
Copy link

JustLeo commented Oct 26, 2017

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

@wdeviers
Copy link

wdeviers commented Jan 8, 2018

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.

@github-actions
Copy link

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 github-actions bot added the Stale label Sep 30, 2020
@xorimabot xorimabot removed the Stale label Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants