Skip to content

Commit

Permalink
remove docker from local deployment (#1768)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper-lzy authored Nov 22, 2022
1 parent da4bfb8 commit db0d2ab
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 153 deletions.
4 changes: 4 additions & 0 deletions docs-2.0/2.quick-start/4.nebula-graph-crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ In this topic, we will use the following dataset to demonstrate basic CRUD opera
nebula> CREATE SPACE basketballplayer(partition_num=15, replica_factor=1, vid_type=fixed_string(30));
```
!!! note
If the system returns the error `[ERROR (-1005)]: Host not enough!`, check whether [registered the Storage Service](../2.quick-start/3.1add-storage-hosts.md).
2. Check the partition distribution with `SHOW HOSTS` to make sure that the partitions are distributed in a balanced way.
```ngql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Using Docker Compose can quickly deploy NebulaGraph services based on the prepar

* 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
## Deploy NebulaGraph

1. Clone the `{{dockercompose.release}}` branch of the `nebula-docker-compose` repository to your host with Git.

Expand Down Expand Up @@ -50,74 +50,84 @@ Using Docker Compose can quickly deploy NebulaGraph services based on the prepar

```bash
[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
Creating nebuladockercompose_metad0_1 ... done
Creating nebuladockercompose_metad2_1 ... done
Creating nebuladockercompose_metad1_1 ... done
Creating nebuladockercompose_graphd2_1 ... done
Creating nebuladockercompose_graphd_1 ... done
Creating nebuladockercompose_graphd1_1 ... done
Creating nebuladockercompose_storaged0_1 ... done
Creating nebuladockercompose_storaged2_1 ... done
Creating nebuladockercompose_storaged1_1 ... done
```

!!! Note
!!! compatibility

Starting from NebulaGraph version 3.1.0, nebula-docker-compose automatically starts a NebulaGraph Console docker container and adds the storage host to the cluster (i.e. `ADD HOSTS` command).

!!! note

For more information of the preceding services, see [NebulaGraph architecture](../../1.introduction/3.nebula-graph-architecture/1.architecture-overview.md).

4. Connect to NebulaGraph.
## Connect to NebulaGraph

!!! Note
Starting from NebulaGraph version 3.1.0, nebula-docker-compose automatically starts a NebulaGraph Console docker container and adds the storage host to the cluster (i.e. `ADD HOSTS` command).
There are two ways to connect to NebulaGraph:

- Connected with Nebula Console outside the container. Because the external mapping port for the Graph service is also fixed as `9669` in the container's configuration file, you can connect directly through the default port. For details, see [Connect to NebulaGraph](../../2.quick-start/3.connect-to-nebula-graph.md).
1. Run the following command to view the name of NebulaGraph Console docker container.
- Log into the container installed NebulaGraph Console, then connect to the Graph service. This section describes this approach.
```bash
$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------
nebuladockercompose_console_1 sh -c sleep 3 && Up
nebula-co ...
......
```
1. Run the following command to view the name of NebulaGraph Console docker container.
2. Run the following command to enter the NebulaGraph Console docker container.
```bash
$ docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------------
nebuladockercompose_console_1 sh -c sleep 3 && Up
nebula-co ...
......
```
```bash
docker exec -it nebuladockercompose_console_1 /bin/sh
/ #
```
2. Run the following command to enter the NebulaGraph Console docker container.
3. Connect to NebulaGraph with NebulaGraph Console.
```bash
docker exec -it nebuladockercompose_console_1 /bin/sh
/ #
```
```bash
/ # ./usr/local/bin/nebula-console -u <user_name> -p <password> --address=graphd --port=9669
```
3. Connect to NebulaGraph with NebulaGraph Console.
!!! Note
```bash
/ # ./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](../../7.data-security/1.authentication/1.authentication.md).
4. Run the following commands to view the cluster state.
4. Run the following commands to view the cluster state.
```bash
nebula> SHOW HOSTS;
+-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
| Host | Port | HTTP port | Status | Leader count | Leader distribution | Partition distribution | Version |
+-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
| "storaged0" | 9779 | 19779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.1.0" |
| "storaged1" | 9779 | 19779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.1.0" |
| "storaged2" | 9779 | 19779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.1.0" |
+-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
```
```bash
nebula> SHOW HOSTS;
+-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
| Host | Port | HTTP port | Status | Leader count | Leader distribution | Partition distribution | Version |
+-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
| "storaged0" | 9779 | 19779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "x.x.x" |
| "storaged1" | 9779 | 19779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "x.x.x" |
| "storaged2" | 9779 | 19779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "x.x.x" |
+-------------+------+-----------+----------+--------------+----------------------+------------------------+---------+
```
5. Run `exit` twice to switch back to your terminal (shell).
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.
!!! note
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.
```bash
$ docker-compose ps
nebuladockercompose_console_1 sh -c sleep 3 && Up
Expand All @@ -133,7 +143,30 @@ nebuladockercompose_storaged1_1 /usr/local/nebula/bin/nebu ... Up 0.0.0
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.
If the service is abnormal, you can first confirm the abnormal container name (such as `nebuladockercompose_graphd2_1`).
Then you can execute `docker ps` to view the corresponding `CONTAINER ID` (such as `2a6c56c405f5`).
```bash
[nebula-docker-compose]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2a6c56c405f5 vesoft/nebula-graphd:nightly "/usr/local/nebula/b…" 36 minutes ago Up 36 minutes (healthy) 0.0.0.0:49230->9669/tcp, 0.0.0.0:49229->19669/tcp, 0.0.0.0:49228->19670/tcp nebuladockercompose_graphd2_1
7042e0a8e83d vesoft/nebula-storaged:nightly "./bin/nebula-storag…" 36 minutes ago Up 36 minutes (healthy) 9777-9778/tcp, 9780/tcp, 0.0.0.0:49227->9779/tcp, 0.0.0.0:49226->19779/tcp, 0.0.0.0:49225->19780/tcp nebuladockercompose_storaged2_1
18e3ea63ad65 vesoft/nebula-storaged:nightly "./bin/nebula-storag…" 36 minutes ago Up 36 minutes (healthy) 9777-9778/tcp, 9780/tcp, 0.0.0.0:49219->9779/tcp, 0.0.0.0:49218->19779/tcp, 0.0.0.0:49217->19780/tcp nebuladockercompose_storaged0_1
4dcabfe8677a vesoft/nebula-graphd:nightly "/usr/local/nebula/b…" 36 minutes ago Up 36 minutes (healthy) 0.0.0.0:49224->9669/tcp, 0.0.0.0:49223->19669/tcp, 0.0.0.0:49222->19670/tcp nebuladockercompose_graphd1_1
a74054c6ae25 vesoft/nebula-graphd:nightly "/usr/local/nebula/b…" 36 minutes ago Up 36 minutes (healthy) 0.0.0.0:9669->9669/tcp, 0.0.0.0:49221->19669/tcp, 0.0.0.0:49220->19670/tcp nebuladockercompose_graphd_1
880025a3858c vesoft/nebula-storaged:nightly "./bin/nebula-storag…" 36 minutes ago Up 36 minutes (healthy) 9777-9778/tcp, 9780/tcp, 0.0.0.0:49216->9779/tcp, 0.0.0.0:49215->19779/tcp, 0.0.0.0:49214->19780/tcp nebuladockercompose_storaged1_1
45736a32a23a vesoft/nebula-metad:nightly "./bin/nebula-metad …" 36 minutes ago Up 36 minutes (healthy) 9560/tcp, 0.0.0.0:49213->9559/tcp, 0.0.0.0:49212->19559/tcp, 0.0.0.0:49211->19560/tcp nebuladockercompose_metad0_1
3b2c90eb073e vesoft/nebula-metad:nightly "./bin/nebula-metad …" 36 minutes ago Up 36 minutes (healthy) 9560/tcp, 0.0.0.0:49207->9559/tcp, 0.0.0.0:49206->19559/tcp, 0.0.0.0:49205->19560/tcp nebuladockercompose_metad2_1
7bb31b7a5b3f vesoft/nebula-metad:nightly "./bin/nebula-metad …" 36 minutes ago Up 36 minutes (healthy) 9560/tcp, 0.0.0.0:49210->9559/tcp, 0.0.0.0:49209->19559/tcp, 0.0.0.0:49208->19560/tcp nebuladockercompose_metad1_1
```
Use the `CONTAINER ID` to log in the container and troubleshoot.
```bash
nebula-docker-compose]$ docker exec -it 2a6c56c405f5 bash
[root@2a6c56c405f5 nebula]#
```
## Check the service data and logs
Expand Down
Loading

0 comments on commit db0d2ab

Please sign in to comment.