Deploy NebulaGraph with Docker Compose¶
Using Docker Compose can quickly deploy NebulaGraph services based on the prepared configuration file. It is only recommended to use this method when testing functions of NebulaGraph.
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 NebulaGraph 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 NebulaGraph 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 NebulaGraph¶
-
Clone the
3.1.0
branch of thenebula-docker-compose
repository to your host with Git.Danger
The
master
branch contains the untested code for the latest NebulaGraph development release. DO NOT use this release in a production environment.$ git clone -b release-3.1 https://github.com/vesoft-inc/nebula-docker-compose.git
Note
The
x.y
version of Docker Compose aligns to thex.y
version of NebulaGraph. For the NebulaGraphz
version, Docker Compose does not publish the correspondingz
version, but pulls thez
version of the NebulaGraph image. -
Go to the
nebula-docker-compose
directory.$ cd nebula-docker-compose/
-
Run the following command to start all the NebulaGraph services.
Starting with 3.0.2, NebulaGraph comes with ARM64 Linux Docker images. You can run containerized NebulaGraph databases on Docker Desktop for ARM macOS or on ARM Linux servers.
Note
Update the NebulaGraph 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 NebulaGraph architecture.
-
Connect to NebulaGraph.
Note
Starting from NebulaGraph version 3.1.0, nebula-docker-compose automatically starts a Nebula Console docker container and adds the storage host to the cluster (i.e.
ADD HOSTS
command).-
Run the following command to view the name of Nebula Console docker container.
$ docker-compose ps Name Command State Ports ---------------------------------------------------------------------------------------------- nebuladockercompose_console_1 sh -c sleep 3 && Up nebula-co ... ......
-
Run the following command to enter the Nebula Console docker container.
bash docker exec -it nebuladockercompose_console_1 /bin/sh / #
-
Connect to NebulaGraph with Nebula Console.
/ # ./usr/local/bin/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 following commands to view the cluster state.
nebula> SHOW HOSTS; +-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+ | Host | Port | HTTP port | Status | Leader count | Leader distribution | Partition distribution | Version | +-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+ | "storaged0" | 9779 | 19669 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.1.0" | | "storaged1" | 9779 | 19669 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.1.0" | | "storaged2" | 9779 | 19669 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.1.0" | +-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
-
-
Run
exit
twice to switch back to your terminal (shell).
Check the NebulaGraph service status and ports¶
Run docker-compose ps
to list all the services of NebulaGraph and their status and ports.
$ docker-compose ps
nebuladockercompose_console_1 sh -c sleep 3 && Up
nebula-co ...
nebuladockercompose_graphd1_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49174->19669/tcp,:::49174->19669/tcp, 0.0.0.0:49171->19670/tcp,:::49171->19670/tcp, 0.0.0.0:49177->9669/tcp,:::49177->9669/tcp
nebuladockercompose_graphd2_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49175->19669/tcp,:::49175->19669/tcp, 0.0.0.0:49172->19670/tcp,:::49172->19670/tcp, 0.0.0.0:49178->9669/tcp,:::49178->9669/tcp
nebuladockercompose_graphd_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49180->19669/tcp,:::49180->19669/tcp, 0.0.0.0:49179->19670/tcp,:::49179->19670/tcp, 0.0.0.0:9669->9669/tcp,:::9669->9669/tcp
nebuladockercompose_metad0_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49157->19559/tcp,:::49157->19559/tcp, 0.0.0.0:49154->19560/tcp,:::49154->19560/tcp, 0.0.0.0:49160->9559/tcp,:::49160->9559/tcp, 9560/tcp
nebuladockercompose_metad1_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49156->19559/tcp,:::49156->19559/tcp, 0.0.0.0:49153->19560/tcp,:::49153->19560/tcp, 0.0.0.0:49159->9559/tcp,:::49159->9559/tcp, 9560/tcp
nebuladockercompose_metad2_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49158->19559/tcp,:::49158->19559/tcp, 0.0.0.0:49155->19560/tcp,:::49155->19560/tcp, 0.0.0.0:49161->9559/tcp,:::49161->9559/tcp, 9560/tcp
nebuladockercompose_storaged0_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49166->19779/tcp,:::49166->19779/tcp, 0.0.0.0:49163->19780/tcp,:::49163->19780/tcp, 9777/tcp, 9778/tcp, 0.0.0.0:49169->9779/tcp,:::49169->9779/tcp, 9780/tcp
nebuladockercompose_storaged1_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49165->19779/tcp,:::49165->19779/tcp, 0.0.0.0:49162->19780/tcp,:::49162->19780/tcp, 9777/tcp, 9778/tcp, 0.0.0.0:49168->9779/tcp,:::49168->9779/tcp, 9780/tcp
nebuladockercompose_storaged2_1 /usr/local/nebula/bin/nebu ... Up 0.0.0.0:49167->19779/tcp,:::49167->19779/tcp, 0.0.0.0:49164->19780/tcp,:::49164->19780/tcp, 9777/tcp, 9778/tcp, 0.0.0.0:49170->9779/tcp,:::49170->9779/tcp, 9780/tcp
NebulaGraph 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 NebulaGraph services.
Check the service data and logs¶
All the data and logs of NebulaGraph 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 NebulaGraph services¶
You can run the following command to stop the NebulaGraph services:
$ docker-compose down
The following information indicates you have successfully stopped the NebulaGraph services:
Stopping nebuladockercompose_console_1 ... done
Stopping nebuladockercompose_graphd1_1 ... done
Stopping nebuladockercompose_graphd_1 ... done
Stopping nebuladockercompose_graphd2_1 ... done
Stopping nebuladockercompose_storaged1_1 ... done
Stopping nebuladockercompose_storaged0_1 ... done
Stopping nebuladockercompose_storaged2_1 ... done
Stopping nebuladockercompose_metad2_1 ... done
Stopping nebuladockercompose_metad0_1 ... done
Stopping nebuladockercompose_metad1_1 ... done
Removing nebuladockercompose_console_1 ... done
Removing nebuladockercompose_graphd1_1 ... done
Removing nebuladockercompose_graphd_1 ... done
Removing nebuladockercompose_graphd2_1 ... done
Removing nebuladockercompose_storaged1_1 ... done
Removing nebuladockercompose_storaged0_1 ... done
Removing nebuladockercompose_storaged2_1 ... done
Removing nebuladockercompose_metad2_1 ... done
Removing nebuladockercompose_metad0_1 ... done
Removing nebuladockercompose_metad1_1 ... done
Removing network nebuladockercompose_nebula-net
Danger
The parameter -v
in the command docker-compose down -v
will delete all your local NebulaGraph storage data. Try this command if you are using the nightly release and having some compatibility issues.
Modify configurations¶
The configuration file of NebulaGraph 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:release-3.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 NebulaGraph 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, Meta Service, and Nebula Console. -
Run
docker-compose up -d
to start the NebulaGraph services again. -
After connecting to NebulaGraph 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¶
The command docker-compose pull
updates both the NebulaGraph services and the Nebula Console.
Related documents¶
- Install and deploy NebulaGraph with the source code
- Install NebulaGraph by RPM or DEB
- Connect to NebulaGraph