English | 中文
A distributed, scalable, lightning-fast graph database
The v2.0.0
branch stores the Docker Compose deployment solution for Nebula Graph v2.0.0.
There are multiple ways to deploy Nebula Graph, but using Docker Compose is usually considered to be a fast starter.
If you are reading this topic with the questions listed below, click them to jump to their answers.
- What do I need to do before deploying Nebula Graph?
- How to fast deploy Nebula Graph with Docker Compose?
- How to check the status and ports of the Nebula Graph services?
- How to check the data and logs of the Nebula Graph services?
- How to stop the Nebula Graph services?
- What are the other ways to install Nebula Graph?
-
You have installed the following applications on your host.
Application Recommended version Official installation reference Docker Latest Install Docker Engine Docker Compose Latest Install Docker Compose Git Latest Download Git -
If you are deploying Nebula Graph as a non-root user, grant the user with Docker-related privileges. For a detailed instruction, see Docker document: Manage Docker as a non-root user.
-
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.
-
Clone the
v2.0.0
branch of thenebula-docker-compose
repository to your host with Git.$ git clone --branch v2.0.0 https://github.com/vesoft-inc/nebula-docker-compose.git
-
Go to the
nebula-docker-compose
directory.$ cd nebula-docker-compose/
-
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.
-
Connect to Nebula Graph.
- 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.0.0-ga
Note: Your local network (nebula-docker-compose_nebula-net) may be different from the example above. Use the following command to list the actual local network.
$ 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
- 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.
- Run the
SHOW HOSTS
statement to check the status of thenebula-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 | | | +-------------+------+----------+--------------+----------------------+------------------------+
-
Run
exit
twice to switch back to your terminal (shell). You can run Step 4 to login Nebula Graph again.
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.
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
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.
To update the images of the Graph Service, Storage Service, and Meta Service, run docker-compose pull
in the nebula-docker-compose
directory.
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.
To update the Nebula Console client, run the following command.
docker pull vesoft/nebula-console:v2.0.0-ga
To upgrade Nebula Graph, update the Nebula Graph docker images and restart the services.
- In the
nebula-docker-compose
directory, rundocker-compose pull
to update the Nebula Graph docker images.
-
Run
docker-compose down
to stop the Nebula Graph services. -
Run
docker-compose up -d
to start the Nebula Graph services again.
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.
The data format is incompatible before and after in Jan 27, 2021. Run docker-compose down -v
to delete all your local data.
If deployed with Docker Compose, Nebula Graph stores all data in nebula-docker-compose/data/
.