File tree Expand file tree Collapse file tree 4 files changed +40
-19
lines changed Expand file tree Collapse file tree 4 files changed +40
-19
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,12 @@ Update it:
19
19
Sample Usage :
20
20
node 'mongodb-1.domain.com', 'mongodb-2.domain.com', 'mongodb-3.domain.com' {
21
21
# Install MongoDB
22
- include mongodb
23
- # Nodes are in a replica set
24
- mongodb::replica_set { "example_set_name": }
22
+ class { mongodb:
23
+ # Nodes are in a replica set
24
+ replSet => "example_set_name",
25
+ # Increase number of available mongodb connections
26
+ ulimit_nofile => 21000,
27
+ }
25
28
}
26
29
27
30
## CONTRIBUTORS ##
Original file line number Diff line number Diff line change 12
12
# - MongoDB can be part of a replica set
13
13
#
14
14
# Sample Usage:
15
- # include mongodb
15
+ # class { mongodb:
16
+ # replSet => "myReplicaSet",
17
+ # ulimit_nofile => 21000,
18
+ # }
16
19
#
17
- class mongodb {
18
- include mongodb::params
19
-
20
+ class mongodb (
21
+ $replSet = $mongodb::params::replSet,
22
+ $ulimit_nofile = $mongodb::params::ulimit_nofile,
23
+ $repository = $mongodb::params::repository,
24
+ $package = $mongodb::params::package
25
+ ) inherits mongodb::params {
26
+
20
27
package { "python-software-properties" :
21
28
ensure => installed,
22
29
}
46
53
ensure => installed,
47
54
require => Exec[" update-apt" ],
48
55
}
49
-
56
+
50
57
service { "mongodb" :
51
58
enable => true ,
52
59
ensure => running ,
53
- require => Package[$mongodb::params::package ],
54
- }
55
-
56
- define replica_set {
57
- file { "/etc/init/mongodb.conf" :
58
- content => template (" mongodb/mongodb.conf.erb" ),
59
- mode => " 0644" ,
60
- notify => Service[" mongodb" ],
61
- require => Package[$mongodb::params::package ],
62
- }
63
60
}
61
+
62
+ file { "/etc/init/mongodb.conf" :
63
+ content => template (" mongodb/mongodb.conf.erb" ),
64
+ mode => " 0644" ,
65
+ notify => Service[" mongodb" ],
66
+ }
64
67
}
Original file line number Diff line number Diff line change 5
5
# Parameters:
6
6
# - The 10gen Ubuntu $repository to use
7
7
# - The 10gen Ubuntu $package to use
8
+ # - A replica set to join
9
+ # - A nofile ulimit
8
10
#
9
11
# Sample Usage:
10
12
# include mongodb::params
11
13
#
12
14
class mongodb::params {
13
15
$repository =" deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
14
16
$package =" mongodb-10gen"
17
+
18
+ # name of replica set (if any) to join
19
+ $replSet = " "
20
+
21
+ # number of open files ulimit can be changed if mongodb.log reports
22
+ # "too many open files" or "too many open connections" messages.
23
+ # mongodb has an upper limit of 20k.
24
+ # http://www.mongodb.org/display/DOCS/Too+Many+Open+Files
25
+ $ulimit_nofile = 1024
15
26
}
Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ end script
9
9
start on runlevel [2345]
10
10
stop on runlevel [06]
11
11
12
+ # http://www.mongodb.org/display/DOCS/Too+Many+Open+Files
13
+ # mongodb has a limit of 20k connections
14
+ limit nofile <%= ulimit_nofile %> <%= ulimit_nofile %>
15
+
12
16
script
13
17
ENABLE_MONGODB="yes"
14
18
if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi
15
- if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf --replSet <%= name %> ; fi
19
+ if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf <%= replSet ? " --replSet #{replSet}" : "" %> ; fi
16
20
end script
You can’t perform that action at this time.
0 commit comments