Skip to content

Deploy Nebula Graph with Docker Compose

There are multiple ways to deploy Nebula Graph, but using Docker Compose is usually considered to be a fast starter.

Reading guide

If you are reading this topic with the questions listed below, click them to jump to their answers.

Prerequisites

  • You have started the Docker service on your host.
  • If you have already deployed another version of Nebula Graph with Docker Compose on your host, to avoid compatibility issues, back up the service data if you need, and delete the nebula-docker-compose/data directory.

    Note

    To backup the Nebula Graph data, see Use B&R to backup data. TODO: It is not released.

How to deploy

  1. Clone the master branch of the nebula-docker-compose repository to your host with Git.

    Danger

    The master branch contains the Docker Compose solution for the latest Nebula Graph development release. DON'T use this release for production.

    $ git clone https://github.com/vesoft-inc/nebula-docker-compose.git
    
  2. Go to the nebula-docker-compose directory.

    $ cd nebula-docker-compose/
    
  3. Run the following command to start all the Nebula Graph services.

    Note

    Update the Nebula Graph images and Nebula Console images first if they are out of date.

    nebula-docker-compose]$ docker-compose up -d
    Creating nebula-docker-compose_metad0_1 ... done
    Creating nebula-docker-compose_metad2_1 ... done
    Creating nebula-docker-compose_metad1_1 ... done
    Creating nebula-docker-compose_graphd2_1   ... done
    Creating nebula-docker-compose_graphd_1    ... done
    Creating nebula-docker-compose_graphd1_1   ... done
    Creating nebula-docker-compose_storaged0_1 ... done
    Creating nebula-docker-compose_storaged2_1 ... done
    Creating nebula-docker-compose_storaged1_1 ... done
    

    Note

    For more information of the preceding services, see Nebula Graph architecture.

  4. Connect to Nebula Graph.

    1. Run the following command to start a new docker container with the Nebula Console image, and connect the container to the network where Nebula Graph is deployed.

      $ docker run --rm -ti --network nebula-docker-compose_nebula-net \
      --entrypoint=/bin/sh vesoft/nebula-console:v2-nightly
      

      Note

      Your local network (nebula-docker-compose_nebula-net) may be different from the example above. Use the following command.

      $ docker network  ls
      NETWORK ID          NAME                               DRIVER              SCOPE
      a74c312b1d16        bridge                             bridge              local
      dbfa82505f0e        host                               host                local
      ed55ccf356ae        nebula-docker-compose_nebula-net   bridge              local
      93ba48b4b288        none                               null                local
      
    2. Connect to Nebula Graph with Nebula Console.

      docker> nebula-console -u user -p password --address=graphd --port=9669
      

      Note

      By default, the authentication is off, you can log in with any user name and password. To turn it on, see Enable authentication.

    3. Run the SHOW HOSTS statement to check the status of the nebula-storaged processes.

      nebula> SHOW HOSTS;
      +-------------+------+----------+--------------+----------------------+------------------------+
      | Host        | Port | Status   | Leader count | Leader distribution  | Partition distribution |
      +-------------+------+----------+--------------+----------------------+------------------------+
      | "storaged0" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   |
      +-------------+------+----------+--------------+----------------------+------------------------+
      | "storaged1" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   |
      +-------------+------+----------+--------------+----------------------+------------------------+
      | "storaged2" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   |
      +-------------+------+----------+--------------+----------------------+------------------------+
      | "Total"     |      |          | 0            |                      |                        |
      +-------------+------+----------+--------------+----------------------+------------------------+
      
  5. Run exit twice to switch back to your terminal (shell). You can run Step 4 to login Nebula Graph again.

Check the Nebula Graph service status and port

Run docker-compose ps to list all the services of Nebula Graph and their status and ports.

$ docker-compose ps
nebula-docker-compose_graphd1_1     /usr/local/nebula/bin/nebu ...   Up (healthy)   0.0.0.0:33170->19669/tcp, 0.0.0.0:33169->19670/tcp, 0.0.0.0:33173->9669/tcp
nebula-docker-compose_graphd2_1     /usr/local/nebula/bin/nebu ...   Up (healthy)   0.0.0.0:33174->19669/tcp, 0.0.0.0:33171->19670/tcp, 0.0.0.0:33176->9669/tcp
nebula-docker-compose_graphd_1      /usr/local/nebula/bin/nebu ...   Up (healthy)   0.0.0.0:33205->19669/tcp, 0.0.0.0:33204->19670/tcp, 0.0.0.0:9669->9669/tcp
nebula-docker-compose_metad0_1      ./bin/nebula-metad --flagf ...   Up (healthy)   0.0.0.0:33165->19559/tcp, 0.0.0.0:33162->19560/tcp, 0.0.0.0:33167->9559/tcp,
                                                                                    9560/tcp
nebula-docker-compose_metad1_1      ./bin/nebula-metad --flagf ...   Up (healthy)   0.0.0.0:33166->19559/tcp, 0.0.0.0:33163->19560/tcp, 0.0.0.0:33168->9559/tcp,
                                                                                    9560/tcp
nebula-docker-compose_metad2_1      ./bin/nebula-metad --flagf ...   Up (healthy)   0.0.0.0:33161->19559/tcp, 0.0.0.0:33160->19560/tcp, 0.0.0.0:33164->9559/tcp,
                                                                                    9560/tcp
nebula-docker-compose_storaged0_1   ./bin/nebula-storaged --fl ...   Up (healthy)   0.0.0.0:33180->19779/tcp, 0.0.0.0:33178->19780/tcp, 9777/tcp, 9778/tcp,
                                                                                    0.0.0.0:33183->9779/tcp, 9780/tcp
nebula-docker-compose_storaged1_1   ./bin/nebula-storaged --fl ...   Up (healthy)   0.0.0.0:33175->19779/tcp, 0.0.0.0:33172->19780/tcp, 9777/tcp, 9778/tcp,
                                                                                    0.0.0.0:33177->9779/tcp, 9780/tcp
nebula-docker-compose_storaged2_1   ./bin/nebula-storaged --fl ...   Up (healthy)   0.0.0.0:33184->19779/tcp, 0.0.0.0:33181->19780/tcp, 9777/tcp, 9778/tcp,
                                                                                    0.0.0.0:33185->9779/tcp, 9780/tcp

Nebula Graph provides services to the clients through port 9669 by default. To use other ports, modify the docker-compose.yaml file in the nebula-docker-compose directory and restart the Nebula Graph services.

Check the service data and logs

All the data and logs of Nebula Graph are stored persistently in the nebula-docker-compose/data and nebula-docker-compose/logs directories.

The structure of the directories is as follows:

nebula-docker-compose/
  |-- docker-compose.yaml
  ├── data
  │   ├── meta0
  │   ├── meta1
  │   ├── meta2
  │   ├── storage0
  │   ├── storage1
  │   └── storage2
  └── logs
      ├── graph
      ├── graph1
      ├── graph2
      ├── meta0
      ├── meta1
      ├── meta2
      ├── storage0
      ├── storage1
      └── storage2

Stop the Nebula Graph services

You can run the following command to stop the Nebula Graph services:

$ docker-compose down

The following information indicates you have successfully stopped the Nebula Graph services:

Stopping nebula-docker-compose_storaged0_1 ... done
Stopping nebula-docker-compose_graphd1_1   ... done
Stopping nebula-docker-compose_graphd_1    ... done
Stopping nebula-docker-compose_storaged1_1 ... done
Stopping nebula-docker-compose_graphd2_1   ... done
Stopping nebula-docker-compose_storaged2_1 ... done
Stopping nebula-docker-compose_metad0_1    ... done
Stopping nebula-docker-compose_metad2_1    ... done
Stopping nebula-docker-compose_metad1_1    ... done
Removing nebula-docker-compose_storaged0_1 ... done
Removing nebula-docker-compose_graphd1_1   ... done
Removing nebula-docker-compose_graphd_1    ... done
Removing nebula-docker-compose_storaged1_1 ... done
Removing nebula-docker-compose_graphd2_1   ... done
Removing nebula-docker-compose_storaged2_1 ... done
Removing nebula-docker-compose_metad0_1    ... done
Removing nebula-docker-compose_metad2_1    ... done
Removing nebula-docker-compose_metad1_1    ... done
Removing network nebula-docker-compose_nebula-net

Note

Command docker-compose down -v will delete all your local Nebula Graph storage data. Try this command if you're using a developing/nightly version and having some compatibility issues.

Other ways to install Nebula Graph

FAQ

How to update the docker images of Nebula Graph services

To update the images of the Graph Service, Storage Service, and Meta Service, run docker-compose pull in the nebula-docker-compose directory.

ERROR: toomanyrequests when docker-compose pull

You may meet the following error.

ERROR: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit.

You have met the rate limit of Docker Hub. Learn more on Understanding Docker Hub Rate Limiting.

How to update the Nebula Console client

To update the Nebula Console client, run the following command.

docker pull vesoft/nebula-console:v2-nightly

How to upgrade Nebula Graph services

To upgrade Nebula Graph, update the Nebula Graph docker images and restart the services.

  1. In the nebula-docker-compose directory, run docker-compose pull to update the Nebula Graph docker images.

    Caution

    Make sure that you have backed up all important data before following the next step to stop the Nebula Graph services.

  2. Run docker-compose down to stop the Nebula Graph services.

  3. Run docker-compose up -d to start the Nebula Graph services again.

Why can't I connect to Nebula Graph through port 3699 after updating the nebula-docker-compose repository? (Nebula Graph 2.0.0-RC)

On the release of Nebula Graph 2.0.0-RC, the default port for connection changed from 3699 to 9669. To connect to Nebula Graph after updating the repository, use port 9669 or modify the port number in the docker-compose.yaml file.

Why can't I access the data after updating the nebula-docker-compose repository? (Jan 4, 2021)

If you updated the nebula-docker-compose repository after Jan 4, 2021 and there are pre-existing data, modify the docker-compose.yaml file and change the port numbers to the previous ones before connecting to Nebula Graph.

Why can't I access the data after updating the nebula-docker-compose repository? (Jan 27, 2021)

The data format is incompatible before and after in Jan 27, 2021. Run docker-compose down -v to delete all your local data.

Where are the data stored when Nebula Graph is deployed with Docker Compose

If deployed with Docker Compose, Nebula Graph stores all data in nebula-docker-compose/data/.


Last update: April 22, 2021
Back to top