Permalink
Browse files

Making config servers more obvious.

  • Loading branch information...
1 parent a6c8e0b commit 92827728fd954afdcfb8002106094f5d538097b5 @rcreasey rcreasey committed Sep 3, 2011
Showing with 9 additions and 6 deletions.
  1. +4 −2 mongodb/attributes/default.rb
  2. +4 −4 mongodb/providers/instance.rb
  3. +1 −0 mongodb/resources/instance.rb
@@ -9,8 +9,10 @@
default[:mongodb][:user] = "mongodb"
default[:mongodb][:group] = "mongodb"
-default[:mongodb][:bind_address] = "127.0.0.1"
-default[:mongodb][:port] = "27017"
+default[:mongodb][:bind_address] = "127.0.0.1"
+default[:mongodb][:port] = "27017"
+default[:mongodb][:mongos_port] = "27017"
+default[:mongodb][:configsvr_port] = "27019"
default[:mongodb][:version] = '1.8.3'
default[:mongodb][:package_version] = "#{mongodb[:version]}-mongodb"
@@ -16,7 +16,7 @@
directories = %W(#{node[:mongodb][:log_dir]}/#{new_resource.name}
#{node[:mongodb][:data_dir]}/#{new_resource.name})
- directories << "#{node[:mongodb][:data_dir]}/#{new_resource.name}_config" if new_resource.sharded
+ directories << "#{node[:mongodb][:data_dir]}/#{new_resource.name}_config" if new_resource.config_server
directories.each do |dir|
directory dir do
@@ -30,8 +30,8 @@
end
# Figure out configuration options
- ports = {:mongod => node[:mongodb][:port]}
- ports.merge!({:mongod => node[:mongodb][:port].to_i - 1, :shard => node[:mongodb][:port], :configdb => 27019}) if new_resource.sharded
+ ports = {:mongod => new_resource.port}
+ ports.merge!({:mongod => new_resource.port - 1, :shard => new_resource.port, :configdb => new_resource.port + 2}) if new_resource.sharded
options = %w(journal)
options << "shardsvr" if new_resource.sharded
@@ -40,7 +40,7 @@
config = "#{node[:mongodb][:config_dir]}/mongodb_#{new_resource.name}.conf"
instance = new_resource.name
is_sharded = new_resource.sharded
- run_configsvr = new_resource.config_servers.find {|s| s.include?(node[:fqdn]) }
+ run_configsvr = new_resource.config_server
configsvrs = new_resource.config_servers.join(',')
# Create bluepill config
@@ -10,6 +10,7 @@
attribute :name, :kind_of => String, :name_attribute => true
attribute :port, :kind_of => Integer, :default => 27017
attribute :sharded, :kind_of => [TrueClass, FalseClass], :default => false
+attribute :config_server, :kind_of => [TrueClass, FalseClass], :default => false
attribute :replication_set, :kind_of => [String, FalseClass], :default => false
attribute :enable_rest, :kind_of => [TrueClass, FalseClass], :default => true
attribute :config_servers, :kind_of => Array, :default => Array.new

0 comments on commit 9282772

Please sign in to comment.