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
```yml
version: "3"
version:"3"
services:
services:
arbitrator:
td-1:
image: tdengine/tdengine:$VERSION
image:tdengine/tdengine:$VERSION
command: tarbitrator
environment:
td-1:
TAOS_FQDN:"td-1"
image: tdengine/tdengine:$VERSION
TAOS_FIRST_EP:"td-1"
environment:
volumes:
TAOS_FQDN: "td-1"
-taosdata-td1:/var/lib/taos/
TAOS_FIRST_EP: "td-1"
-taoslog-td1:/var/log/taos/
TAOS_NUM_OF_MNODES: "2"
td-2:
TAOS_REPLICA: "2"
image:tdengine/tdengine:$VERSION
TAOS_ARBITRATOR: arbitrator:6042
environment:
volumes:
TAOS_FQDN:"td-2"
- taosdata-td1:/var/lib/taos/
TAOS_FIRST_EP:"td-1"
- taoslog-td1:/var/log/taos/
volumes:
td-2:
-taosdata-td2:/var/lib/taos/
image: tdengine/tdengine:$VERSION
-taoslog-td2:/var/log/taos/
environment:
td-3:
TAOS_FQDN: "td-2"
image:tdengine/tdengine:$VERSION
TAOS_FIRST_EP: "td-1"
environment:
TAOS_NUM_OF_MNODES: "2"
TAOS_FQDN:"td-3"
TAOS_REPLICA: "2"
TAOS_FIRST_EP:"td-1"
TAOS_ARBITRATOR: arbitrator:6042
volumes:
volumes:
-taosdata-td3:/var/lib/taos/
- taosdata-td2:/var/lib/taos/
-taoslog-td3:/var/log/taos/
- taoslog-td2:/var/log/taos/
volumes:
volumes:
taosdata-td1:
taosdata-td1:
taoslog-td1:
taoslog-td1:
taosdata-td2:
taosdata-td2:
taoslog-td2:
taoslog-td2:
taosdata-td3:
```
taoslog-td3:
```
:::note
:::note
- The `VERSION` environment variable is used to set the tdengine image tag
- 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_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
2. Start the cluster
...
@@ -345,17 +344,18 @@ password: taosdata
...
@@ -345,17 +344,18 @@ password: taosdata
4. Show dnodes via TDengine CLI
4. Show dnodes via TDengine CLI
```shell
```shell
$ docker-compose exec td-1 taos -s"show dnodes"
$ docker-compose exec td-1 taos -s"show dnodes"
taos> show dnodes
taos> show dnodes
id | end_point | vnodes | cores | status | role | create_time | offline reason |
id | endpoint | vnodes | support_vnodes | status | create_time | note |
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:
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: