Skip to content

parallels-cookbooks/mongodb3-objects

Repository files navigation

mongodb3-objects

Cookbook Version

Description

This cookbook is a wrapper over the mongodb3 cookbook. It contains LWRP resources to create:

Requirements

Platforms

Tested on Centos 6 and 7, but could work on any other Linux.

Cookbooks

Resources

mongodb_admin

Creates administrator account. If authentication mechanism was enabled in configuration already, only request from localhost to create administrator user will work. See this and this. Login is mandatory.

Parameters
  • login - Login name for administrator account
  • password - Password for administrator account

mongodb_user

Creates a user account in specified database with specified role. In MongoDB database can be absent till some data is written. Users are stored in 'admin' database. To choose appropriate role see built-in roles.

Parameters
  • login - Login name for administrator account
  • password - Password for administrator account
  • roles - Roles to assign
  • database - User database

mongodb_replicaset

Creates a replica set with specified members (usually 3).

Parameters
  • members - Replica set members in format [{"host": "host1:port"}, {"host": "host2:port", "priority": 2}]
  • config_server - Set config server settings for replica set

mongodb_shard

Add shard to a sharding cluster. This is essentially addShard command. The host parameter can be in any of the following forms:

  • [hostname]
  • [hostname]:[port]
  • [replica-set-name]/[hostname]
  • [replica-set-name]/[hostname]:port
Parameters
  • shard_endpoint - The hostname of either a standalone database instance or of a replica set. Include the port number if the instance is running on a non-standard port. Include the replica set name if the instance is a replica set.

mongodb_sharding_database

Configure sharding for database. This adds enableSharding parameter to database configuration.

Parameters
  • database - Database name

mongodb_sharding_collection

Enables a collection for sharding and allows MongoDB to begin distributing data among shards. You must run mongodb_sharding_database on a database before using this.

Parameters
  • collection - Collection name
  • shard_key - The index specification document to use as the shard key. The index must exist prior to the shardCollection command, unless the collection is empty. If the collection is empty, in which case MongoDB creates the index prior to sharding the collection. New in version 2.4: The key may be in the form { field : "hashed" }, which will use the specified field as a hashed shard key.

mongodb_collection_index

Enables index for collection

Parameters
  • collection - Collection name
  • database - Database name
  • index - Index description

Examples

If MongoDB is already installed just use

include_recipe 'mongodb3-objects::default'

to install mongo and bson gems. After that LWRPs can be used.

To install standalone MongoDB use

include_recipe 'mongodb3-objects::standalone'

Also you may see examples in fixture cookbook: test/fixtures/cookbooks/mongotest/recipes.

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License & Authors

Copyright:: 2016-2017 Parallels International GmbH

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.

About

Chef LWRP resources to manage MongoDB 3.x

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages