最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】试用TDeigine数据库的功能和效果

数据库 crifan 3473浏览 0评论
折腾:
【记录】研究TDengine用保存时序数据
期间,已经安装了服务器端,现在继续去试试客户端。
然后去启动服务器端:
【已解决】启动TDengine的服务端taosd
然后继续折腾,去创建demo数据:
【已解决】创建TDengine的demo数据taosdemo用于测试效果
试试client的taos
[root@xxx tdengine]# taos
Welcome to the TDengine shell from linux, community client version:1.6.5.5
DB error: failed to connect to server
此处看来是由于没启动服务器端。
启动后,就可以去运行客户端了:
[root@xxx tdengine]# taos

Welcome to the TDengine shell from linux, community client version:1.6.5.5 community server version:1.6.5.5
Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.

taos>
自己猜测估计mysql的用法是类似的,所以去用
show databases;
看看当前的数据库:
taos> show databases;
              name              |     created time     |  ntables  |  vgroups  |replica| days  |  keep1,keep2,keep(D)   |  tables   |   rows    | cache(b)  |      ablocks       |tblocks| ctime(s)  | clog | comp |time precision|  status  |
==============================================================================================================================================================================================================================================
log                             | 20-02-29 20:11:41.989|          4|          1|      1|     10|30,30,30                |         32|       1024|       2048|             2.00000|     32|       3600|     1|     2|us            |ready     |
test                            | 20-02-29 20:36:32.437|      10000|         10|      1|     10|3650,3650,3650          |       1000|       4096|      16384|             4.00000|     50|       3600|     1|     2|ms            |ready     |
Query OK, 2 row(s) in set (0.000974s)
发现是10亿条:
然后继续测试性能。
先去切换过去
use test;
想要看看表结构呢,结果的确很多个:
...
20:36:32.995|      4|meters                                                          |
t1982                                                           | 20-02-29 20:36:32.811|      4|meters                                                          |
t9882                                                           | 20-02-29 20:36:34.279|      4|meters                                                          |
Query OK, 10000 row(s) in set (1.266687s)


taos> show tables;
看看总条数:
taos> select count(*) from meters;
      count(*)       |
======================
           1000000000|
Query OK, 1 row(s) in set (0.224499s)
看看值:
taos> select avg(f1), max(f2), min(f3) from meters;
         avg(f1)         |  max(f2)  |  min(f3)  |
==================================================
              4.499928000|          9|          0|
Query OK, 1 row(s) in set (0.672128s)
查询loc=”beijing”的记录总条数:
taos> select count(*) from meters where loc="beijing";
      count(*)       |
======================
            500000000|
Query OK, 1 row(s) in set (0.086614s)
查询areaid=10的所有记录的平均值、最大值、最小值等:
taos> select avg(f1), max(f2), min(f3) from meters where areaid=10;
         avg(f1)         |  max(f2)  |  min(f3)  |
==================================================
              4.499986710|          9|          0|
Query OK, 1 row(s) in set (0.048586s)
对表t10按10s进行平均值、最大值和最小值聚合统计:
taos> select avg(f1), max(f2), min(f3) from t10 interval(10s);
          ts          |         avg(f1)         |  max(f2)  |  min(f3)  |
=========================================================================
 17-07-14 10:40:00.000|              4.502400000|          9|          0|
 17-07-14 10:40:10.000|              4.500000000|          9|          0|
 17-07-14 10:40:20.000|              4.508900000|          9|          0|
 17-07-14 10:40:30.000|              4.542700000|          9|          0|
 17-07-14 10:40:40.000|              4.513700000|          9|          0|
 17-07-14 10:40:50.000|              4.467200000|          9|          0|
 17-07-14 10:41:00.000|              4.444700000|          9|          0|
 17-07-14 10:41:10.000|              4.531500000|          9|          0|
 17-07-14 10:41:20.000|              4.485000000|          9|          0|
 17-07-14 10:41:30.000|              4.554900000|          9|          0|
Query OK, 10 row(s) in set (0.002173s)
然后去看看taosdemo还有哪些功能:
[root@xxx ~]# taosdemo --help
Usage: taosdemo [OPTION...]


  -h host                    The host to connect to TDEngine. Default is
                             localhost.
  -p port                    The TCP/IP port number to use for the connection.
                             Default is 0.
  -u user                    The TDEngine user name to use when connecting to
                             the server. Default is 'root'.
  -a password                The password to use when connecting to the server.
                             Default is 'taosdata'.
  -d database                Destination database. Default is 'test'.
  -m table_prefix            Table prefix name. Default is 't'.
  -q query_mode              Query mode--0: SYNC, 1: ASYNC. Default is SYNC.
  -b type_of_cols            The data_type of columns: 'INT', 'TINYINT',
                             'SMALLINT', 'BIGINT', 'FLOAT', 'DOUBLE', 'BINARY'.
                             Default is 'INT'.
  -l num_of_cols_per_record  The number of columns per record. Default is 3.
  -w length_of_binary        The length of data_type 'BINARY'. Only applicable
                             when type of cols is 'BINARY'. Default is 8
  -c num_of_conns            The number of connections. Default is 10.
  -r num_of_records_per_req  The number of records per request. Default is
                             1000.
  -t num_of_tables           The number of tables. Default is 10000.
  -n num_of_records_per_table   The number of records per table. Default is
                             100000.
  -M                         Use metric flag.
  -x                         Insert only flag.
  -f config_directory        Configuration directory. Default is '/etc/taos/'.
  -o outputfile              Direct output to the named file. Default is
                             './output.txt'.
  -?, --help                 Give this help list
      --usage                Give a short usage message
至此
快速上手 | TDengine
的快速上手的功能,基本上就可以了。
继续折腾:
【已解决】TDengine中taos客户端中尝试新建数据库并插入数据
后续再去试试:
RESTful Connector
Python Connector
Java Connector
目前后端的java的spring boot的话,抽空还是去试试Java的connector

转载请注明:在路上 » 【已解决】试用TDeigine数据库的功能和效果

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
80 queries in 0.184 seconds, using 22.09MB memory