Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steps changes for compiling and installing nebula #850

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,35 @@ Installing Nebula Graph from the source code allows you to customize the compili

## Installation steps

!!! Note

Starting with the Nebula Graph {{ nebula.release }} release, the code repositories for Nebula-Graph, Nebula-Storage, and Nebula-Common have been merged into the Nebula code repository, so the compilation steps are different from those in previous releases.

1. Use Git to clone the source code of Nebula Graph to the host.

- [Recommended] To install Nebula Graph v{{nebula.release}}, run the following command.
- [Recommended] To install Nebula Graph {{nebula.release}}, run the following command.

```bash
$ git clone --branch v{{nebula.release}} https://github.com/vesoft-inc/nebula-graph.git
```
```bash
$ git clone --branch {{nebula.branch}} https://github.com/vesoft-inc/nebula.git
```

- To install the latest developing release, run the following command to clone the source code from the master branch.
- To install the latest developing release, run the following command to clone the source code from the master branch.

```bash
$ git clone https://github.com/vesoft-inc/nebula-graph.git
```
```bash
$ git clone https://github.com/vesoft-inc/nebula.git
```

2. Make the `nebula-graph` directory the current working directory.
2. Make the `nebula` directory the current working directory.

```bash
$ cd nebula-graph
```
```bash
$ cd nebula
```

3. Create a `build` directory and make it the current working directory.

```bash
$ mkdir build && cd build
```
```bash
$ mkdir build && cd build
```

4. Generate Makefile with CMake.

Expand All @@ -44,18 +48,9 @@ Installing Nebula Graph from the source code allows you to customize the compili

For more information about CMake variables, see [CMake variables](#cmake_variables).

- If the source code of Nebula Graph v{{nebula.release}} is installed and cloned in step 1, run the following command. The `-DNEBULA_COMMON_REPO_TAG` and `-DNEBULA_STORAGE_REPO_TAG` options are used to specify the correct branches of [nebula-common](https://github.com/vesoft-inc/nebula-common) and [nebula-storage](https://github.com/ vesoft-inc/nebula-storage) repositories to keep the releases of the Nebula Graph components consistent.

```bash
$ cmake -DENABLE_BUILD_STORAGE=on -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \
-DNEBULA_COMMON_REPO_TAG=v{{ nebula.release }} -DNEBULA_STORAGE_REPO_TAG=v{{ nebula.release }} ..
```

- If the source code of the `master` branch is installed in step 1, run the following command.

```bash
$ cmake -DENABLE_BUILD_STORAGE=on -DENABLE_TESTING=OFF -DENABLE_MODULE_UPDATE=ON -DCMAKE_BUILD_TYPE=Release ..
```
```bash
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..
```

5. Compile Nebula Graph.

Expand All @@ -65,27 +60,25 @@ Installing Nebula Graph from the source code allows you to customize the compili

To speed up the compiling, use the `-j` option to set a concurrent number `N`. It should be $\min(\text{CPU}core number,\frac{the_memory_size(GB)}{2})$.

```bash
$ make -j{N} # E.g., make -j2
```
```bash
$ make -j{N} # E.g., make -j2
```

6. Install Nebula Graph.

```bash
$ sudo make install-all
```
```bash
$ sudo make install
```

7. The configuration files in the `etc/` directory (`/usr/local/nebula/etc` by default) are references. Users can create their own configuration files accordingly. If you want to use the scripts in the `script` directory to start, stop, restart, and kill the service, and check the service status, the configuration files have to be named as `nebula-graph.conf`, `nebula-metad.conf`, and `nebula-storaged.conf`.

## Update the master branch

The source code of the master branch changes frequently. If the corresponding Nebula Graph release is installed, update it in the following steps.

1. In the `nebula-graph/` directory, run `git pull upstream master` to update the source code.
1. In the `nebula` directory, run `git pull upstream master` to update the source code.

2. In the `nebula-graph/modules/common/` and `nebula-graph/modules/storage/` directories, run `git pull upstream master` separately.

3. In the `nebula-graph/build/` directory, run `make -j{N}` and `make install-all` again.
2. In the `nebula/build` directory, run `make -j{N}` and `make install` again.

## Next

Expand All @@ -105,12 +98,6 @@ $ cmake -D<variable>=<value> ...

The following CMake variables can be used at the configure (cmake) stage to adjust the compiling settings.

### ENABLE_BUILD_STORAGE

Starting from {{ nebula.release }}, Nebula Graph uses two separated github repositories of graph and storage for separated compiling. The `ENABLE_BUILD_STORAGE` variable is set to `OFF` by default so that the storage service is not installed together with the graph service.

If you are deploying Nebula Graph on a single host for testing, you can set `ENABLE_BUILD_STORAGE` to `ON` to download and install the storage service automatically.

### CMAKE_INSTALL_PREFIX

`CMAKE_INSTALL_PREFIX` specifies the path where the service modules, scripts, configuration files are installed. The default path is `/usr/local/nebula`.
Expand Down Expand Up @@ -158,7 +145,7 @@ $ cmake -DCMAKE_C_COMPILER=<path_to_clang/bin/clang> -DCMAKE_CXX_COMPILER=<path_

### ENABLE_CCACHE

`ENABLE_CCACHE` is `ON` by default and ccache (compiler cache) is used to speed up the compiling of Nebula Graph.
`ENABLE_CCACHE` is `ON` by default and Ccache (compiler cache) is used to speed up the compiling of Nebula Graph.

To disable `ccache`, setting `ENABLE_CCACHE` to `OFF` is not enough. On some platforms, the `ccache` installation hooks up or precedes the compiler. In such a case, you have to set an environment variable `export CCACHE_DISABLE=true` or add a line `disable=true` in `~/.ccache/ccache.conf` as well. For more information, see the [ccache official documentation](https://ccache.dev/manual/3.7.6.html).

Expand All @@ -175,5 +162,3 @@ If the compiling fails, we suggest you:
2. Check whether the [third-party](../1.resource-preparations/#_5) is installed correctly.

3. Use `make -j1` to reduce the compiling concurrency.

4. Update the code `git pull`, compile again, and add the CMake option `-DENABLE_MODULE_UPDATE=ON` in step 4.