cookbook 'database', '= 0.7.0'
The database cookbook has been deprecated
Author provided reason for deprecation:
The database cookbook has been deprecated and is no longer being maintained by its authors. Use of the database cookbook is no longer recommended.
database
(52) Versions
0.7.0
-
-
6.1.1
-
6.1.0
-
6.0.0
-
5.1.2
-
5.1.1
-
5.1.0
-
5.0.1
-
5.0.0
-
4.0.9
-
4.0.8
-
4.0.7
-
4.0.6
-
4.0.5
-
4.0.4
-
4.0.3
-
4.0.2
-
4.0.1
-
3.1.0
-
3.0.3
-
3.0.2
-
3.0.1
-
3.0.0
-
2.3.1
-
2.3.0
-
2.2.0
-
2.1.10
-
2.1.8
-
2.1.6
-
2.1.4
-
2.1.2
-
2.1.0
-
2.0.0
-
1.6.0
-
1.5.2
-
1.5.0
-
1.4.0
-
1.3.12
-
1.3.10
-
1.3.8
-
1.3.6
-
1.3.4
-
1.3.2
-
1.2.0
-
1.1.4
-
1.1.2
-
1.1.0
-
1.0.0
-
0.99.1
-
0.99.0
-
0.7.1
-
0.7.0
-
0.6.0
Follow178
- 6.1.1
- 6.1.0
- 6.0.0
- 5.1.2
- 5.1.1
- 5.1.0
- 5.0.1
- 5.0.0
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.10
- 2.1.8
- 2.1.6
- 2.1.4
- 2.1.2
- 2.1.0
- 2.0.0
- 1.6.0
- 1.5.2
- 1.5.0
- 1.4.0
- 1.3.12
- 1.3.10
- 1.3.8
- 1.3.6
- 1.3.4
- 1.3.2
- 1.2.0
- 1.1.4
- 1.1.2
- 1.1.0
- 1.0.0
- 0.99.1
- 0.99.0
- 0.7.1
- 0.7.0
- 0.6.0
provides LWRPs for common database tasks
cookbook 'database', '= 0.7.0', :supermarket
knife supermarket install database
knife supermarket download database
Database Cookbook
Configures mysql database masters and slaves and uses EBS for storage, integrating together with the application cookbook utilizing data bags for application related information.
This cookbook is written primarily to use MySQL and the Opscode mysql cookbook. Other RDBMS may be supported at a later date.
This cookbook does not automatically restore database dumps, but does install tools to help with that.
Requirements
Chef 0.8 or higher required.
The following Opscode cookbooks are dependencies:
- mysql
- xfs
- aws
Recipes
ebs_volume
Loads the aws information from the data bag. Searches the applications data bag for the database master or slave role and checks that role is applied to the node. Loads the EBS information and the master information from data bags. Uses the aws cookbook LWRP, aws_ebs_volume
to manage the volume.
On a master node:
* if we have an ebs volume already as stored in a data bag, attach it.
* if we don't have the ebs information then create a new one and attach it.
* store the volume information in a data bag via a ruby block.
On a slave node:
* use the master volume information to generate a snapshot.
* create the new volume from the snapshot and attach it.
Also on a master node, generate some configuration for running a snapshot via chef-solo
from cron.
On a new filesystem volume, create as XFS, then mount it in /mnt, and also bind-mount it to the mysql data directory (default /var/lib/mysql).
master
This recipe no longer loads AWS specific information, and the database position for replication is no longer stored in a databag because the client might not have permission to write to the databag item. This may be handled in a different way at a future date.
Searches the apps databag for applications, and for each one it will check that the specified database master role is set in both the databag and applied to the node's run list. Then, retrieves the passwords for root
, repl
and debian
users and saves them to the node attributes. If the passwords are not found in the databag, it prints a message that they'll be generated by the mysql cookbook.
Then it adds the application databag database settings to a hash, to use later.
It sets up the template resource for /etc/mysql/app_grants.sql
, passing in the database settings so privileges for application specific database users can be created.
Then it will iterate over the databases and create them with the mysql_database
LWRP, detecting their presence with the mysql rubygem.
slave
TODO: Retrieve the master status from a data bag, then start replication using a ruby block. The replication status needs to be handled in some other way for now since the master recipe above doesn't actually set it in the databag anymore.
snapshot
Run via Chef Solo. Retrieves the db snapshot configuration from the specified JSON file. Uses the mysql_database
LWRP to lock and unlock tables, and does a filesystem freeze and EBS snapshot.
Deprecated Recipes
The following recipe is considered deprecated. It is kept for reference purposes.
ebs_backup
Older style of doing mysql snapshot and replication using Adam Jacob's ec2_mysql script and library.
Data Bags
This cookbook uses the apps data bag item for the specified application; see the application
cookbook's README.md. It also creates data bag items in a bag named 'aws' for storing volume information. In order to interact with EC2, it expects aws to have a main item:
{
"id": "main",
"ec2_private_key": "private key as a string",
"ec2_cert": "certificate as a string",
"aws_account_id": "",
"aws_secret_access_key": "",
"aws_access_key_id": ""
}
Note: with the Open Source Chef Server, the server using the database recipes must be an admin client or it will not be able to create data bag items. You can modify whether the client is admin by editing it with knife.
knife client edit
{
...
"admin": true
...
}
This is not required if the Chef Server is the Opscode Platform, instead use the ACL feature to modify access for the node to be able to update the data bag.
Usage
Aside from the application data bag (see the README in the application cookbook), create a role for the database master. Use a role.rb in your chef-repo, or create the role directly with knife.
% knife role show my_app_database_master
{
"name": "my_app_database_master",
"chef_type": "role",
"json_class": "Chef::Role",
"default_attributes": {
},
"description": "",
"run_list": [
"recipe[mysql::server]",
"recipe[database::master]"
],
"override_attributes": {
}
}
Also create a production
role, or other role based on your desired environment. This is also used in the application
cookbook.
% knife role show production
{
"name": "production",
"chef_type": "role",
"json_class": "Chef::Role",
"default_attributes": {
"app_environment": "production"
},
"description": "production environment role",
"run_list": [
],
"override_attributes": {
}
}
The cookbook my_app_database
is recommended to set up any application specific database resources such as configuration templates, trending monitors, etc. It is not required, but you would need to create it separately in site-cookbooks
. Add it to the my_app_database_master
role.
License and Author
Author:: Adam Jacob (adam@opscode.com)
Author:: Joshua Timberman (joshua@opscode.com)
Author:: AJ Christensen (aj@opscode.com)
Copyright 2009-2010, Opscode, Inc.
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.