1. The following docker-compose file starts a TDengine cluster with two replicas, two management nodes, two data nodes, and one arbitrator.
1. The following docker-compose file starts a TDengine cluster with three nodes.
```docker
version: "3"
services:
arbitrator:
image: tdengine/tdengine:$VERSION
command: tarbitrator
```yml
version:"3"
services:
td-1:
image:tdengine/tdengine:$VERSION
environment:
TAOS_FQDN:"td-1"
TAOS_FIRST_EP:"td-1"
TAOS_NUM_OF_MNODES: "2"
TAOS_REPLICA: "2"
TAOS_ARBITRATOR: arbitrator:6042
volumes:
-taosdata-td1:/var/lib/taos/
-taoslog-td1:/var/log/taos/
...
...
@@ -297,25 +291,30 @@ password: taosdata
environment:
TAOS_FQDN:"td-2"
TAOS_FIRST_EP:"td-1"
TAOS_NUM_OF_MNODES: "2"
TAOS_REPLICA: "2"
TAOS_ARBITRATOR: arbitrator:6042
volumes:
-taosdata-td2:/var/lib/taos/
-taoslog-td2:/var/log/taos/
td-3:
image:tdengine/tdengine:$VERSION
environment:
TAOS_FQDN:"td-3"
TAOS_FIRST_EP:"td-1"
volumes:
-taosdata-td3:/var/lib/taos/
-taoslog-td3:/var/log/taos/
volumes:
taosdata-td1:
taoslog-td1:
taosdata-td2:
taoslog-td2:
```
taosdata-td3:
taoslog-td3:
```
:::note
- The `VERSION` environment variable is used to set the tdengine image tag
-`TAOS_FIRST_EP` must be set on the newly created instance so that it can join the TDengine cluster; if there is a high availability requirement, `TAOS_SECOND_EP` needs to be used at the same time
-`TAOS_REPLICA` is used to set the default number of database replicas. Its value range is [1,3]
We recommend setting it with `TAOS_ARBITRATOR` to use arbitrator in a two-nodes environment.
:::
2. Start the cluster
...
...
@@ -345,17 +344,18 @@ password: taosdata
4. Show dnodes via TDengine CLI
```shell
$ docker-compose exec td-1 taos -s"show dnodes"
```shell
$ docker-compose exec td-1 taos -s"show dnodes"
taos> show dnodes
id | end_point | vnodes | cores | status | role | create_time | offline reason |
Suppose you want to deploy multiple taosAdapters to improve throughput and provide high availability. In that case, the recommended configuration method uses a reverse proxy such as Nginx to offer a unified access entry. For specific configuration methods, please refer to the official documentation of Nginx. Here is an example: