2017-04-17 15:49:32 +00:00
|
|
|
# Ceph - a scalable distributed storage system
|
2007-03-15 23:23:52 +00:00
|
|
|
|
2023-08-17 10:38:20 +00:00
|
|
|
See https://ceph.com/ for current information about Ceph.
|
2008-02-01 17:59:44 +00:00
|
|
|
|
2024-05-13 18:14:27 +00:00
|
|
|
## Status
|
|
|
|
|
|
|
|
[![Issue Backporting](https://github.com/ceph/ceph/actions/workflows/create-backport-trackers.yml/badge.svg)](https://github.com/ceph/ceph/actions/workflows/create-backport-trackers.yml)
|
2016-06-22 18:13:28 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Contributing Code
|
2012-04-11 19:33:57 +00:00
|
|
|
|
2023-08-17 10:38:20 +00:00
|
|
|
Most of Ceph is dual-licensed under the LGPL version 2.1 or 3.0. Some
|
|
|
|
miscellaneous code is either public domain or licensed under a BSD-style
|
|
|
|
license.
|
2012-04-11 19:33:57 +00:00
|
|
|
|
2023-08-17 10:38:20 +00:00
|
|
|
The Ceph documentation is licensed under Creative Commons Attribution Share
|
|
|
|
Alike 3.0 (CC-BY-SA-3.0).
|
2012-04-11 19:33:57 +00:00
|
|
|
|
2023-08-17 10:38:20 +00:00
|
|
|
Some headers included in the `ceph/ceph` repository are licensed under the GPL.
|
|
|
|
See the file `COPYING` for a full inventory of licenses by file.
|
|
|
|
|
|
|
|
All code contributions must include a valid "Signed-off-by" line. See the file
|
|
|
|
`SubmittingPatches.rst` for details on this and instructions on how to generate
|
|
|
|
and submit patches.
|
|
|
|
|
|
|
|
Assignment of copyright is not required to contribute code. Code is
|
2012-04-11 19:33:57 +00:00
|
|
|
contributed under the terms of the applicable license.
|
|
|
|
|
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Checking out the source
|
2016-06-16 17:44:35 +00:00
|
|
|
|
2023-07-25 13:09:11 +00:00
|
|
|
Clone the ceph/ceph repository from github by running the following command on
|
|
|
|
a system that has git installed:
|
2016-06-16 17:44:35 +00:00
|
|
|
|
2016-06-27 18:03:11 +00:00
|
|
|
git clone git@github.com:ceph/ceph
|
2016-06-16 17:44:35 +00:00
|
|
|
|
2023-07-25 13:09:11 +00:00
|
|
|
Alternatively, if you are not a github user, you should run the following
|
|
|
|
command on a system that has git installed:
|
2016-06-16 17:44:35 +00:00
|
|
|
|
2023-01-29 07:12:01 +00:00
|
|
|
git clone https://github.com/ceph/ceph.git
|
2016-06-16 17:44:35 +00:00
|
|
|
|
2023-08-15 03:28:00 +00:00
|
|
|
When the `ceph/ceph` repository has been cloned to your system, run the
|
|
|
|
following commands to move into the cloned `ceph/ceph` repository and to check
|
|
|
|
out the git submodules associated with it:
|
2016-06-16 17:44:35 +00:00
|
|
|
|
2023-08-15 03:28:00 +00:00
|
|
|
cd ceph
|
2023-10-26 10:48:31 +00:00
|
|
|
git submodule update --init --recursive --progress
|
2016-06-16 17:44:35 +00:00
|
|
|
|
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Build Prerequisites
|
2014-08-05 18:48:38 +00:00
|
|
|
|
2023-07-27 11:49:19 +00:00
|
|
|
*section last updated 27 Jul 2023*
|
|
|
|
|
2023-07-25 13:09:11 +00:00
|
|
|
Make sure that ``curl`` is installed. The Debian and Ubuntu ``apt`` command is
|
|
|
|
provided here, but if you use a system with a different package manager, then
|
|
|
|
you must use whatever command is the proper counterpart of this one:
|
|
|
|
|
|
|
|
apt install curl
|
|
|
|
|
|
|
|
Install Debian or RPM package dependencies by running the following command:
|
2014-08-05 18:48:38 +00:00
|
|
|
|
2014-11-25 16:25:26 +00:00
|
|
|
./install-deps.sh
|
2014-08-05 18:48:38 +00:00
|
|
|
|
2023-07-27 11:49:19 +00:00
|
|
|
Install the ``python3-routes`` package:
|
|
|
|
|
|
|
|
apt install python3-routes
|
|
|
|
|
2014-08-05 18:48:38 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Building Ceph
|
2012-04-05 18:43:11 +00:00
|
|
|
|
2023-07-25 13:09:11 +00:00
|
|
|
These instructions are meant for developers who are compiling the code for
|
|
|
|
development and testing. To build binaries that are suitable for installation
|
2023-08-19 09:29:08 +00:00
|
|
|
we recommend that you build `.deb` or `.rpm` packages, or refer to
|
|
|
|
``ceph.spec.in`` or ``debian/rules`` to see which configuration options are
|
|
|
|
specified for production builds.
|
2015-08-04 16:45:52 +00:00
|
|
|
|
2023-08-19 09:29:08 +00:00
|
|
|
To build Ceph, make sure that you are in the top-level `ceph` directory that
|
|
|
|
contains `do_cmake.sh` and `CONTRIBUTING.rst` and run the following commands:
|
2015-08-04 16:45:52 +00:00
|
|
|
|
2016-06-27 18:03:11 +00:00
|
|
|
./do_cmake.sh
|
2015-08-04 16:45:52 +00:00
|
|
|
cd build
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja
|
2015-08-04 16:45:52 +00:00
|
|
|
|
2023-08-19 09:29:08 +00:00
|
|
|
``do_cmake.sh`` by default creates a "debug build" of Ceph, which can be up to
|
|
|
|
five times slower than a non-debug build. Pass
|
|
|
|
``-DCMAKE_BUILD_TYPE=RelWithDebInfo`` to ``do_cmake.sh`` to create a non-debug
|
|
|
|
build.
|
|
|
|
|
|
|
|
[Ninja](https://ninja-build.org/) is the buildsystem used by the Ceph project
|
|
|
|
to build test builds. The number of jobs used by `ninja` is derived from the
|
|
|
|
number of CPU cores of the building host if unspecified. Use the `-j` option to
|
|
|
|
limit the job number if the build jobs are running out of memory. If you
|
|
|
|
attempt to run `ninja` and receive a message that reads `g++: fatal error:
|
|
|
|
Killed signal terminated program cc1plus`, then you have run out of memory.
|
|
|
|
Using the `-j` option with an argument appropriate to the hardware on which the
|
|
|
|
`ninja` command is run is expected to result in a successful build. For example,
|
|
|
|
to limit the job number to 3, run the command `ninja -j 3`. On average, each
|
|
|
|
`ninja` job run in parallel needs approximately 2.5 GiB of RAM.
|
|
|
|
|
|
|
|
This documentation assumes that your build directory is a subdirectory of the
|
|
|
|
`ceph.git` checkout. If the build directory is located elsewhere, point
|
|
|
|
`CEPH_GIT_DIR` to the correct path of the checkout. Additional CMake args can
|
|
|
|
be specified by setting ARGS before invoking ``do_cmake.sh``. See [cmake
|
|
|
|
options](#cmake-options) for more details. For example:
|
2018-01-10 17:05:52 +00:00
|
|
|
|
|
|
|
ARGS="-DCMAKE_C_COMPILER=gcc-7" ./do_cmake.sh
|
2016-06-16 17:47:12 +00:00
|
|
|
|
2023-08-19 09:29:08 +00:00
|
|
|
To build only certain targets, run a command of the following form:
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja [target name]
|
2016-06-29 20:05:26 +00:00
|
|
|
|
|
|
|
To install:
|
|
|
|
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja install
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
### CMake Options
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2023-08-21 13:53:33 +00:00
|
|
|
The `-D` flag can be used with `cmake` to speed up the process of building Ceph
|
|
|
|
and to customize the build.
|
|
|
|
|
|
|
|
#### Building without RADOS Gateway
|
|
|
|
|
|
|
|
The RADOS Gateway is built by default. To build Ceph without the RADOS Gateway,
|
|
|
|
run a command of the following form:
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2021-06-22 05:48:09 +00:00
|
|
|
cmake -DWITH_RADOSGW=OFF [path to top-level ceph directory]
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2023-08-21 13:53:33 +00:00
|
|
|
#### Building with debugging and arbitrary dependency locations
|
|
|
|
|
|
|
|
Run a command of the following form to build Ceph with debugging and alternate
|
|
|
|
locations for some external dependencies:
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2023-03-23 12:04:59 +00:00
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/opt/ceph -DCMAKE_C_FLAGS="-Og -g3 -gdwarf-4" \
|
2017-10-31 05:44:23 +00:00
|
|
|
..
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2022-03-31 18:35:45 +00:00
|
|
|
Ceph has several bundled dependencies such as Boost, RocksDB and Arrow. By
|
2023-08-21 13:53:33 +00:00
|
|
|
default, `cmake` builds these bundled dependencies from source instead of using
|
|
|
|
libraries that are already installed on the system. You can opt to use these
|
|
|
|
system libraries, as long as they meet Ceph's version requirements. To use
|
|
|
|
system libraries, use `cmake` options like `WITH_SYSTEM_BOOST`, as in the
|
|
|
|
following example:
|
2022-03-31 18:35:45 +00:00
|
|
|
|
|
|
|
cmake -DWITH_SYSTEM_BOOST=ON [...]
|
|
|
|
|
2023-08-21 13:53:33 +00:00
|
|
|
To view an exhaustive list of -D options, invoke `cmake -LH`:
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2017-10-31 05:44:23 +00:00
|
|
|
cmake -LH
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2023-08-21 13:53:33 +00:00
|
|
|
#### Preserving diagnostic colors
|
|
|
|
|
|
|
|
If you pipe `ninja` to `less` and would like to preserve the diagnostic colors
|
|
|
|
in the output in order to make errors and warnings more legible, run the
|
|
|
|
following command:
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2021-06-22 05:48:09 +00:00
|
|
|
cmake -DDIAGNOSTICS_COLOR=always ...
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2023-08-21 13:53:33 +00:00
|
|
|
The above command works only with supported compilers.
|
|
|
|
|
|
|
|
The diagnostic colors will be visible when the following command is run:
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja | less -R
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2023-08-21 13:53:33 +00:00
|
|
|
Other available values for `DIAGNOSTICS_COLOR` are `auto` (default) and
|
|
|
|
`never`.
|
2016-06-29 20:05:26 +00:00
|
|
|
|
2015-08-04 16:45:52 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Building a source tarball
|
2012-04-11 19:33:57 +00:00
|
|
|
|
2016-08-23 18:22:21 +00:00
|
|
|
To build a complete source tarball with everything needed to build from
|
|
|
|
source and/or build a (deb or rpm) package, run
|
2008-03-18 16:31:04 +00:00
|
|
|
|
2016-08-23 18:22:21 +00:00
|
|
|
./make-dist
|
2008-03-18 16:31:04 +00:00
|
|
|
|
2016-08-23 18:22:21 +00:00
|
|
|
This will create a tarball like ceph-$version.tar.bz2 from git.
|
|
|
|
(Ensure that any changes you want to include in your working directory
|
|
|
|
are committed to git.)
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2016-06-16 17:55:11 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Running a test cluster
|
2016-06-16 17:55:11 +00:00
|
|
|
|
2023-09-01 00:19:58 +00:00
|
|
|
From the `ceph/` directory, run the following commands to launch a test Ceph
|
|
|
|
cluster:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
|
|
|
cd build
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja vstart # builds just enough to run vstart
|
2017-09-11 14:39:18 +00:00
|
|
|
../src/vstart.sh --debug --new -x --localhost --bluestore
|
2016-06-20 19:15:09 +00:00
|
|
|
./bin/ceph -s
|
|
|
|
|
2023-09-01 00:19:58 +00:00
|
|
|
Most Ceph commands are available in the `bin/` directory. For example:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
|
|
|
./bin/rbd create foo --size 1000
|
2023-09-08 11:00:38 +00:00
|
|
|
./bin/rados -p foo bench 30 write
|
2016-06-16 17:55:11 +00:00
|
|
|
|
2023-09-01 00:19:58 +00:00
|
|
|
To shut down the test cluster, run the following command from the `build/`
|
|
|
|
directory:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-22 18:13:28 +00:00
|
|
|
../src/stop.sh
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2023-09-01 00:19:58 +00:00
|
|
|
Use the sysvinit script to start or stop individual daemons:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
|
|
|
./bin/init-ceph restart osd.0
|
|
|
|
./bin/init-ceph stop
|
2016-06-16 17:55:11 +00:00
|
|
|
|
2016-06-22 18:13:28 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Running unit tests
|
2016-06-15 20:54:53 +00:00
|
|
|
|
2016-06-29 20:05:26 +00:00
|
|
|
To build and run all tests (in parallel using all processors), use `ctest`:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
|
|
|
cd build
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja
|
2016-06-22 18:13:28 +00:00
|
|
|
ctest -j$(nproc)
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-29 20:05:26 +00:00
|
|
|
(Note: Many targets built from src/test are not run using `ctest`.
|
2021-03-12 04:21:39 +00:00
|
|
|
Targets starting with "unittest" are run in `ninja check` and thus can
|
2016-06-29 20:05:26 +00:00
|
|
|
be run with `ctest`. Targets starting with "ceph_test" can not, and should
|
|
|
|
be run by hand.)
|
|
|
|
|
2016-11-10 22:43:41 +00:00
|
|
|
When failures occur, look in build/Testing/Temporary for logs.
|
|
|
|
|
2016-06-29 20:05:26 +00:00
|
|
|
To build and run all tests and their dependencies without other
|
|
|
|
unnecessary targets in Ceph:
|
|
|
|
|
2017-10-31 05:44:23 +00:00
|
|
|
cd build
|
2021-03-12 04:21:39 +00:00
|
|
|
ninja check -j$(nproc)
|
2016-06-29 20:05:26 +00:00
|
|
|
|
|
|
|
To run an individual test manually, run `ctest` with -R (regex matching):
|
|
|
|
|
|
|
|
ctest -R [regex matching test name(s)]
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-29 20:05:26 +00:00
|
|
|
(Note: `ctest` does not build the test it's running or the dependencies needed
|
|
|
|
to run it)
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-22 18:13:28 +00:00
|
|
|
To run an individual test manually and see all the tests output, run
|
2016-06-29 20:05:26 +00:00
|
|
|
`ctest` with the -V (verbose) flag:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-29 20:05:26 +00:00
|
|
|
ctest -V -R [regex matching test name(s)]
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2021-06-22 05:48:09 +00:00
|
|
|
To run tests manually and run the jobs in parallel, run `ctest` with
|
2017-07-27 03:54:15 +00:00
|
|
|
the `-j` flag:
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-27 18:03:11 +00:00
|
|
|
ctest -j [number of jobs]
|
2016-06-20 19:15:09 +00:00
|
|
|
|
2016-06-29 20:05:26 +00:00
|
|
|
There are many other flags you can give `ctest` for better control
|
2016-06-20 19:15:09 +00:00
|
|
|
over manual test execution. To view these options run:
|
2016-06-15 20:54:53 +00:00
|
|
|
|
2016-06-27 18:03:11 +00:00
|
|
|
man ctest
|
2016-06-16 17:55:11 +00:00
|
|
|
|
2016-06-22 18:13:28 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
## Building the Documentation
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
### Prerequisites
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2014-08-06 15:16:21 +00:00
|
|
|
The list of package dependencies for building the documentation can be
|
2017-07-27 03:54:15 +00:00
|
|
|
found in `doc_deps.deb.txt`:
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2014-05-21 04:56:05 +00:00
|
|
|
sudo apt-get install `cat doc_deps.deb.txt`
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2017-04-17 15:49:32 +00:00
|
|
|
### Building the Documentation
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2014-08-06 15:16:21 +00:00
|
|
|
To build the documentation, ensure that you are in the top-level
|
2017-07-27 03:54:15 +00:00
|
|
|
`/ceph` directory, and execute the build script. For example:
|
2012-03-14 18:58:27 +00:00
|
|
|
|
2014-05-21 04:56:05 +00:00
|
|
|
admin/build-doc
|
2013-11-26 15:14:22 +00:00
|
|
|
|
2022-01-05 16:04:40 +00:00
|
|
|
## Reporting Issues
|
|
|
|
|
|
|
|
To report an issue and view existing issues, please visit https://tracker.ceph.com/projects/ceph.
|