This cookbook is a wrapper over the mongodb3 cookbook. It contains LWRP resources to create:
Tested on Centos 6 and 7, but could work on any other Linux.
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.
login
- Login name for administrator accountpassword
- Password for administrator accountCreates 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.
login
- Login name for administrator accountpassword
- Password for administrator accountroles
- Roles to assigndatabase
- User databaseCreates a replica set with specified members (usually 3).
members
- Replica set members in format [{"host": "host1:port"}, {"host": "host2:port", "priority": 2}]config_server
- Set config server settings for replica setAdd shard to a sharding cluster. This is essentially addShard command. The host parameter can be in any of the following forms:
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.Configure sharding for database. This adds enableSharding
parameter to database configuration.
database
- Database nameEnables 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.
collection
- Collection nameshard_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.Enables index for collection
collection
- Collection namedatabase
- Database nameindex
- Index descriptionIf 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.
add_component_x
)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.