]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/quick_guide.rst
update ceph source to reef 18.1.2
[ceph.git] / ceph / doc / dev / quick_guide.rst
CommitLineData
7c673cae
FG
1=================================
2 Developer Guide (Quick)
3=================================
4
5This guide will describe how to build and test Ceph for development.
6
7Development
8-----------
9
10The ``run-make-check.sh`` script will install Ceph dependencies,
11compile everything in debug mode and run a number of tests to verify
12the result behaves as expected.
13
f67539c2 14.. prompt:: bash $
7c673cae 15
f67539c2 16 ./run-make-check.sh
7c673cae 17
9f95a23c
TL
18Optionally if you want to work on a specific component of Ceph,
19install the dependencies and build Ceph in debug mode with required cmake flags.
20
21Example:
22
f67539c2 23.. prompt:: bash $
9f95a23c 24
f67539c2
TL
25 ./install-deps.sh
26 ./do_cmake.sh -DWITH_MANPAGE=OFF -DWITH_BABELTRACE=OFF -DWITH_MGR_DASHBOARD_FRONTEND=OFF
7c673cae 27
20effc67
TL
28You can also turn off building of some core components that are not relevant to
29your development:
30
31.. prompt:: bash $
32
33 ./do_cmake.sh ... -DWITH_RBD=OFF -DWITH_KRBD=OFF -DWITH_RADOSGW=OFF
34
35Finally, build ceph:
36
37.. prompt:: bash $
38
39 cmake --build build [--target <target>...]
40
41Omit ``--target...`` if you want to do a full build.
42
43
7c673cae
FG
44Running a development deployment
45--------------------------------
20effc67
TL
46
47Ceph contains a script called ``vstart.sh`` (see also
1e59de90 48:doc:`/dev/dev_cluster_deployment`) which allows developers to quickly test
20effc67
TL
49their code using a simple deployment on your development system. Once the build
50finishes successfully, start the ceph deployment using the following command:
7c673cae 51
f67539c2 52.. prompt:: bash $
7c673cae 53
20effc67
TL
54 cd build
55 ../src/vstart.sh -d -n
7c673cae
FG
56
57You can also configure ``vstart.sh`` to use only one monitor and one metadata server by using the following:
58
f67539c2 59.. prompt:: bash $
7c673cae 60
20effc67
TL
61 env MON=1 MDS=1 ../src/vstart.sh -d -n -x
62
63Most logs from the cluster can be found in ``build/out``.
7c673cae 64
c07f9fc5 65The system creates two pools on startup: `cephfs_data_a` and `cephfs_metadata_a`. Let's get some stats on
7c673cae
FG
66the current pools:
67
f67539c2 68.. code-block:: console
7c673cae 69
f67539c2
TL
70 $ bin/ceph osd pool stats
71 *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
72 pool cephfs_data_a id 1
73 nothing is going on
7c673cae 74
f67539c2
TL
75 pool cephfs_metadata_a id 2
76 nothing is going on
7c673cae 77
f67539c2
TL
78 $ bin/ceph osd pool stats cephfs_data_a
79 *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
80 pool cephfs_data_a id 1
81 nothing is going on
7c673cae 82
f67539c2
TL
83 $ bin/rados df
84 POOL_NAME USED OBJECTS CLONES COPIES MISSING_ON_PRIMARY UNFOUND DEGRADED RD_OPS RD WR_OPS WR
85 cephfs_data_a 0 0 0 0 0 0 0 0 0 0 0
86 cephfs_metadata_a 2246 21 0 63 0 0 0 0 0 42 8192
c07f9fc5 87
f67539c2
TL
88 total_objects 21
89 total_used 244G
90 total_space 1180G
7c673cae
FG
91
92
93Make a pool and run some benchmarks against it:
94
f67539c2 95.. prompt:: bash $
7c673cae 96
f67539c2
TL
97 bin/ceph osd pool create mypool
98 bin/rados -p mypool bench 10 write -b 123
7c673cae
FG
99
100Place a file into the new pool:
101
f67539c2 102.. prompt:: bash $
7c673cae 103
f67539c2
TL
104 bin/rados -p mypool put objectone <somefile>
105 bin/rados -p mypool put objecttwo <anotherfile>
7c673cae
FG
106
107List the objects in the pool:
108
f67539c2 109.. prompt:: bash $
7c673cae 110
f67539c2 111 bin/rados -p mypool ls
7c673cae
FG
112
113Once you are done, type the following to stop the development ceph deployment:
114
f67539c2 115.. prompt:: bash $
7c673cae 116
f67539c2 117 ../src/stop.sh
7c673cae
FG
118
119Resetting your vstart environment
120---------------------------------
121
122The vstart script creates out/ and dev/ directories which contain
123the cluster's state. If you want to quickly reset your environment,
124you might do something like this:
125
f67539c2 126.. prompt:: bash [build]$
7c673cae 127
f67539c2
TL
128 ../src/stop.sh
129 rm -rf out dev
20effc67 130 env MDS=1 MON=1 OSD=3 ../src/vstart.sh -n -d
7c673cae
FG
131
132Running a RadosGW development environment
133-----------------------------------------
31f18b77
FG
134
135Set the ``RGW`` environment variable when running vstart.sh to enable the RadosGW.
7c673cae 136
f67539c2 137.. prompt:: bash $
7c673cae 138
f67539c2
TL
139 cd build
140 RGW=1 ../src/vstart.sh -d -n -x
7c673cae
FG
141
142You can now use the swift python client to communicate with the RadosGW.
143
f67539c2 144.. prompt:: bash $
7c673cae 145
f67539c2
TL
146 swift -A http://localhost:8000/auth -U test:tester -K testing list
147 swift -A http://localhost:8000/auth -U test:tester -K testing upload mycontainer ceph
148 swift -A http://localhost:8000/auth -U test:tester -K testing list
7c673cae
FG
149
150
151Run unit tests
152--------------
153
154The tests are located in `src/tests`. To run them type:
155
f67539c2 156.. prompt:: bash $
7c673cae 157
20effc67 158 (cd build && ninja check)