Open twom opened 10 years ago
You might need node.default[:mongodb][:config][:replSet] instead of, or in addition to what you have:
https://github.com/edelight/chef-mongodb/issues/182#issuecomment-30259659
The docs and examples are not up to date as 0.14.x is moving pretty fast with some significant refactoring....
Thx! Adding node.default[:mongodb][:config][:replSet] = 'rs_my_cluster'
already starts mongo as a replication set (adds replSet in the mongod.conf file). So that is good :)
This gives me
$ mongo
MongoDB shell version: 2.4.8
connecting to: test
> rs.status()
{
"startupStatus" : 3,
"info" : "run rs.initiate(...) if not yet done for the set",
"ok" : 0,
"errmsg" : "can't get local.system.replset config from self or any seed (EMPTYCONFIG)"
}
From here I can initialize the replicaSet in the mongo terminal. However chef is still mentioning:
WARN: Cannot configure replicaset 'rs_my_cluster', no member nodes found
Thx for the quick response
I was just digging through the code to select the replSet name yesterday in #171. I'm aware that it doesn't work as expected, and I'd like to fix it.
If you could review my suggestion in #171, I'll gladly clean up the code and ensure it's documented.
I'm also trying to get our automated tests running in rackspace, but I haven't figured out a good way to spin up multiple VMs for a test suite. And it's not much of a test of a replicaset without another member.
On Jan 8, 2014, at 10:38, Tom notifications@github.com wrote:
Hi,
I am trying to configure two mongodb instances as a replicaset. For this I follow the instructions as provided in the Readme.md. I am using the 0.14.2 version. Both servers are in the same chef_environment.
So basically I have my attributes file: attributes/default.rb which contains
node.default['mongodb']['cluster_name'] = 'rs_my_cluster'
I have also included mongodb::replicaset in my recipes/default.rb file.
The first observation is that the cluster_name is not honored:
WARN: Cannot configure replicaset 'rs_default', no member nodes found
So secondly I changed my attributes file to say:
node.default['mongodb']['cluster_name'] = 'rs_my_cluster' node.default['mongodb']['replicaset_name'] ='rs_my_cluster'
Then when I run chef-client on my two instances I get:
WARN: Cannot configure replicaset 'rs_my_cluster', no member nodes found
The documentation however does not mention the need for using the 'replicaset_name' attribute.
So the mongo database both are running, but not as a replicaset (since the --ReplSet option is not used by the chef script).
I will do some more digging around, but I hope somebody could verify this problem and give some possible hints.
Thx
— Reply to this email directly or view it on GitHub.
"no member nodes found" is probably due to the chef query for nodes that match the cluster name and replica set name returning nothing.
see definitions/mongodb.rb:
if !replicaset_name.nil? && new_resource.auto_configure_replicaset
rs_nodes = search(
:node,
"mongodb_cluster_name:#{new_resource.replicaset['mongodb']['cluster_name']} AND \
recipes:mongodb\\:\\:replicaset AND \
mongodb_shard_name:#{new_resource.replicaset['mongodb']['shard_name']} AND \
chef_environment:#{new_resource.replicaset.chef_environment}"
)
:+1:
still get 'no member nodes found' using AWS Opsworks. My default OS is Ubuntu 14.04 LTS
Custom JSON
{
"mongodb" : {
"is_replicaset": true,
"is_shard": false,
"config":{
"replSet":"rs0",
"bind_ip": "0.0.0.0",
"rest":false
},
"cluster_name":"rs0",
"shard_name":"default"
}
}
After log in with SSH and show rs.status(), i still need to do rs.initiate() manually. Here https://netinlet.com/blog/2014/01/18/setting-up-a-mongodb-replicaset-with-aws-opsworks/ suggests to run command on recipe mongodb:replicaset after instances are up to avoid timing issue.
But it didn't work out. Looks like no nodes are found while rs_nodes = search().
Hi,
I am trying to configure two mongodb instances as a replicaset. For this I follow the instructions as provided in the Readme.md. I am using the 0.14.2 version. Both servers are in the same chef_environment.
So basically I have my attributes file: attributes/default.rb which contains
I have also included mongodb::replicaset in my recipes/default.rb file.
The first observation is that the cluster_name is not honored:
So secondly I changed my attributes file to say:
Then when I run chef-client on my two instances I get:
The documentation however does not mention the need for using the 'replicaset_name' attribute.
So the mongo database both are running, but not as a replicaset (since the --ReplSet option is not used by the chef script).
I will do some more digging around, but I hope somebody could verify this problem and give some possible hints.
Thx