未验证 提交 30903ba8 编写于 作者: W wade zhang 提交者: GitHub

Merge pull request #16452 from taosdata/docs/taoshell_TDengine_CLI

docs: updagte taos shell as TDengine CLI for 3.0 version ,include taos.cfg
...@@ -114,7 +114,7 @@ The above process can be repeated to add more dnodes in the cluster. ...@@ -114,7 +114,7 @@ The above process can be repeated to add more dnodes in the cluster.
Any node that is in the cluster and online can be the firstEp of new nodes. Any node that is in the cluster and online can be the firstEp of new nodes.
Nodes use the firstEp parameter only when joining a cluster for the first time. After a node has joined the cluster, it stores the latest mnode in its end point list and no longer makes use of firstEp. Nodes use the firstEp parameter only when joining a cluster for the first time. After a node has joined the cluster, it stores the latest mnode in its end point list and no longer makes use of firstEp.
However, firstEp is used by clients that connect to the cluster. For example, if you run `taos shell` without arguments, it connects to the firstEp by default. However, firstEp is used by clients that connect to the cluster. For example, if you run `TDengine CLI` without arguments, it connects to the firstEp by default.
Two dnodes that are launched without a firstEp value operate independently of each other. It is not possible to add one dnode to the other dnode and form a cluster. It is also not possible to form two independent clusters into a new cluster. Two dnodes that are launched without a firstEp value operate independently of each other. It is not possible to add one dnode to the other dnode and form a cluster. It is also not possible to form two independent clusters into a new cluster.
::: :::
......
...@@ -72,7 +72,7 @@ Next, ensure the hostname "tdengine" is resolvable in `/etc/hosts`. ...@@ -72,7 +72,7 @@ Next, ensure the hostname "tdengine" is resolvable in `/etc/hosts`.
echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts
``` ```
Finally, the TDengine service can be accessed from the taos shell or any connector with "tdengine" as the server address. Finally, the TDengine service can be accessed from the TDengine CLI or any connector with "tdengine" as the server address.
```shell ```shell
taos -h tdengine -P 6030 taos -h tdengine -P 6030
......
...@@ -344,7 +344,7 @@ The charset that takes effect is UTF-8. ...@@ -344,7 +344,7 @@ The charset that takes effect is UTF-8.
| Attribute | Description | | Attribute | Description |
| -------- | --------------------------------- | | -------- | --------------------------------- |
| Applicable | Server and Client | | Applicable | Server and Client |
| Meaning | The interval for taos shell to send heartbeat to mnode | | Meaning | The interval for TDengine CLI to send heartbeat to mnode |
| Unit | second | | Unit | second |
| Value Range | 1-120 | | Value Range | 1-120 |
| Default Value | 3 | | Default Value | 3 |
......
...@@ -23,7 +23,7 @@ import PhpStmt from "./_php_stmt.mdx"; ...@@ -23,7 +23,7 @@ import PhpStmt from "./_php_stmt.mdx";
## SQL 写入简介 ## SQL 写入简介
应用通过连接器执行 INSERT 语句来插入数据,用户还可以通过 TAOS Shell,手动输入 INSERT 语句插入数据。 应用通过连接器执行 INSERT 语句来插入数据,用户还可以通过 TDengine CLI,手动输入 INSERT 语句插入数据。
### 一次写入一条 ### 一次写入一条
下面这条 INSERT 就将一条记录写入到表 d1001 中: 下面这条 INSERT 就将一条记录写入到表 d1001 中:
......
...@@ -52,7 +52,7 @@ Query OK, 2 row(s) in set (0.001100s) ...@@ -52,7 +52,7 @@ Query OK, 2 row(s) in set (0.001100s)
### 示例一 ### 示例一
在 TAOS Shell,查找加利福尼亚州所有智能电表采集的电压平均值,并按照 location 分组。 在 TDengine CLI,查找加利福尼亚州所有智能电表采集的电压平均值,并按照 location 分组。
``` ```
taos> SELECT AVG(voltage), location FROM meters GROUP BY location; taos> SELECT AVG(voltage), location FROM meters GROUP BY location;
...@@ -65,7 +65,7 @@ Query OK, 2 rows in database (0.005995s) ...@@ -65,7 +65,7 @@ Query OK, 2 rows in database (0.005995s)
### 示例二 ### 示例二
在 TAOS shell, 查找 groupId 为 2 的所有智能电表的记录条数,电流的最大值。 在 TDengine CLI, 查找 groupId 为 2 的所有智能电表的记录条数,电流的最大值。
``` ```
taos> SELECT count(*), max(current) FROM meters where groupId = 2; taos> SELECT count(*), max(current) FROM meters where groupId = 2;
......
...@@ -71,7 +71,7 @@ serverPort 6030 ...@@ -71,7 +71,7 @@ serverPort 6030
## 启动集群 ## 启动集群
按照《立即开始》里的步骤,启动第一个数据节点,例如 h1.taosdata.com,然后执行 taos,启动 taos shell,从 shell 里执行命令“SHOW DNODES”,如下所示: 按照《立即开始》里的步骤,启动第一个数据节点,例如 h1.taosdata.com,然后执行 taos,启动 TDengine CLI,从 shell 里执行命令“SHOW DNODES”,如下所示:
``` ```
taos> show dnodes; taos> show dnodes;
...@@ -115,7 +115,7 @@ SHOW DNODES; ...@@ -115,7 +115,7 @@ SHOW DNODES;
任何已经加入集群在线的数据节点,都可以作为后续待加入节点的 firstEp。 任何已经加入集群在线的数据节点,都可以作为后续待加入节点的 firstEp。
firstEp 这个参数仅仅在该数据节点首次加入集群时有作用,加入集群后,该数据节点会保存最新的 mnode 的 End Point 列表,不再依赖这个参数。 firstEp 这个参数仅仅在该数据节点首次加入集群时有作用,加入集群后,该数据节点会保存最新的 mnode 的 End Point 列表,不再依赖这个参数。
接下来,配置文件中的 firstEp 参数就主要在客户端连接的时候使用了,例如 taos shell 如果不加参数,会默认连接由 firstEp 指定的节点。 接下来,配置文件中的 firstEp 参数就主要在客户端连接的时候使用了,例如 TDengine CLI 如果不加参数,会默认连接由 firstEp 指定的节点。
两个没有配置 firstEp 参数的数据节点 dnode 启动后,会独立运行起来。这个时候,无法将其中一个数据节点加入到另外一个数据节点,形成集群。无法将两个独立的集群合并成为新的集群。 两个没有配置 firstEp 参数的数据节点 dnode 启动后,会独立运行起来。这个时候,无法将其中一个数据节点加入到另外一个数据节点,形成集群。无法将两个独立的集群合并成为新的集群。
::: :::
......
...@@ -366,7 +366,7 @@ kubectl scale statefulsets tdengine --replicas=1 ...@@ -366,7 +366,7 @@ kubectl scale statefulsets tdengine --replicas=1
``` ```
taos shell 中的所有数据库操作将无法成功。 TDengine CLI 中的所有数据库操作将无法成功。
``` ```
taos> show dnodes; taos> show dnodes;
......
...@@ -32,7 +32,9 @@ taos> show databases; ...@@ -32,7 +32,9 @@ taos> show databases;
Query OK, 2 rows in database (0.033802s) Query OK, 2 rows in database (0.033802s)
``` ```
因为运行在容器中的 TDengine 服务端使用容器的 hostname 建立连接,使用 TDengine CLI 或者各种连接器(例如 JDBC-JNI)从容器外访问容器内的 TDengine 比较复杂,所以上述方式是访问容器中 TDengine 服务的最简单的方法,适用于一些简单场景。如果在一些复杂场景下想要从容器化使用 taos shell 或者各种连接器访问容器中的 TDengine 服务,请参考下一节。
因为运行在容器中的 TDengine 服务端使用容器的 hostname 建立连接,使用 TDengine CLI 或者各种连接器(例如 JDBC-JNI)从容器外访问容器内的 TDengine 比较复杂,所以上述方式是访问容器中 TDengine 服务的最简单的方法,适用于一些简单场景。如果在一些复杂场景下想要从容器化使用 TDengine CLI 或者各种连接器访问容器中的 TDengine 服务,请参考下一节。
## 在 host 网络上启动 TDengine ## 在 host 网络上启动 TDengine
...@@ -75,7 +77,7 @@ docker run -d \ ...@@ -75,7 +77,7 @@ docker run -d \
echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts
``` ```
最后,可以从 taos shell 或者任意连接器以 "tdengine" 为服务端地址访问 TDengine 服务。 最后,可以从 TDengine CLI 或者任意连接器以 "tdengine" 为服务端地址访问 TDengine 服务。
```shell ```shell
taos -h tdengine -P 6030 taos -h tdengine -P 6030
...@@ -354,7 +356,7 @@ test-docker_td-2_1 /tini -- /usr/bin/entrypoi ... Up ...@@ -354,7 +356,7 @@ test-docker_td-2_1 /tini -- /usr/bin/entrypoi ... Up
test-docker_td-3_1 /tini -- /usr/bin/entrypoi ... Up test-docker_td-3_1 /tini -- /usr/bin/entrypoi ... Up
``` ```
4.taos shell 查看 dnodes 4.TDengine CLI 查看 dnodes
```shell ```shell
......
...@@ -7,7 +7,7 @@ description: 如何导出 TDengine 中的数据 ...@@ -7,7 +7,7 @@ description: 如何导出 TDengine 中的数据
## 按表导出 CSV 文件 ## 按表导出 CSV 文件
如果用户需要导出一个表或一个 STable 中的数据,可在 taos shell 中运行: 如果用户需要导出一个表或一个 STable 中的数据,可在 TDengine CLI 中运行:
```sql ```sql
select * from <tb_name> >> data.csv; select * from <tb_name> >> data.csv;
......
...@@ -129,7 +129,7 @@ https://www.taosdata.com/cn/all-downloads/ ...@@ -129,7 +129,7 @@ https://www.taosdata.com/cn/all-downloads/
192.168.236.136 td01 192.168.236.136 td01
``` ```
配置完成后,在命令行内使用taos shell连接server端 配置完成后,在命令行内使用TDengine CLI连接server端
```shell ```shell
C:\TDengine>taos -h td01 C:\TDengine>taos -h td01
......
...@@ -35,7 +35,7 @@ Python 2.7.18 ...@@ -35,7 +35,7 @@ Python 2.7.18
下载地址:https://www.taosdata.com/cn/all-downloads/,选择一个合适的windows-client下载(client应该尽量与server端的版本保持一致) 下载地址:https://www.taosdata.com/cn/all-downloads/,选择一个合适的windows-client下载(client应该尽量与server端的版本保持一致)
使用client的taos shell连接server 使用client的TDengine CLI连接server
```shell ```shell
>taos -h node5 >taos -h node5
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
# The interval of dnode reporting status to mnode # The interval of dnode reporting status to mnode
# statusInterval 1 # statusInterval 1
# The interval for taos shell to send heartbeat to mnode # The interval for TDengine CLI to send heartbeat to mnode
# shellActivityTimer 3 # shellActivityTimer 3
# The minimum sliding window time, milli-second # The minimum sliding window time, milli-second
......
...@@ -47,7 +47,7 @@ taos> show databases; ...@@ -47,7 +47,7 @@ taos> show databases;
Query OK, 1 row(s) in set (0.002843s) Query OK, 1 row(s) in set (0.002843s)
``` ```
Since TDengine use container hostname to establish connections, it's a bit more complex to use taos shell and native connectors(such as JDBC-JNI) with TDengine container instance. This is the recommended way to expose ports and use TDengine with docker in simple cases. If you want to use taos shell or taosc/connectors smoothly outside the `tdengine` container, see next use cases that match you need. Since TDengine use container hostname to establish connections, it's a bit more complex to use TDengine CLI and native connectors(such as JDBC-JNI) with TDengine container instance. This is the recommended way to expose ports and use TDengine with docker in simple cases. If you want to use TDengine CLI or taosc/connectors smoothly outside the `tdengine` container, see next use cases that match you need.
### Start with host network ### Start with host network
...@@ -87,7 +87,7 @@ docker run -d \ ...@@ -87,7 +87,7 @@ docker run -d \
This command starts a docker container with TDengine server running and maps the container's TCP ports from 6030 to 6049 to the host's ports from 6030 to 6049 with TCP protocol and UDP ports range 6030-6039 to the host's UDP ports 6030-6039. If the host is already running TDengine server and occupying the same port(s), you need to map the container's port to a different unused port segment. (Please see TDengine 2.0 Port Description for details). In order to support TDengine clients accessing TDengine server services, both TCP and UDP ports need to be exposed by default(unless `rpcForceTcp` is set to `1`). This command starts a docker container with TDengine server running and maps the container's TCP ports from 6030 to 6049 to the host's ports from 6030 to 6049 with TCP protocol and UDP ports range 6030-6039 to the host's UDP ports 6030-6039. If the host is already running TDengine server and occupying the same port(s), you need to map the container's port to a different unused port segment. (Please see TDengine 2.0 Port Description for details). In order to support TDengine clients accessing TDengine server services, both TCP and UDP ports need to be exposed by default(unless `rpcForceTcp` is set to `1`).
If you want to use taos shell or native connectors([JDBC-JNI](https://www.taosdata.com/cn/documentation/connector/java), or [driver-go](https://github.com/taosdata/driver-go)), you need to make sure the `TAOS_FQDN` is resolvable at `/etc/hosts` or with custom DNS service. If you want to use TDengine CLI or native connectors([JDBC-JNI](https://www.taosdata.com/cn/documentation/connector/java), or [driver-go](https://github.com/taosdata/driver-go)), you need to make sure the `TAOS_FQDN` is resolvable at `/etc/hosts` or with custom DNS service.
If you set the `TAOS_FQDN` to host's hostname, it will works as using `hosts` network like previous use case. Otherwise, like in `-e TAOS_FQDN=tdengine`, you can add the hostname record `tdengine` into `/etc/hosts` (use `127.0.0.1` here in host path, if use TDengine client/application in other hosts, you should set the right ip to the host eg. `192.168.10.1`(check the real ip in host with `hostname -i` or `ip route list default`) to make the TDengine endpoint resolvable): If you set the `TAOS_FQDN` to host's hostname, it will works as using `hosts` network like previous use case. Otherwise, like in `-e TAOS_FQDN=tdengine`, you can add the hostname record `tdengine` into `/etc/hosts` (use `127.0.0.1` here in host path, if use TDengine client/application in other hosts, you should set the right ip to the host eg. `192.168.10.1`(check the real ip in host with `hostname -i` or `ip route list default`) to make the TDengine endpoint resolvable):
...@@ -391,7 +391,7 @@ test_td-1_1 /usr/bin/entrypoint.sh taosd Up 6030/tcp, 6031/tcp, ...@@ -391,7 +391,7 @@ test_td-1_1 /usr/bin/entrypoint.sh taosd Up 6030/tcp, 6031/tcp,
test_td-2_1 /usr/bin/entrypoint.sh taosd Up 6030/tcp, 6031/tcp, 6032/tcp, 6033/tcp, 6034/tcp, 6035/tcp, 6036/tcp, 6037/tcp, 6038/tcp, 6039/tcp, 6040/tcp, 6041/tcp, 6042/tcp test_td-2_1 /usr/bin/entrypoint.sh taosd Up 6030/tcp, 6031/tcp, 6032/tcp, 6033/tcp, 6034/tcp, 6035/tcp, 6036/tcp, 6037/tcp, 6038/tcp, 6039/tcp, 6040/tcp, 6041/tcp, 6042/tcp
``` ```
Check dnodes with taos shell: Check dnodes with TDengine CLI:
```bash ```bash
$ docker-compose exec td-1 taos -s "show dnodes" $ docker-compose exec td-1 taos -s "show dnodes"
......
...@@ -76,7 +76,7 @@ sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL, ...@@ -76,7 +76,7 @@ sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL,
print ================ start query ====================== print ================ start query ======================
print ================ SQL used to cause taosd or taos shell crash print ================ SQL used to cause taosd or TDengine CLI crash
sql_error select sum(c1) ,count(c1) from ct4 group by c1 having sum(c10) between 0 and 1 ; sql_error select sum(c1) ,count(c1) from ct4 group by c1 having sum(c10) between 0 and 1 ;
#system sh/exec.sh -n dnode1 -s stop -x SIGINT #system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册