/nebula-docker-compose

Docker compose for Nebula Graph

Primary LanguageShellApache License 2.0Apache-2.0


English | 中文
A distributed, scalable, lightning-fast graph database

build docker image workflow nebula star nebula fork

Deploy Nebula Graph with Docker Compose

Using Docker Compose is a convenient way to deploy and manage Nebula Graph.

Prerequisites

  • You have installed Docker, Docker Compose, and Git on your host.

    NOTE:

    • To use Docker as a non-root user, follow the steps in Manage Docker as a non-root user.
    • We recommend that you install the latest version of these applications to make sure they work properly.
  • 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.

How to deploy

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

    • To install Nebula Graph 1.0, clone the master branch.
    $ git clone https://github.com/vesoft-inc/nebula-docker-compose.git
    • To install Nebula Graph 2.0-pre, clone the v2-preview branch.
    $ git clone --branch v2-preview 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.

    $ docker-compose up -d

    The following information indicates the services have started:

    Creating nebula-docker-compose_metad2_1 ... done
    Creating nebula-docker-compose_metad1_1 ... done
    Creating nebula-docker-compose_metad0_1 ... done
    Creating nebula-docker-compose_storaged2_1 ... done
    Creating nebula-docker-compose_graphd_1    ... done
    Creating nebula-docker-compose_storaged0_1 ... done
    Creating nebula-docker-compose_storaged1_1 ... done

    NOTE: For more information of the preceding services, see Design and Architecture of Nebula Graph.

  4. Use nebula-console to connect to Nebula Graph.

    Nebula-console is the native CLI client of Nebula Graph. In this step, Docker pulls the nebula-console images automatically from Docker Hub according to the path we set in the following commands and uses it to connect to the graphd service of Nebula Graph. You can use other clients to connect to Nebula Graph instead of Nebula-console, such as Nebula Graph Studio and clients for different programming languages.

    • For Nebula Graph 1.0:
    $ docker run --rm -ti --network=host vesoft/nebula-console:nightly -u <user> -p <password> --addr=127.0.0.1 --port=3699
    • For Nebula Graph 2.0 pre:
    $ docker run --rm -ti --network nebula-docker-compose_nebula-net vesoft/nebula-console:v2-preview-nightly -u <user> -p <password> --address=172.18.0.1 --port=32782

    NOTE: By default, the authentication is disabled, and the -u and -p options are unnecessary. To enbale authentication, see Authentication Configurations.

    The following information indicates that you have connected to the Nebula Graph services:

    Welcome to Nebula Graph (Version 5d10861)
    
    (user@127.0.0.1) [(none)]>

Check the Nebula Graph service status and ports

Running the following command to list the service information of Nebula Graph, such as state and ports.

$ docker-compose ps

The following information is displayed:

Name                     Command                       State                                                   Ports
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
nebula-docker-compose_graphd0_1     ./bin/nebula-graphd --flag ...   Up (health: starting)   0.0.0.0:33453->13000/tcp, 0.0.0.0:33449->13002/tcp, 0.0.0.0:3699->3699/tcp
nebula-docker-compose_graphd1_1     ./bin/nebula-graphd --flag ...   Up (health: starting)   0.0.0.0:33455->13000/tcp, 0.0.0.0:33450->13002/tcp, 0.0.0.0:3700->3699/tcp
nebula-docker-compose_graphd2_1     ./bin/nebula-graphd --flag ...   Up (health: starting)   0.0.0.0:33448->13000/tcp, 0.0.0.0:33447->13002/tcp, 0.0.0.0:3701->3699/tcp
nebula-docker-compose_metad0_1      ./bin/nebula-metad --flagf ...   Up (health: starting)   0.0.0.0:33446->11000/tcp, 0.0.0.0:33444->11002/tcp, 0.0.0.0:45500->45500/tcp, 45501/tcp
nebula-docker-compose_metad1_1      ./bin/nebula-metad --flagf ...   Up (health: starting)   0.0.0.0:33442->11000/tcp, 0.0.0.0:33441->11002/tcp, 0.0.0.0:45501->45500/tcp, 45501/tcp
nebula-docker-compose_metad2_1      ./bin/nebula-metad --flagf ...   Up (health: starting)   0.0.0.0:33445->11000/tcp, 0.0.0.0:33443->11002/tcp, 0.0.0.0:45502->45500/tcp, 45501/tcp
nebula-docker-compose_storaged0_1   ./bin/nebula-storaged --fl ...   Up (health: starting)   0.0.0.0:33457->12000/tcp, 0.0.0.0:33452->12002/tcp, 0.0.0.0:44500->44500/tcp, 44501/tcp
nebula-docker-compose_storaged1_1   ./bin/nebula-storaged --fl ...   Up (health: starting)   0.0.0.0:33456->12000/tcp, 0.0.0.0:33451->12002/tcp, 0.0.0.0:44501->44500/tcp, 44501/tcp
nebula-docker-compose_storaged2_1   ./bin/nebula-storaged --fl ...   Up (health: starting)   0.0.0.0:33458->12000/tcp, 0.0.0.0:33454->12002/tcp, 0.0.0.0:44502->44500/tcp, 44501/tcp

NOTE: Nebula Graph provides services to the clients through port TCP3699 by default. You can adjust the port number by modifying the network configurations.

Check the service data and logs

All 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
        |- meta0
        |- meta1
        |- meta2
        |- storage0
        |- storage1
        |- storage2
        |- graph0
        |- graph1
        `- graph2

Stop the Nebula Graph Services

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

$ docker-compose down -v

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_storaged2_1 ... done
Stopping nebula-docker-compose_graphd0_1   ... done
Stopping nebula-docker-compose_storaged1_1 ... done
Stopping nebula-docker-compose_graphd2_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_storaged2_1 ... done
Removing nebula-docker-compose_graphd0_1   ... done
Removing nebula-docker-compose_storaged1_1 ... done
Removing nebula-docker-compose_graphd2_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

Other Ways to Install Nebula Graph

FAQ

Q: How to update the nebula-console client?

A: To update the nebula-console client, use the docker pull command in the nebula-docker-compose directory on your host. For example, if you want to update nebula-console for the Nebula Graph 1.0 series, run the follow command.

docker pull vesoft/nebula-console:nightly

If you want to update nebula-console for the Nebula Graph 2.0 pre-release, run the following command instead.

docker pull vesoft/nebula-console:v2-preview-nightly

What to Do Next

You can start using Nebula Graph by creating spaces and inserting data. For more information, see Quick Start.