In this document, we will walk you through the process of deploying a Nebula Graph cluster with Docker and Docker Compose. We will also show you how to check the services status of Nebula Graph, how to check the cluster data and logs, and how to stop the services of Nebula Graph.
Before you start deploying the Nebula Graph cluster, ensure that you have installed the latest version of Docker and Docker Compose.
Note: If you do not have the root
privilege for Docker, you can refer to how to set root privileges for Docker.
In this guide, we are going to deploy the following services of Nebula Graph:
- 3 replicas of
nebula-metad
service - 3 replicas of
nebula-storage
d service - 1 replica of
nebula-graphd
service
You can deploy the Nebula Graph cluster by the following steps:
- Clone the
nebula-docker-compose
repository to your local computer.
$ git clone https://github.com/vesoft-inc/nebula-docker-compose.git
- Change your current directory to the
nebula-docker-compose
directory.
$ cd nebula-docker-compose/
- Start all the services of Nebula Graph.
$ docker-compose up -d
The following information which indicates the services are started is displayed:
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
- Pull the
vesoft/nebula-console:nightly
image to your local computer.
$ docker pull vesoft/nebula-console:nightly
Note:
a. We will use the nebula-console
docker container to connect to the graph service of Nebula Graph.
b. If you have pulled the vesoft/nebula-console
image before, remove it with the following command before you pull it again:
docker rm $(docker ps -qa -f status=exited) # cleanup exited containers
docker rmi vesoft/nebula-console:nightly
c. If you have pulled the Nebula Graph images before, you can update the images with the following command:
$ docker-compose pull
- Connect to the graph service of Nebula Graph.
$ docker run --rm -ti --network=host vesoft/nebula-console:nightly --addr=127.0.0.1 --port=3699
If the authorization is not enabled, Nebula Graph will use the default user name and password to log in, so you can skip the user and password specification here. If the authorization is enabled, the user and password must be specified. For example:
Set the enable_authorize
parameter in the /usr/local/nebula/etc/nebula-graphd.conf
file to true
to enable the authorization. In this case, you must provide the user and password to connect.
$ docker run --rm -ti --network=host vesoft/nebula-console:nightly -u <user> -p <password> --addr=127.0.0.1 --port=3699
The following information which indicates that you successfully connect to Nebula Graph is displayed:
Welcome to Nebula Graph (Version 5d10861)
(user@127.0.0.1) [(none)]>
Note: Now, you can start using Nebula Graph by creating spaces, tags and more. For details, refer to get started.
You can list all services of Nebula Graph and check their exposed ports with inputting the following command in your terminal:
$ docker-compose ps
The following information is displayed:
Name Command State Ports
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
nebula-docker-compose_graphd_1 ./bin/nebula-graphd --flag ... Up (health: starting) 0.0.0.0:32867->13000/tcp, 0.0.0.0:32866->13002/tcp, 3369/tcp, 0.0.0.0:3699->3699/tcp
nebula-docker-compose_metad0_1 ./bin/nebula-metad --flagf ... Up (health: starting) 0.0.0.0:32865->11000/tcp, 0.0.0.0:32864->11002/tcp, 45500/tcp, 45501/tcp
nebula-docker-compose_metad1_1 ./bin/nebula-metad --flagf ... Up (health: starting) 0.0.0.0:32863->11000/tcp, 0.0.0.0:32862->11002/tcp, 45500/tcp, 45501/tcp
nebula-docker-compose_metad2_1 ./bin/nebula-metad --flagf ... Up (health: starting) 0.0.0.0:32861->11000/tcp, 0.0.0.0:32860->11002/tcp, 45500/tcp, 45501/tcp
nebula-docker-compose_storaged0_1 ./bin/nebula-storaged --fl ... Up (health: starting) 0.0.0.0:32879->12000/tcp, 0.0.0.0:32877->12002/tcp, 44500/tcp, 44501/tcp
nebula-docker-compose_storaged1_1 ./bin/nebula-storaged --fl ... Up (health: starting) 0.0.0.0:32876->12000/tcp, 0.0.0.0:32872->12002/tcp, 44500/tcp, 44501/tcp
nebula-docker-compose_storaged2_1 ./bin/nebula-storaged --fl ... Up (health: starting) 0.0.0.0:32873->12000/tcp, 0.0.0.0:32870->12002/tcp, 44500/tcp, 44501/tcp
Note: We can see that the exposed port mapped to 3699 of the nebula-docker-compose_graphd_1
container is 3699.
All services data and logs of Nebula Graph are stored in the nebula-docker-compose/data
and nebula-docker-compose/logs
directories respectively.
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
`- graph
You can stop the services of Nebula Graph with the following command:
$ docker-compose down -v
The following information which indicates you successfully stop the services of Nebula Graph is displayed:
Stopping nebula-docker-compose_storaged1_1 ... done
Stopping nebula-docker-compose_storaged0_1 ... done
Stopping nebula-docker-compose_graphd_1 ... done
Stopping nebula-docker-compose_storaged2_1 ... done
Stopping nebula-docker-compose_metad0_1 ... done
Stopping nebula-docker-compose_metad1_1 ... done
Stopping nebula-docker-compose_metad2_1 ... done
Removing nebula-docker-compose_storaged1_1 ... done
Removing nebula-docker-compose_storaged0_1 ... done
Removing nebula-docker-compose_graphd_1 ... done
Removing nebula-docker-compose_storaged2_1 ... done
Removing nebula-docker-compose_metad0_1 ... done
Removing nebula-docker-compose_metad1_1 ... done
Removing nebula-docker-compose_metad2_1 ... done
Removing network nebula-docker-compose_nebula-net
Note: As your data is stored in your local computer, your data will be reserved even after you stop the services of Nebula Graph.
-
prometheus
andgrafana
collect cluster metrics -
ansible
deployment tutorial