cookbook 'gluster', '= 4.0.1'
gluster (11) Versions 4.0.1 Follow8
Installs and configures Gluster servers and clients
cookbook 'gluster', '= 4.0.1', :supermarket
knife supermarket install gluster
knife supermarket download gluster
gluster Cookbook
This cookbook is used to install and configure Gluster on both servers and clients. This cookbook makes several assumptions when configuring Gluster servers:
- If using the cookbook to format disks, each disk will contain a single partition dedicated for Gluster
- Non-replicated volume types are not supported
- All peers for a volume will be configured with the same number of bricks
Platforms
This cookbook has been tested on Ubuntu 12.04/14.04, CentOS 6.5 and CentOS 7.1
Attributes
gluster::default
-
node['gluster']['version']
- version to install, defaults to 3.4 -
node['gluster']['repo']
- repo to install from: can be public or private, defaults to public, private requires a so-called "private" repo to be configured in a wrapper cookbook for example
gluster::client
Node attributes to specify volumes to mount. This has been deprecated in favor of using the 'gluster_mount' LWRP.
-
node['gluster']['client']['volumes'][VOLUME_NAME]['server']
- server to connect to -
node['gluster']['client']['volumes'][VOLUME_NAME]['backup_server']
- name of the backup volfile server to mount the client. When the first volfile server fails, then the server specified here is used as volfile server and is mounted by the client. This can be a String or Array of Strings. -
node['gluster']['client']['volumes'][VOLUME_NAME]['mount_point']
- mount point to use for the Gluster volume
gluster::server
Node attributes to specify server volumes to create
-
node['gluster']['server']['brick_mount_path']
- default path to use for mounting bricks -
node['gluster']['server']['disks']
- an array of disks to create partitions on and format for use with Gluster, (for example, ['sdb', 'sdc']) -
node['gluster']['server']['peer_retries']
- attempt to connect to peers up to N times -
node['gluster']['server']['peer_retry_delays']
- number of seconds to wait between attempts to initially attempt to connect to peers -
node['gluster']['server']['volumes'][VOLUME_NAME]['allowed_hosts']
- an optional array of IP addresses to allow access to the volume -
node['gluster']['server']['volumes'][VOLUME_NAME]['disks']
- an optional array of disks to put bricks on (for example, ['sdb', 'sdc']); by default the cookbook will use the first x number of disks, equal to the replica count -
node['gluster']['server']['volumes'][VOLUME_NAME]['lvm_volumes']
- an optional array of logical volumes to put bricks on (for example, ['LogVolGlusterBrick1', 'LogVolGlusterBrick2']); by default the cookbook will use the first x number of volumes, equal to the replica count -
node['gluster']['server']['volumes'][VOLUME_NAME]['peer_names']
- an optional array of Chef node names for peers used in the volume -
node['gluster']['server']['volumes'][VOLUME_NAME]['peers']
- an array of FQDNs for peers used in the volume -
node['gluster']['server']['volumes'][VOLUME_NAME]['quota']
- an optional disk quota to set for the volume, such as '10GB' -
node['gluster']['server']['volumes'][VOLUME_NAME]['replica_count']
- the number of replicas to create -
node['gluster']['server']['volumes'][VOLUME_NAME]['volume_type']
- the volume type to use; this value can be 'replicated', 'distributed-replicated', 'distributed', 'striped' or 'distributed-striped'
LWRPs
Use the gluster_mount LWRP to mount volumes on clients:
gluster_mount 'volume_name' do server 'gluster1.example.com' backup_server 'gluster2.example.com' mount_point '/mnt/gluster/volume_name' action [:mount, :enable] end
gluster_mount 'volume_name' do server 'gluster1.example.com' backup_server ['gluster2.example.com', 'gluster3.example.com'] mount_point '/mnt/gluster/volume_name' action [:mount, :enable] end
Usage
On two or more identical systems, attach the desired number of dedicated disks to use for Gluster storage. Add the gluster::server
recipe to the node's run list and add any appropriate attributes, such as volumes to the ['gluster']['server']['volumes']
attribute. If the cookbook will be used to manage disks, add the disks to the ['gluster']['server']['disks']
attribute; otherwise format the disks appropriately and add them to the ['gluster']['server']['volumes'][VOLUME_NAME]['disks']
attribute. Once all peers for a volume have configured their bricks, the 'master' peer (the first in the array) will create and start the volume.
For example, to create a replicated gluster volume named gv0 with 2 bricks on two nodes, add the following to your attributes/default.rb and include the gluster::server recipe:
default['gluster']['server']['brick_mount_path'] = "/data"
default['gluster']['server']['volumes'] = {
'gv0' => {
'peers' => ['gluster1.example.com','gluster2.example.com'],
'replica_count' => 2,
'volume_type' => "replicated"
}
}
To create a distributed-replicated volume with 4 bricks and a replica count of two:
default['gluster']['server']['brick_mount_path'] = "/data"
default['gluster']['server']['volumes'] = {
'gv0' => {
'peers' => ['gluster1.example.com','gluster2.example.com','gluster3.example.com','gluster4.example.com'],
'replica_count' => 2,
'volume_type' => "distributed-replicated"
}
}
To create a replicated volume with 4 bricks:
default['gluster']['server']['brick_mount_path'] = "/data"
default['gluster']['server']['volumes'] = {
'gv0' => {
'peers' => ['gluster1.example.com','gluster2.example.com','gluster3.example.com','gluster4.example.com'],
'replica_count' => 4,
'volume_type' => "replicated"
}
}
For clients, add the gluster::default or gluster::client recipe to the node's run list, and mount volumes using the gluster_mount
LWRP. The Gluster volume will be mounted on the next chef-client run (provided the volume exists and is available) and added to /etc/fstab.
Testing
There is a kitchen file provided to allow testing of the various versions. Examples of tests are:
(Depending on your shell, you may or may not need the \ in the RegEx)
To test a replicated volume on Ubuntu 12.04:
kitchen converge replicated[12]-ubuntu-1204
kitchen verify replicated2-ubuntu-1204
To test a distributed-replicated volume on CentOS 7.1:
kitchen converge distributed-repl[1234]-centos-71
kitchen verify distributed-repl4-centos-71
To test a striped volume on CentOS 6.5:
kitchen converge striped[12]-centos-65
kitchen verify striped2-centos-65
Please note that at present the kitchen setup only supports Virtualbox
Dependent cookbooks
apt >= 2.0 |
yum >= 3.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
gluster cookbook CHANGELOG
v4.0.1 (2015-09-30)
- PR #28 - Add exception handling for peers not being nodes on chef server
- PR #36 - Allow disabling of public Gluster repo
-
PR #37 - Fix default attribute value for
['gluster']['client']['volumes']
- PR #37 - Add include for client_mount recipe in client recipe
v4.0.0 (2015-08-28)
- PR #17 - Allow hostname for older versions of chef-server
- PR #18 - Fix for initial Chef run for the first node in a cluster
- PR #21 - Add ability to disable gluster server service
- PR #22 - Fix Ruby syntax, add Rubocop, add Foodcritic, add TravisCI
- PR #27 - Add glusterfsd service for shutdown cleanup on RHEL 7+
- PR #24 - Wait until peer reaches connected status before continuing
- PR #24 - Add striped, distributed, distributed-striped volume types
- PR #24 - Fix chef node loading
- PR #24 - Add server_extend recipe to allow for automatic gluster scaling
v3.1.0 (2015-07-09)
- PR #6 - Allow to multiple backup servers when mounting a glusterfs volume
- PR #7 - Add recursive true for dir creation under the lvm logic
- PR #9 - Fix Ruby syntax on create partition bash block
- PR #9 - Create a "servicename" attribute so that the service-hook actually starts the correctly named service.
- PR #10 - Modify order of saving the bricks
- PR #13 - Add peer_names attribute to volumes
- PR #14 - Retry peering
- PR #16 - Don't shadow bricks variable
v3.0.1 (2015-03-25)
- PR #2 - Fix typo for brick_mount_path attribute
- Relaxed brick count check for replicated volumes
v3.0.0 (2015-03-20)
- Added a new
gluster_mount
LWRP - Deprecating
gluster::client_mount
recipe - Updated Ubuntu repo location
v2.1.1 (2015-02-17)
- Added backup server option for gluster::client_mount
v2.1.0 (2014-08-29)
- Initial commit
Foodcritic Metric
4.0.1 failed this metric
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/attributes/client.rb:25
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/attributes/server.rb:26
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/attributes/server.rb:38
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/recipes/repository.rb:36
FC048: Prefer Mixlib::ShellOut: /tmp/cook/58673a04603bbee796e680b2/gluster/recipes/server_setup.rb:25
FC048: Prefer Mixlib::ShellOut: /tmp/cook/58673a04603bbee796e680b2/gluster/recipes/server_setup.rb:195
4.0.1 failed this metric
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/attributes/server.rb:26
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/attributes/server.rb:38
FC024: Consider adding platform equivalents: /tmp/cook/58673a04603bbee796e680b2/gluster/recipes/repository.rb:36
FC048: Prefer Mixlib::ShellOut: /tmp/cook/58673a04603bbee796e680b2/gluster/recipes/server_setup.rb:25
FC048: Prefer Mixlib::ShellOut: /tmp/cook/58673a04603bbee796e680b2/gluster/recipes/server_setup.rb:195