Deploy Nebula Graph with Docker Compose¶
Using Docker Compose can quickly deploy Nebula Graph services based on the prepared configuration file. It is only recommended to use this method when testing functions of 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 detailed instructions, see 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, you need to delete the
nebula-docker-compose/data
directory.
How to deploy and connect to Nebula Graph¶
-
Clone the
2.6.0
branch of thenebula-docker-compose
repository to your host with Git.Danger
The
master
branch contains the untested code for the latest Nebula Graph development release. DO NOT use this release in a production environment.$ git clone -b v2.6.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 (nebula-docker-compose_nebula-net).
$ docker run --rm -ti --network nebula-docker-compose_nebula-net --entrypoint=/bin/sh vesoft/nebula-console:v2.6.0
Note
The local network may be different from the
nebula-docker-compose_nebula-net
in the above example. Use the following command.$ 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_name> -p <password> --address=graphd --port=9669
Note
By default, the authentication is off, you can only log in with an existing username (the default is
root
) and any 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 log in to Nebula Graph again.
Check the Nebula Graph service status and ports¶
Run docker-compose ps
to list all the services of Nebula Graph and their status and ports.
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
nebula-docker-compose_graphd1_1 ./bin/nebula-graphd --flag ... Up (health: starting) 13000/tcp, 13002/tcp, 0.0.0.0:33295->19669/tcp, 0.0.0.0:33291->19670/tcp,
3699/tcp, 0.0.0.0:33298->9669/tcp
nebula-docker-compose_graphd2_1 ./bin/nebula-graphd --flag ... Up (health: starting) 13000/tcp, 13002/tcp, 0.0.0.0:33285->19669/tcp, 0.0.0.0:33284->19670/tcp,
3699/tcp, 0.0.0.0:33286->9669/tcp
nebula-docker-compose_graphd_1 ./bin/nebula-graphd --flag ... Up (health: starting) 13000/tcp, 13002/tcp, 0.0.0.0:33288->19669/tcp, 0.0.0.0:33287->19670/tcp,
3699/tcp, 0.0.0.0:9669->9669/tcp
nebula-docker-compose_metad0_1 ./bin/nebula-metad --flagf ... Up (health: starting) 11000/tcp, 11002/tcp, 0.0.0.0:33276->19559/tcp, 0.0.0.0:33275->19560/tcp,
45500/tcp, 45501/tcp, 0.0.0.0:33278->9559/tcp
nebula-docker-compose_metad1_1 ./bin/nebula-metad --flagf ... Up (health: starting) 11000/tcp, 11002/tcp, 0.0.0.0:33279->19559/tcp, 0.0.0.0:33277->19560/tcp,
45500/tcp, 45501/tcp, 0.0.0.0:33281->9559/tcp
nebula-docker-compose_metad2_1 ./bin/nebula-metad --flagf ... Up (health: starting) 11000/tcp, 11002/tcp, 0.0.0.0:33282->19559/tcp, 0.0.0.0:33280->19560/tcp,
45500/tcp, 45501/tcp, 0.0.0.0:33283->9559/tcp
nebula-docker-compose_storaged0_1 ./bin/nebula-storaged --fl ... Up (health: starting) 12000/tcp, 12002/tcp, 0.0.0.0:33290->19779/tcp, 0.0.0.0:33289->19780/tcp,
44500/tcp, 44501/tcp, 0.0.0.0:33294->9779/tcp
nebula-docker-compose_storaged1_1 ./bin/nebula-storaged --fl ... Up (health: starting) 12000/tcp, 12002/tcp, 0.0.0.0:33296->19779/tcp, 0.0.0.0:33292->19780/tcp,
44500/tcp, 44501/tcp, 0.0.0.0:33299->9779/tcp
nebula-docker-compose_storaged2_1 ./bin/nebula-storaged --fl ... Up (health: starting) 12000/tcp, 12002/tcp, 0.0.0.0:33297->19779/tcp, 0.0.0.0:33293->19780/tcp,
44500/tcp, 44501/tcp, 0.0.0.0:33300->9779/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_graphd2_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_storaged2_1 ... done
Stopping nebula-docker-compose_storaged0_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_graphd2_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_storaged2_1 ... done
Removing nebula-docker-compose_storaged0_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
Danger
The parameter -v
in the command docker-compose down -v
will delete all your local Nebula Graph storage data. Try this command if you are using the nightly release and having some compatibility issues.
Modify configurations¶
The configuration file of Nebula Graph deployed by Docker Compose is nebula-docker-compose/docker-compose.yaml
. To make the new configuration take effect, modify the configuration in this file and restart the service.
For more instructions, see Configurations.
FAQ¶
How to fix the docker mapping to external ports?¶
To set the ports
of corresponding services as fixed mapping, modify the docker-compose.yaml
in the nebula-docker-compose
directory. For example:
graphd:
image: vesoft/nebula-graphd:v2.6.1
...
ports:
- 9669:9669
- 19669
- 19670
9669:9669
indicates the internal port 9669 is uniformly mapped to external ports, while 19669
indicates the internal port 19669 is randomly mapped to external ports.
How to upgrade or update the docker images of Nebula Graph services¶
-
In the
nebula-docker-compose/docker-compose.yaml
file, change all theimage
values to the required image version. -
In the
nebula-docker-compose
directory, rundocker-compose pull
to update the images of the Graph Service, Storage Service, and Meta Service.Note
Note that all the Nebula Graph services are stopped before running the command
docker-compose pull
. -
Run
docker-compose up -d
to start the Nebula Graph services again. -
After connecting to Nebula Graph with Nebula Console, run
SHOW HOSTS GRAPH
,SHOW HOSTS STORAGE
, orSHOW HOSTS META
to check the version of the responding service respectively.
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.6.0
Why can’t I connect to Nebula Graph via port 3699
after updating the nebula-docker-compose repository (Nebula Graph 2.0.0-RC)?¶
In Nebula Graph 2.0.0-RC release, the default port is changed from 3699
to 9669
. Please use port 9669
to connect to Nebula Graph, or modify the port in docker-compose.yaml
.
Why can't I access the data after updating the nebula-docker-compose repository? (Jan 4, 2021)¶
If you have 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 has been modified on Jan 27, 2021, and is incompatible with the previous data. Run docker-compose down -v
to delete all your local data.
Related documents¶
- Install and deploy Nebula Graph with the source code
- Install Nebula Graph by RPM or DEB
- Connect to Nebula Graph