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-metadservice - 3 replicas of
nebula-storaged service - 1 replica of
nebula-graphdservice
You can deploy the Nebula Graph cluster by the following steps:
- Clone the
nebula-docker-composerepository to your local computer.
$ git clone https://github.com/vesoft-inc/nebula-docker-compose.git- Change your current directory to the
nebula-docker-composedirectory.
$ cd nebula-docker-compose/- Start all the services of Nebula Graph.
$ docker-compose up -dThe 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:nightlyimage to your local computer.
$ docker pull vesoft/nebula-console:nightlyNote:
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 containersdocker 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=3699If 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=3699The following information which indicates that you successfully connect to Nebula Graph is displayed:
Welcome to Nebula Graph (Version 5d10861)
([email protected]) [(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 psThe 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/tcpNote: 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 -vThe 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-netNote: As your data is stored in your local computer, your data will be reserved even after you stop the services of Nebula Graph.
-
prometheusandgrafanacollect cluster metrics -
ansibledeployment tutorial