]> git.proxmox.com Git - ceph.git/blame - ceph/doc/install/ceph-deploy/quick-ceph-deploy.rst
Import ceph 15.2.8
[ceph.git] / ceph / doc / install / ceph-deploy / quick-ceph-deploy.rst
CommitLineData
7c673cae
FG
1=============================
2 Storage Cluster Quick Start
3=============================
4
5If you haven't completed your `Preflight Checklist`_, do that first. This
6**Quick Start** sets up a :term:`Ceph Storage Cluster` using ``ceph-deploy``
7on your admin node. Create a three Ceph Node cluster so you can
8explore Ceph functionality.
9
10.. include:: quick-common.rst
11
224ce89b 12As a first exercise, create a Ceph Storage Cluster with one Ceph Monitor and three
7c673cae 13Ceph OSD Daemons. Once the cluster reaches a ``active + clean`` state, expand it
9f95a23c 14by adding a fourth Ceph OSD Daemon, and two more Ceph Monitors.
7c673cae
FG
15For best results, create a directory on your admin node for maintaining the
16configuration files and keys that ``ceph-deploy`` generates for your cluster. ::
17
18 mkdir my-cluster
19 cd my-cluster
20
21The ``ceph-deploy`` utility will output files to the current directory. Ensure you
22are in this directory when executing ``ceph-deploy``.
23
24.. important:: Do not call ``ceph-deploy`` with ``sudo`` or run it as ``root``
25 if you are logged in as a different user, because it will not issue ``sudo``
26 commands needed on the remote host.
27
7c673cae 28
224ce89b
WB
29Starting over
30=============
7c673cae
FG
31
32If at any point you run into trouble and you want to start over, execute
31f18b77 33the following to purge the Ceph packages, and erase all its data and configuration::
7c673cae 34
31f18b77 35 ceph-deploy purge {ceph-node} [{ceph-node}]
7c673cae
FG
36 ceph-deploy purgedata {ceph-node} [{ceph-node}]
37 ceph-deploy forgetkeys
224ce89b 38 rm ceph.*
7c673cae 39
224ce89b
WB
40If you execute ``purge``, you must re-install Ceph. The last ``rm``
41command removes any files that were written out by ceph-deploy locally
42during a previous installation.
43
44
45Create a Cluster
46================
7c673cae
FG
47
48On your admin node from the directory you created for holding your
49configuration details, perform the following steps using ``ceph-deploy``.
50
51#. Create the cluster. ::
52
224ce89b 53 ceph-deploy new {initial-monitor-node(s)}
7c673cae
FG
54
55 Specify node(s) as hostname, fqdn or hostname:fqdn. For example::
56
224ce89b 57 ceph-deploy new node1
7c673cae 58
224ce89b
WB
59 Check the output of ``ceph-deploy`` with ``ls`` and ``cat`` in the
60 current directory. You should see a Ceph configuration file
61 (``ceph.conf``), a monitor secret keyring (``ceph.mon.keyring``),
62 and a log file for the new cluster. See `ceph-deploy new -h`_ for
63 additional details.
7c673cae 64
9f95a23c
TL
65 Note for users of Ubuntu 18.04: Python 2 is a prerequisite of Ceph.
66 Install the ``python-minimal`` package on Ubuntu 18.04 to provide
67 Python 2::
68
69 [Ubuntu 18.04] $ sudo apt install python-minimal
70
7c673cae
FG
71#. If you have more than one network interface, add the ``public network``
72 setting under the ``[global]`` section of your Ceph configuration file.
73 See the `Network Configuration Reference`_ for details. ::
74
224ce89b 75 public network = {ip-address}/{bits}
7c673cae 76
224ce89b 77 For example,::
7c673cae 78
224ce89b 79 public network = 10.1.2.0/24
7c673cae 80
224ce89b 81 to use IPs in the 10.1.2.0/24 (or 10.1.2.0/255.255.255.0) network.
7c673cae 82
224ce89b
WB
83#. If you are deploying in an IPv6 environment, add the following to
84 ``ceph.conf`` in the local directory::
7c673cae 85
224ce89b 86 echo ms bind ipv6 = true >> ceph.conf
7c673cae 87
224ce89b 88#. Install Ceph packages.::
7c673cae 89
224ce89b 90 ceph-deploy install {ceph-node} [...]
7c673cae
FG
91
92 For example::
93
224ce89b 94 ceph-deploy install node1 node2 node3
7c673cae 95
224ce89b 96 The ``ceph-deploy`` utility will install Ceph on each node.
7c673cae 97
224ce89b 98#. Deploy the initial monitor(s) and gather the keys::
7c673cae 99
224ce89b
WB
100 ceph-deploy mon create-initial
101
102 Once you complete the process, your local directory should have the following
103 keyrings:
7c673cae 104
224ce89b
WB
105 - ``ceph.client.admin.keyring``
106 - ``ceph.bootstrap-mgr.keyring``
107 - ``ceph.bootstrap-osd.keyring``
108 - ``ceph.bootstrap-mds.keyring``
109 - ``ceph.bootstrap-rgw.keyring``
d2e6a577 110 - ``ceph.bootstrap-rbd.keyring``
11fdf7f2 111 - ``ceph.bootstrap-rbd-mirror.keyring``
7c673cae 112
11fdf7f2
TL
113 .. note:: If this process fails with a message similar to "Unable to
114 find /etc/ceph/ceph.client.admin.keyring", please ensure that the
115 IP listed for the monitor node in ceph.conf is the Public IP, not
116 the Private IP.
7c673cae
FG
117
118#. Use ``ceph-deploy`` to copy the configuration file and admin key to
119 your admin node and your Ceph Nodes so that you can use the ``ceph``
120 CLI without having to specify the monitor address and
121 ``ceph.client.admin.keyring`` each time you execute a command. ::
122
224ce89b 123 ceph-deploy admin {ceph-node(s)}
7c673cae
FG
124
125 For example::
126
224ce89b 127 ceph-deploy admin node1 node2 node3
7c673cae 128
c07f9fc5 129#. Deploy a manager daemon. (Required only for luminous+ builds)::
7c673cae 130
c07f9fc5 131 ceph-deploy mgr create node1 *Required only for luminous+ builds, i.e >= 12.x builds*
7c673cae 132
224ce89b 133#. Add three OSDs. For the purposes of these instructions, we assume you have an
f64942e4 134 unused disk in each node called ``/dev/vdb``. *Be sure that the device is not currently in use and does not contain any important data.* ::
7c673cae 135
11fdf7f2 136 ceph-deploy osd create --data {device} {ceph-node}
7c673cae 137
224ce89b 138 For example::
7c673cae 139
11fdf7f2
TL
140 ceph-deploy osd create --data /dev/vdb node1
141 ceph-deploy osd create --data /dev/vdb node2
142 ceph-deploy osd create --data /dev/vdb node3
143
144 .. note:: If you are creating an OSD on an LVM volume, the argument to
145 ``--data`` *must* be ``volume_group/lv_name``, rather than the path to
146 the volume's block device.
7c673cae 147
224ce89b 148#. Check your cluster's health. ::
7c673cae 149
224ce89b 150 ssh node1 sudo ceph health
7c673cae 151
224ce89b
WB
152 Your cluster should report ``HEALTH_OK``. You can view a more complete
153 cluster status with::
7c673cae 154
224ce89b 155 ssh node1 sudo ceph -s
7c673cae
FG
156
157
158Expanding Your Cluster
159======================
160
9f95a23c
TL
161Once you have a basic cluster up and running, the next step is to expand
162cluster. Then add a Ceph Monitor and Ceph Manager to ``node2`` and ``node3``
163to improve reliability and availability.
7c673cae
FG
164
165.. ditaa::
f91f0fd5 166
7c673cae
FG
167 /------------------\ /----------------\
168 | ceph-deploy | | node1 |
169 | Admin Node | | cCCC |
9f95a23c
TL
170 | +-------->+ |
171 | | | mon.node1 |
224ce89b
WB
172 | | | osd.0 |
173 | | | mgr.node1 |
7c673cae
FG
174 \---------+--------/ \----------------/
175 |
176 | /----------------\
177 | | node2 |
178 | | cCCC |
179 +----------------->+ |
11fdf7f2 180 | | osd.1 |
7c673cae
FG
181 | | mon.node2 |
182 | \----------------/
183 |
184 | /----------------\
185 | | node3 |
186 | | cCCC |
187 +----------------->+ |
11fdf7f2 188 | osd.2 |
7c673cae
FG
189 | mon.node3 |
190 \----------------/
191
224ce89b
WB
192Adding Monitors
193---------------
7c673cae 194
224ce89b
WB
195A Ceph Storage Cluster requires at least one Ceph Monitor and Ceph
196Manager to run. For high availability, Ceph Storage Clusters typically
197run multiple Ceph Monitors so that the failure of a single Ceph
198Monitor will not bring down the Ceph Storage Cluster. Ceph uses the
11fdf7f2 199Paxos algorithm, which requires a majority of monitors (i.e., greater
224ce89b
WB
200than *N/2* where *N* is the number of monitors) to form a quorum.
201Odd numbers of monitors tend to be better, although this is not required.
7c673cae 202
224ce89b
WB
203.. tip: If you did not define the ``public network`` option above then
204 the new monitor will not know which IP address to bind to on the
205 new hosts. You can add this line to your ``ceph.conf`` by editing
206 it now and then push it out to each node with
207 ``ceph-deploy --overwrite-conf config push {ceph-nodes}``.
7c673cae 208
224ce89b 209Add two Ceph Monitors to your cluster::
7c673cae 210
224ce89b 211 ceph-deploy mon add {ceph-nodes}
7c673cae 212
224ce89b 213For example::
7c673cae 214
224ce89b 215 ceph-deploy mon add node2 node3
7c673cae 216
224ce89b
WB
217Once you have added your new Ceph Monitors, Ceph will begin synchronizing
218the monitors and form a quorum. You can check the quorum status by executing
219the following::
7c673cae 220
224ce89b 221 ceph quorum_status --format json-pretty
7c673cae
FG
222
223
224ce89b
WB
224.. tip:: When you run Ceph with multiple monitors, you SHOULD install and
225 configure NTP on each monitor host. Ensure that the
226 monitors are NTP peers.
7c673cae 227
224ce89b
WB
228Adding Managers
229---------------
7c673cae 230
224ce89b
WB
231The Ceph Manager daemons operate in an active/standby pattern. Deploying
232additional manager daemons ensures that if one daemon or host fails, another
233one can take over without interrupting service.
7c673cae 234
224ce89b 235To deploy additional manager daemons::
7c673cae 236
224ce89b 237 ceph-deploy mgr create node2 node3
7c673cae 238
224ce89b 239You should see the standby managers in the output from::
7c673cae 240
224ce89b 241 ssh node1 sudo ceph -s
7c673cae
FG
242
243
244Add an RGW Instance
245-------------------
246
247To use the :term:`Ceph Object Gateway` component of Ceph, you must deploy an
248instance of :term:`RGW`. Execute the following to create an new instance of
249RGW::
250
251 ceph-deploy rgw create {gateway-node}
252
253For example::
254
255 ceph-deploy rgw create node1
256
7c673cae
FG
257By default, the :term:`RGW` instance will listen on port 7480. This can be
258changed by editing ceph.conf on the node running the :term:`RGW` as follows:
259
260.. code-block:: ini
261
262 [client]
263 rgw frontends = civetweb port=80
264
265To use an IPv6 address, use:
266
267.. code-block:: ini
268
269 [client]
270 rgw frontends = civetweb port=[::]:80
271
272
7c673cae
FG
273
274Storing/Retrieving Object Data
275==============================
276
277To store object data in the Ceph Storage Cluster, a Ceph client must:
278
279#. Set an object name
280#. Specify a `pool`_
281
282The Ceph Client retrieves the latest cluster map and the CRUSH algorithm
283calculates how to map the object to a `placement group`_, and then calculates
284how to assign the placement group to a Ceph OSD Daemon dynamically. To find the
285object location, all you need is the object name and the pool name. For
286example::
287
224ce89b 288 ceph osd map {poolname} {object-name}
7c673cae
FG
289
290.. topic:: Exercise: Locate an Object
291
224ce89b
WB
292 As an exercise, lets create an object. Specify an object name, a path to
293 a test file containing some object data and a pool name using the
294 ``rados put`` command on the command line. For example::
7c673cae 295
224ce89b 296 echo {Test-data} > testfile.txt
9f95a23c 297 ceph osd pool create mytest
224ce89b
WB
298 rados put {object-name} {file-path} --pool=mytest
299 rados put test-object-1 testfile.txt --pool=mytest
7c673cae 300
224ce89b
WB
301 To verify that the Ceph Storage Cluster stored the object, execute
302 the following::
7c673cae 303
224ce89b 304 rados -p mytest ls
7c673cae 305
224ce89b 306 Now, identify the object location::
7c673cae 307
224ce89b
WB
308 ceph osd map {pool-name} {object-name}
309 ceph osd map mytest test-object-1
310
311 Ceph should output the object's location. For example::
312
313 osdmap e537 pool 'mytest' (1) object 'test-object-1' -> pg 1.d1743484 (1.4) -> up [1,0] acting [1,0]
314
315 To remove the test object, simply delete it using the ``rados rm``
316 command.
317
318 For example::
7c673cae 319
224ce89b 320 rados rm test-object-1 --pool=mytest
7c673cae 321
224ce89b 322 To delete the ``mytest`` pool::
7c673cae 323
224ce89b 324 ceph osd pool rm mytest
7c673cae 325
224ce89b
WB
326 (For safety reasons you will need to supply additional arguments as
327 prompted; deleting pools destroys data.)
7c673cae
FG
328
329As the cluster evolves, the object location may change dynamically. One benefit
330of Ceph's dynamic rebalancing is that Ceph relieves you from having to perform
224ce89b 331data migration or balancing manually.
7c673cae
FG
332
333
334.. _Preflight Checklist: ../quick-start-preflight
335.. _Ceph Deploy: ../../rados/deployment
336.. _ceph-deploy install -h: ../../rados/deployment/ceph-deploy-install
337.. _ceph-deploy new -h: ../../rados/deployment/ceph-deploy-new
338.. _ceph-deploy osd: ../../rados/deployment/ceph-deploy-osd
339.. _Running Ceph with Upstart: ../../rados/operations/operating#running-ceph-with-upstart
340.. _Running Ceph with sysvinit: ../../rados/operations/operating#running-ceph-with-sysvinit
341.. _CRUSH Map: ../../rados/operations/crush-map
342.. _pool: ../../rados/operations/pools
343.. _placement group: ../../rados/operations/placement-groups
344.. _Monitoring a Cluster: ../../rados/operations/monitoring
345.. _Monitoring OSDs and PGs: ../../rados/operations/monitoring-osd-pg
346.. _Network Configuration Reference: ../../rados/configuration/network-config-ref
347.. _User Management: ../../rados/operations/user-management