2012-05-18 20:54:51 +00:00
|
|
|
=====================
|
|
|
|
Deploying with Chef
|
|
|
|
=====================
|
|
|
|
|
|
|
|
We use Chef cookbooks to deploy Ceph. See `Managing Cookbooks with Knife`_ for details
|
2012-05-22 01:22:35 +00:00
|
|
|
on using ``knife``. For Chef installation instructions, see
|
2012-07-05 20:47:45 +00:00
|
|
|
`Installing Chef`_.
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
Clone the Required Cookbooks
|
|
|
|
----------------------------
|
2012-05-18 20:54:51 +00:00
|
|
|
|
|
|
|
To get the cookbooks for Ceph, clone them from git.::
|
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
cd ~/chef-cookbooks
|
|
|
|
git clone https://github.com/opscode-cookbooks/apache2.git
|
2012-05-18 20:54:51 +00:00
|
|
|
git clone https://github.com/ceph/ceph-cookbooks.git
|
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
Install the Cookbooks
|
|
|
|
---------------------
|
|
|
|
|
2012-07-05 21:00:22 +00:00
|
|
|
To install Ceph, you must install the Ceph cookbooks and the Apache cookbooks
|
|
|
|
(for use with RADOSGW). ::
|
|
|
|
|
|
|
|
knife cookbook upload apache2 ceph
|
2012-07-05 20:47:45 +00:00
|
|
|
|
|
|
|
Configure your Ceph Environment
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
The Chef server can support installation of software for multiple environments.
|
|
|
|
The environment you create for Ceph requires an ``fsid``, the secret for
|
|
|
|
your monitor(s) if you are running Ceph with ``cephx`` authentication, and
|
|
|
|
the host name (i.e., short name) for your monitor hosts.
|
|
|
|
|
|
|
|
.. tip: Open an empty text file to hold the following values until you create
|
|
|
|
your Ceph environment.
|
|
|
|
|
|
|
|
For the filesystem ID, use ``uuidgen`` from the ``uuid-runtime`` package to
|
|
|
|
generate a unique identifier. ::
|
|
|
|
|
|
|
|
uuidgen -r
|
|
|
|
|
2012-07-05 21:01:45 +00:00
|
|
|
For the monitor(s) secret(s), use ``ceph-authtool`` to generate the secret(s)::
|
2012-07-05 20:47:45 +00:00
|
|
|
|
|
|
|
ceph-authtool /dev/stdout --name=mon. --gen-key
|
|
|
|
|
2012-07-05 21:01:45 +00:00
|
|
|
The secret is the value to the right of ``"key ="``, and should look something
|
2012-07-05 20:47:45 +00:00
|
|
|
like this::
|
|
|
|
|
|
|
|
AQBAMuJPINJgFhAAziXIrLvTvAz4PRo5IK/Log==
|
|
|
|
|
|
|
|
To create an environment for Ceph, set a command line editor. For example::
|
|
|
|
|
|
|
|
export EDITOR=vim
|
|
|
|
|
|
|
|
Then, use ``knife`` to create an environment. ::
|
|
|
|
|
|
|
|
knife environment create {env-name}
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
knife environment create Ceph
|
|
|
|
|
2012-07-05 21:01:45 +00:00
|
|
|
A JSON file will appear. Perform the following steps:
|
2012-07-05 20:47:45 +00:00
|
|
|
|
|
|
|
#. Enter a description for the environment.
|
|
|
|
#. In ``"default_attributes": {}``, add ``"ceph" : {}``.
|
|
|
|
#. Within ``"ceph" : {}``, add ``"monitor-secret":``.
|
|
|
|
#. Immediately following ``"monitor-secret":`` add the key you generated within quotes, followed by a comma.
|
|
|
|
#. Within ``"ceph":{}`` and following the ``monitor-secret`` key-value pair, add ``"config": {}``
|
|
|
|
#. Within ``"config": {}`` add ``"fsid":``.
|
|
|
|
#. Immediately following ``"fsid":``, add the unique identifier you generated within quotes, followed by a comma.
|
|
|
|
#. Within ``"config": {}`` and following the ``fsid`` key-value pair, add ``"mon_initial_members":``
|
|
|
|
#. Immediately following ``"mon_initial_members":``, enter the initial monitor host names.
|
|
|
|
|
2012-07-05 21:01:45 +00:00
|
|
|
For example::
|
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
"default-attributes" : {
|
2012-07-05 21:01:45 +00:00
|
|
|
"ceph": {
|
|
|
|
"monitor-secret": "AQBAMuJPINJgFhAAziXIrLvTvAz4PRo5IK/Log==",
|
|
|
|
"config": {
|
|
|
|
"fsid": "ddca2b02-3ddf-42fb-ba52-0ee1982c6da0",
|
|
|
|
"mon_initial_members": "mon-host"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Advanced users (i.e., developers and QA) may also add ``"ceph_branch": "{branch}"``
|
|
|
|
to ``default-attributes``, replacing ``{branch}`` with the name of the branch you
|
|
|
|
wish to use (e.g., ``master``).
|
2012-07-05 20:47:45 +00:00
|
|
|
|
|
|
|
Configure the Roles
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
Navigate to the Ceph cookbooks directory. ::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
cd ~/chef-cookbooks/ceph-cookbooks
|
|
|
|
|
|
|
|
Create roles for OSDs, monitors, metadata servers, and RADOS Gateways from
|
|
|
|
their respective role files. ::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
knife role from file ceph/roles/ceph-osd.rb
|
|
|
|
knife role from file ceph/roles/ceph-mon.rb
|
|
|
|
knife role from file ceph/roles/ceph-mds.rb
|
|
|
|
knife role from file ceph/roles/ceph-radosgw.rb
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
Configure Nodes
|
|
|
|
---------------
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
You must configure each node you intend to include in your Ceph cluster.
|
|
|
|
Identify nodes for your Ceph cluster. ::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
knife node list
|
|
|
|
|
|
|
|
.. note: for each host where you installed Chef and executed ``chef-client``,
|
|
|
|
the Chef server should have a minimal node configuration. You can create
|
|
|
|
additional nodes with ``knife node create {node-name}``.
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
For each node you intend to use in your Ceph cluster, configure the node
|
|
|
|
as follows::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
knife node edit {node-name}
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
The node configuration should appear in your text editor. Change the
|
|
|
|
``chef_environment`` value to ``Ceph`` (or whatever name you set for your
|
|
|
|
Ceph environment).
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
In the ``run_list``, add ``"recipe[ceph::apt]",`` to all nodes as the first
|
|
|
|
setting, so that Chef can install or update the necessary packages. Then,
|
|
|
|
add at least one of::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
"role[ceph-mon]"
|
|
|
|
"role[ceph-osd]"
|
|
|
|
"role[ceph-mds]"
|
|
|
|
"role[ceph-radosgw]"
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
If you add more than one role, separate them with a comma. The following
|
|
|
|
example adds a node named `mon-host` to the `Ceph` environment and
|
|
|
|
runs the ``apt`` recipe followed by the roles ``ceph-mon`` and ``ceph-osd``::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
{
|
|
|
|
"chef_environment": "Ceph",
|
|
|
|
"name": "mon-host",
|
|
|
|
"normal": {
|
|
|
|
"tags": [
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"run_list": [
|
2012-07-05 21:01:45 +00:00
|
|
|
"recipe[ceph::apt]",
|
|
|
|
"role[ceph-mon]",
|
|
|
|
"role[ceph-mds]"
|
2012-07-05 20:47:45 +00:00
|
|
|
]
|
|
|
|
}
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
Prepare OSD Disks
|
|
|
|
-----------------
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
For the Ceph 0.48 Argonaut release, install ``gdisk`` and configure the OSD
|
|
|
|
hard disks for use with Ceph. Replace ``{fsid}`` with the UUID you generated
|
|
|
|
while using ``uuidgen -r``.
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
.. important: This procedure will erase all information in ``/dev/sdb``.
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
sudo apt-get install gdisk
|
|
|
|
sudo sgdisk /dev/sdb --zap-all --clear --mbrtogpt --largest-new=1 --change-name=1:'ceph data' --typecode=1:{fsid}
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
Create a file system and allocate the disk to your cluster. Specify a
|
|
|
|
filesystem (e.g., ``ext4``, ``xfs``, ``btrfs``). When you execute
|
|
|
|
``ceph-disk-prepare``, remember to replace ``{fsid}`` with the UUID you
|
|
|
|
generated while using ``uuidgen -r``::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
sudo mkfs -t ext4 /dev/sdb1
|
|
|
|
sudo mount -o user_xattr /dev/sdb1 /mnt
|
|
|
|
sudo ceph-disk-prepare --cluster-uuid={fsid} /mnt
|
|
|
|
sudo umount /mnt
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
Finally, simulate a hotplug event. ::
|
2012-05-18 20:54:51 +00:00
|
|
|
|
2012-07-05 20:47:45 +00:00
|
|
|
sudo udevadm trigger --subsystem-match=block --action=add
|
2012-05-18 20:54:51 +00:00
|
|
|
|
|
|
|
.. _Managing Cookbooks with Knife: http://wiki.opscode.com/display/chef/Managing+Cookbooks+With+Knife
|
2012-07-05 20:47:45 +00:00
|
|
|
.. _Installing Chef: ../../install/chef
|