Merge pull request #22599 from anthonyeleven/patch-2
[ceph.git] / README.md
1 # Ceph - a scalable distributed storage system
2
3 Please see http://ceph.com/ for current info.
4
5
6 ## Contributing Code
7
8 Most of Ceph is licensed under the LGPL version 2.1.  Some
9 miscellaneous code is under BSD-style license or is public domain.
10 The documentation is licensed under Creative Commons
11 Attribution Share Alike 3.0 (CC-BY-SA-3.0).  There are a handful of headers
12 included here that are licensed under the GPL.  Please see the file
13 COPYING for a full inventory of licenses by file.
14
15 Code contributions must include a valid "Signed-off-by" acknowledging
16 the license for the modified or contributed file.  Please see the file
17 SubmittingPatches.rst for details on what that means and on how to
18 generate and submit patches.
19
20 We do not require assignment of copyright to contribute code; code is
21 contributed under the terms of the applicable license.
22
23
24 ## Checking out the source
25
26 You can clone from github with
27
28         git clone git@github.com:ceph/ceph
29
30 or, if you are not a github user,
31
32         git clone git://github.com/ceph/ceph
33
34 Ceph contains many git submodules that need to be checked out with
35
36         git submodule update --init --recursive
37
38
39 ## Build Prerequisites
40
41 The list of Debian or RPM packages dependencies can be installed with:
42
43         ./install-deps.sh
44
45
46 ## Building Ceph
47
48 Note that these instructions are meant for developers who are
49 compiling the code for development and testing.  To build binaries
50 suitable for installation we recommend you build deb or rpm packages,
51 or refer to the `ceph.spec.in` or `debian/rules` to see which
52 configuration options are specified for production builds.
53
54 Prerequisite: CMake 3.5.1
55
56 Build instructions:
57
58         ./do_cmake.sh
59         cd build
60         make
61
62 This assumes you make your build dir a subdirectory of the ceph.git
63 checkout. If you put it elsewhere, just replace `..` in do_cmake.sh with a
64 correct path to the checkout. Any additional CMake args can be specified
65 setting ARGS before invoking do_cmake. See [cmake options](#cmake-options) 
66 for more details. Eg.
67
68     ARGS="-DCMAKE_C_COMPILER=gcc-7" ./do_cmake.sh
69
70 To build only certain targets use:
71
72         make [target name]
73
74 To install:
75
76         make install
77  
78 ### CMake Options
79
80 If you run the `cmake` command by hand, there are many options you can
81 set with "-D". For example the option to build the RADOS Gateway is
82 defaulted to ON. To build without the RADOS Gateway:
83
84         cmake -DWITH_RADOSGW=OFF [path to top level ceph directory]
85
86 Another example below is building with debugging and alternate locations 
87 for a couple of external dependencies:
88
89         cmake -DLEVELDB_PREFIX="/opt/hyperleveldb" -DOFED_PREFIX="/opt/ofed" \
90         -DCMAKE_INSTALL_PREFIX=/opt/accelio -DCMAKE_C_FLAGS="-O0 -g3 -gdwarf-4" \
91         ..
92
93 To view an exhaustive list of -D options, you can invoke `cmake` with:
94
95         cmake -LH
96
97 If you often pipe `make` to `less` and would like to maintain the
98 diagnostic colors for errors and warnings (and if your compiler
99 supports it), you can invoke `cmake` with:
100
101         cmake -DDIAGNOSTICS_COLOR=always ..
102
103 Then you'll get the diagnostic colors when you execute:
104
105         make | less -R
106
107 Other available values for 'DIAGNOSTICS_COLOR' are 'auto' (default) and
108 'never'.
109
110
111 ## Building a source tarball
112
113 To build a complete source tarball with everything needed to build from
114 source and/or build a (deb or rpm) package, run
115
116         ./make-dist
117
118 This will create a tarball like ceph-$version.tar.bz2 from git.
119 (Ensure that any changes you want to include in your working directory
120 are committed to git.)
121
122
123 ## Running a test cluster
124
125 To run a functional test cluster,
126
127         cd build
128         make vstart        # builds just enough to run vstart
129         ../src/vstart.sh --debug --new -x --localhost --bluestore
130         ./bin/ceph -s
131
132 Almost all of the usual commands are available in the bin/ directory.
133 For example,
134
135         ./bin/rados -p rbd bench 30 write
136         ./bin/rbd create foo --size 1000
137
138 To shut down the test cluster,
139
140         ../src/stop.sh
141
142 To start or stop individual daemons, the sysvinit script can be used:
143
144         ./bin/init-ceph restart osd.0
145         ./bin/init-ceph stop
146
147
148 ## Running unit tests
149
150 To build and run all tests (in parallel using all processors), use `ctest`:
151
152         cd build
153         make
154         ctest -j$(nproc)
155
156 (Note: Many targets built from src/test are not run using `ctest`.
157 Targets starting with "unittest" are run in `make check` and thus can
158 be run with `ctest`. Targets starting with "ceph_test" can not, and should
159 be run by hand.)
160
161 When failures occur, look in build/Testing/Temporary for logs.
162
163 To build and run all tests and their dependencies without other
164 unnecessary targets in Ceph:
165
166         cd build
167         make check -j$(nproc)
168
169 To run an individual test manually, run `ctest` with -R (regex matching):
170
171         ctest -R [regex matching test name(s)]
172
173 (Note: `ctest` does not build the test it's running or the dependencies needed
174 to run it)
175
176 To run an individual test manually and see all the tests output, run
177 `ctest` with the -V (verbose) flag:
178
179         ctest -V -R [regex matching test name(s)]
180
181 To run an tests manually and run the jobs in parallel, run `ctest` with 
182 the `-j` flag:
183
184         ctest -j [number of jobs]
185
186 There are many other flags you can give `ctest` for better control
187 over manual test execution. To view these options run:
188
189         man ctest
190
191
192 ## Building the Documentation
193
194 ### Prerequisites
195
196 The list of package dependencies for building the documentation can be
197 found in `doc_deps.deb.txt`:
198
199         sudo apt-get install `cat doc_deps.deb.txt`
200
201 ### Building the Documentation
202
203 To build the documentation, ensure that you are in the top-level
204 `/ceph` directory, and execute the build script. For example:
205
206         admin/build-doc
207