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.
- 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?
Prerequisites¶
-
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/datadirectory.NOTE: To backup the Nebula Graph data, see Use B&R to backup data. TODO: It is not released.
How to deploy¶
-
Clone the
masterbranch of thenebula-docker-composerepository to your host with Git.DON'T: The
masterbranch 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 -
Go to the
nebula-docker-composedirectory.$ 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 ... doneNOTE: For more information of the preceding services, see Nebula Graph architecture.
-
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.
```bash $ 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. ```bash $ 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.
```bash 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](../7.data-security/1.authentication/1.authentication.md).3. Run the
SHOW HOSTSstatement to check the status of thenebula-storagedprocesses.```bash 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
exittwice 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 -vwill 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.
-
In the
nebula-docker-composedirectory, rundocker-compose pullto update the Nebula Graph docker images. -
Run
docker-compose downto stop the Nebula Graph services. -
Run
docker-compose up -dto 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/.