Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
21ba87c7
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
21ba87c7
编写于
11月 27, 2021
作者:
L
Linhe Huo
提交者:
GitHub
11月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-11481]<docs>: update taosimport README (#8818)
上级
3c2ec89f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
32 deletion
+26
-32
importSampleData/README.md
importSampleData/README.md
+24
-30
importSampleData/go.mod
importSampleData/go.mod
+2
-2
未找到文件。
importSampleData/README.md
浏览文件 @
21ba87c7
#
#
样例数据导入
# 样例数据导入
该工具可以根据用户提供的
`json`
或
`csv`
格式样例数据文件快速导入
`TDengine`
,目前仅能在 Linux 上运行。
为了体验写入和查询性能,可以对样例数据进行横向、纵向扩展。横向扩展是指将一个表(监测点)的数据克隆到多张表,纵向扩展是指将样例数据中的一段时间范围内的数据在时间轴上复制。该工具还支持历史数据导入至当前时间后持续导入,这样可以测试插入和查询并行进行的场景,以模拟真实环境。
##
下载
安装
##
编译
安装
### 下载可执行文件
由于该工具使用 go 语言开发,编译之前需要先安装 go,具体请参考
[
Getting Started
][
2
]
。执行以下命令即可编译成可执行文件
`bin/taosimport`
。
由于该工具使用 go 语言开发,为了方便使用,项目中已经提供了编译好的可执行文件
`bin/taosimport`
。通过
`git clone https://github.com/taosdata/TDengine.git`
命令或者直接下载
`ZIP`
文件解压进入样例导入程序目录
`cd importSampleData`
,执行
`bin/taosimport`
。
### go 源码编译
由于该工具使用 go 语言开发,编译之前需要先安装 go,具体请参考
[
Getting Started
][
2
]
,而且需要安装 TDengine 的 Go Connector, 具体请参考
[
TDengine 连接器文档
][
3
]
。安装完成之后,执行以下命令即可编译成可执行文件
`bin/taosimport`
。
```
shell
go get https://github.com/taosdata/TDengine/importSampleData
cd
$GOPATH
/src/github.com/taosdata/TDengine/importSampleData
go mod tidy
go build
-o
bin/taosimport app/main.go
```
> 注:由于目前 TDengine 的 go connector 只支持 linux 环境,所以该工具暂时只能在 linux 系统中运行。
> 如果 go get 失败可以下载之后复制 `github.com/taosdata/TDengine/importSampleData` 文件夹到 $GOPATH 的 src 目录下再执行 `go build -o bin/taosimport app/main.go`。
## 使用
### 快速体验
执行命令
`bin/taosimport`
会根据默认配置执行以下操作:
1.
创建数据库
自动创建名称为
`test_yyyyMMdd`
的数据库。
自动创建名称为
`test_yyyyMMdd`
的数据库
,
`yyyyMMdd`
是当前日期,如
`20211111`
。
2.
创建超级表
...
...
@@ -48,21 +40,25 @@ go build -o bin/taosimport app/main.go
taos> use test_yyyyMMdd;
taos> select count(*) from s_sensor_info;
```
*
查询各个分组的记录数
```shell
taos> select count(*) from s_sensor_info group by devgroup;
```
*
按 1h 间隔查询各聚合指标
```shell
taos> select count(temperature), sum(temperature), avg(temperature) from s_sensor_info interval(1h);
```
*
查询指定位置最新上传指标
```shell
taos> select last(*) from s_sensor_info where location = 'beijing';
```
> 更多查询及函数使用请参考 [数据查询][4]
### 详细使用说明
...
...
@@ -237,8 +233,6 @@ devid,location,color,devgroup,ts,temperature,humidity
0, beijing, white, 0, 1575129601000, 22, 14.377142
```
[
1
]:
https://github.com/taosdata/TDengine
[
2
]:
https://golang.org/doc/install
[
3
]:
https://www.taosdata.com/cn/documentation/connector/#Go-Connector
...
...
importSampleData/go.mod
浏览文件 @
21ba87c7
...
...
@@ -3,6 +3,6 @@ module github.com/taosdata/TDengine/importSampleData
go 1.13
require (
github.com/pelletier/go-toml v1.9.0
// indirect
github.com/taosdata/driver-go v0.0.0-20210415143420-d99751356e28
// indirect
github.com/pelletier/go-toml v1.9.0
github.com/taosdata/driver-go v0.0.0-20210415143420-d99751356e28
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录