Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

aix

amazon

centos

debian

fedora

freebsd

gentoo

mac_os_x

omnios

openbsd

opensuse

opensuseleap

oracle

redhat

ubuntu

scientific

smartos

solaris

suse

windows

zlinux

The mongodb
cookbook has been deprecated

The mongodb cookbook has been deprecated and is no longer
being maintained by its authors. Use of the mongodb
cookbook is no longer recommended.
You may find that the sc-mongodb
cookbook is a suitable alternative.

Backup Agent Settings

USAGE:

10gen

Adds the stable 10gen repo for the
corresponding platform. Currently only implemented for the Debian and Ubuntu repository.

Usage: just add recipe[mongodb::10gen_repo] to the node run_list before any other
MongoDB recipe, and the mongodb-10gen stable packages will be installed instead of the distribution default.

Single mongodb instance

Simply add

include_recipe "mongodb::default"

to your recipe. This will run the mongodb instance as configured by your distribution.
You can change the dbpath, logpath and port settings (see ATTRIBUTES) for this node by
using the mongodb_instance definition:

mongodb_instance "mongodb" do
port node['application']['port']
end

This definition also allows you to run another mongod instance with a different
name on the same node

Replicasets

Add mongodb::replicaset (instead of mongodb::default) to the node's run_list. Also choose a name for your
replicaset cluster and set the value of node[:mongodb][:cluster_name] for each
member to this name.

Sharding

You need a few more components, but the idea is the same: identification of the
members with their different internal roles (mongos, configserver, etc.) is done via
the node[:mongodb][:cluster_name] and node[:mongodb][:shard_name] attributes.

Let's have a look at a simple sharding setup, consisting of two shard servers, one
config server and one mongos.

First we would like to configure the two shards. For doing so, just use
mongodb::shard in the node's run_list and define a unique mongodb[:shard_name]
for each of these two nodes, say "shard1" and "shard2".

Then configure a node to act as a config server - by using the mongodb::configserver
recipe.

And finally you need to configure the mongos. This can be done by using the
mongodb::mongos recipe. The mongos needs some special configuration, as these
mongos are actually doing the configuration of the whole sharded cluster.
Most importantly you need to define what collections should be sharded by setting the
attribute mongodb[:sharded_collections]:

Now mongos will automatically enable sharding for the "test" and the "mydatabase"
database. Also the "addressbook" and the "calendar" collection will be sharded,
with sharding key "name" resp. "date".
In the context of a sharding cluster always keep in mind to use a single role
which is added to all members of the cluster to identify all member nodes.
Also shard names are important to distinguish the different shards.
This is esp. important when you want to replicate shards.

Sharding + Replication

The setup is not much different to the one described above. All you have to do is adding the
mongodb::replicaset recipe to all shard nodes, and make sure that all shard
nodes which should be in the same replicaset have the same shard name.

MMS Agent

This cookbook also includes support for
{MongoDB Monitoring System (MMS)}[http://www.10gen.com/mongodb-monitoring-service]
agent. MMS is a hosted monitoring service, provided by 10gen, Inc. Once
the small python agent program is installed on the MongoDB host, it
automatically collects the metrics and upload them to the MMS server.
The graphs of these metrics are shown on the web page. It helps a lot
for tackling MongoDB related problems, so MMS is the baseline for all
production MongoDB deployments.

To setup MMS, simply set your keys in
node['mongodb']['mms_agent']['api_key'] and then add the
mongodb::mms-agent recipe to your run list. Your current keys should
be available at your {MMS Settings page}[https://mms.10gen.com/settings].

LICENSE and AUTHOR:

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.