Ubuntu系统下安装TDengine Database

news2025/2/24 21:30:48

记录一下使用Ubuntu系统的安装TDengine Database管理软件工具

先查看一下系统的版本,可以看到这里使用的是Ubuntu20.04版本,版本代号focal

myw@myw-S451LN:~$ uname -a
Linux myw-S451LN 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
myw@myw-S451LN:~$ uname -r
6.2.0-39-generic
myw@myw-S451LN:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
myw@myw-S451LN:~$ 

官网介绍:TDengine 是一款专为物联网、工业互联网等场景设计并优化的大数据平台,它能安全高效地将大量设备、数据采集器每天产生的高达 TB 甚至 PB 级的数据进行汇聚、存储、分析和分发,对业务运行状态进行实时监测、预警,提供实时的商业洞察。其核心模块是高性能、集群开源、云原生、极简的时序数据库 TDengine OSS

官网

https://docs.taosdata.com

官网安装教程

https://docs.taosdata.com/get-started/package/

linux环境
myw
使用deb安装
myw
首先去下载deb安装包 有2个(其中taosTools是工具,TDengine-server是时序数据库),下载需要输入邮箱 ,然后从邮箱获取下载链接,记录一下我安装的版本和工具版本

https://www.taosdata.com/assets-download/3.0/TDengine-server-3.2.2.0-Linux-x64.deb
https://www.taosdata.com/assets-download/3.0/taosTools-2.5.2-Linux-x64-comp3.deb

win系统客户端

https://www.taosdata.com/assets-download/3.0/TDengine-client-3.2.2.0-Windows-x64.exe

将下载的安装包放置在ubuntu的home指定的用户下面(安装需要进入deb包的目录) 我这里是/home/myw

/home/myw

myw
安装指令(在deb文件包的目录下面)

sudo dpkg -i TDengine-server-3.2.2.0-Linux-x64.deb
myw@myw-S451LN:~$ sudo dpkg -i TDengine-server-3.2.2.0-Linux-x64.deb
[sudo] myw 的密码: 
正在选中未选择的软件包 tdengine。
(正在读取数据库 ... 系统当前共安装有 207485 个文件和目录。)
准备解压 TDengine-server-3.2.2.0-Linux-x64.deb  ...
正在解压 tdengine (3.2.2.0) ...
正在设置 tdengine (3.2.2.0) ...
./post.sh: 行 107: /var/log/taos/tdengine_install.log: 没有那个文件或目录
Start to install TDengine...
./post.sh: 行 107: /var/log/taos/tdengine_install.log: 没有那个文件或目录

System hostname is: myw-S451LN

Enter FQDN:port (like h1.taosdata.com:6030) of an existing TDengine cluster node to join
OR leave it blank to build one:

Enter your email address for priority support or enter empty to skip: 
Created symlink /etc/systemd/system/multi-user.target.wants/taosd.service → /etc/systemd/system/taosd.service.

To configure TDengine : edit /etc/taos/taos.cfg
To start TDengine     : sudo systemctl start taosd
To access TDengine    : taos -h myw-S451LN to login into TDengine server


TDengine is installed successfully!
myw@myw-S451LN:~$ 

安装过程中有2个停顿 直接enter

启动停止重启,查看是否启动成功 默认端口是6030

systemctl start taosd
systemctl status taosd
systemctl stop taosd
systemctl restart taosd
myw@myw-S451LN:~$ sudo netstat -lnp|grep taos
tcp        0      0 0.0.0.0:6030            0.0.0.0:*               LISTEN      1019/taosd          
unix  2      [ ACC ]     流        LISTENING     27052    1100/udfd            /var/lib/taos//.udfd.sock.1
myw@myw-S451LN:~$ sudo systemctl stop taosd
myw@myw-S451LN:~$ sudo netstat -lnp|grep taos
myw@myw-S451LN:~$ sudo systemctl start taosd
myw@myw-S451LN:~$ sudo netstat -lnp|grep taos
tcp        0      0 0.0.0.0:6030            0.0.0.0:*               LISTEN      5885/taosd          
unix  2      [ ACC ]     流        LISTENING     46956    5899/udfd            /var/lib/taos//.udfd.sock.1
myw@myw-S451LN:~$ sudo systemctl restart taosd
myw@myw-S451LN:~$ sudo netstat -lnp|grep taos
tcp        0      0 0.0.0.0:6030            0.0.0.0:*               LISTEN      6065/taosd          
unix  2      [ ACC ]     流        LISTENING     47581    6076/udfd            /var/lib/taos//.udfd.sock.1
myw@myw-S451LN:~$ sudo systemctl status taosd
● taosd.service - TDengine server service
     Loaded: loaded (/etc/systemd/system/taosd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-01-07 12:04:24 CST; 13s ago
    Process: 6059 ExecStartPre=/usr/local/taos/bin/startPre.sh (code=exited, status=0/SUCCESS)
   Main PID: 6065 (taosd)
      Tasks: 33 (limit: 9286)
     Memory: 9.9M
        CPU: 218ms
     CGroup: /system.slice/taosd.service
             ├─6065 /usr/bin/taosd
             └─6076 /usr/bin/udfd -c /etc/taos/

1月 07 12:04:24 myw-S451LN systemd[1]: Starting TDengine server service...
1月 07 12:04:24 myw-S451LN systemd[1]: Started TDengine server service.
myw@myw-S451LN:~$ 

启动之后进入tdengine数据库

taos
myw@myw-S451LN:~$ taos
Welcome to the TDengine Command Line Interface, Client Version:3.2.2.0
Copyright (c) 2023 by TDengine, all rights reserved.

  ********************************  Tab Completion  ************************************
  *   The TDengine CLI supports tab completion for a variety of items,                 *
  *   including database names, table names, function names and keywords.              *
  *   The full list of shortcut keys is as follows:                                    *
  *    [ TAB ]        ......  complete the current word                                *
  *                   ......  if used on a blank line, display all supported commands  *
  *    [ Ctrl + A ]   ......  move cursor to the st[A]rt of the line                   *
  *    [ Ctrl + E ]   ......  move cursor to the [E]nd of the line                     *
  *    [ Ctrl + W ]   ......  move cursor to the middle of the line                    *
  *    [ Ctrl + L ]   ......  clear the entire screen                                  *
  *    [ Ctrl + K ]   ......  clear the screen after the cursor                        *
  *    [ Ctrl + U ]   ......  clear the screen before the cursor                       *
  **************************************************************************************

Server is Community Edition.

taos> show databases;
              name              |
=================================
 information_schema             |
 performance_schema             |
Query OK, 2 row(s) in set (0.001619s)

taos> exit;
myw@myw-S451LN:~$ 

根据官方的教程体验一下命令行创建数据库和表

taos> CREATE DATABASE demo;
Create OK, 0 row(s) affected (5.116540s)

taos> USE demo;
Database changed.

taos> CREATE TABLE t (ts TIMESTAMP, speed INT);
Create OK, 0 row(s) affected (0.001511s)

taos> INSERT INTO t VALUES ('2019-07-15 00:00:00', 10);
Insert OK, 1 row(s) affected (0.001685s)

taos> INSERT INTO t VALUES ('2019-07-15 01:00:00', 20);
Insert OK, 1 row(s) affected (0.001532s)

taos> SELECT * FROM t;
           ts            |    speed    |
========================================
 2019-07-15 00:00:00.000 |          10 |
 2019-07-15 01:00:00.000 |          20 |
Query OK, 2 row(s) in set (0.001555s)

taos> 

根据官方的体验一下写入速度和查询

taosBenchmark
myw@myw-S451LN:~$ sudo taosBenchmark
[sudo] myw 的密码: 
[01/07 12:12:02.674949] INFO: client version: 3.2.2.0


         Press enter key to continue or Ctrl-C to stop


[01/07 12:12:19.064618] INFO: command to create database: <CREATE DATABASE IF NOT EXISTS test VGROUPS 4 PRECISION 'ms';>
[01/07 12:12:19.069152] SUCC: created database (test)
[01/07 12:12:19.071316] WARN: failed to run command DESCRIBE `test`.`meters`, code: 0x80002603, reason: Table does not exist
[01/07 12:12:19.071360] INFO: stable meters does not exist, will create one
[01/07 12:12:19.072193] INFO: create stable: <CREATE TABLE test.meters (ts TIMESTAMP,current float,voltage int,phase float) TAGS (groupid int,location binary(24))>
[01/07 12:12:19.155807] INFO: generate stable<meters> columns data with lenOfCols<80> * prepared_rand<360>
[01/07 12:12:22.662169] INFO: generate stable<meters> tags data with lenOfTags<62> * childTblCount<10000>
[01/07 12:12:22.666451] INFO: start creating 10000 table(s) with 8 thread(s)
[01/07 12:12:22.667534] INFO: thread[0] start creating table from 0 to 1249
[01/07 12:12:22.668186] INFO: thread[1] start creating table from 1250 to 2499
[01/07 12:12:22.668906] INFO: thread[2] start creating table from 2500 to 3749
[01/07 12:12:22.670124] INFO: thread[3] start creating table from 3750 to 4999
[01/07 12:12:22.671742] INFO: thread[4] start creating table from 5000 to 6249
[01/07 12:12:22.673665] INFO: thread[5] start creating table from 6250 to 7499
[01/07 12:12:22.674909] INFO: thread[6] start creating table from 7500 to 8749
[01/07 12:12:22.676058] INFO: thread[7] start creating table from 8750 to 9999
[01/07 12:12:24.316949] SUCC: Spent 1.6500 seconds to create 10000 table(s) with 8 thread(s), already exist 0 table(s), actual 10000 table(s) pre created, 0 table(s) will be auto created


         Press enter key to continue or Ctrl-C to stop


[01/07 12:12:29.271717] INFO: record per request (30000) is larger than insert rows (10000) in progressive mode, which will be set to 10000
[01/07 12:12:29.327505] INFO: Total 2482 tables on bb test's vgroup 0 (id: 4)
[01/07 12:12:29.327522] INFO: Total 2522 tables on bb test's vgroup 1 (id: 5)
[01/07 12:12:29.327549] INFO: Total 2520 tables on bb test's vgroup 2 (id: 6)
[01/07 12:12:29.327568] INFO: Total 2476 tables on bb test's vgroup 3 (id: 7)
[01/07 12:12:29.391136] INFO: Estimate memory usage: 283.60MB


         Press enter key to continue or Ctrl-C to stop


[01/07 12:12:37.566155] INFO:  pthread_join 0 ...
[01/07 12:13:07.581119] INFO: thread[2] has currently inserted rows: 4900000, peroid insert rate: 163251.707 rows/s 
[01/07 12:13:07.584158] INFO: thread[1] has currently inserted rows: 4910000, peroid insert rate: 163568.526 rows/s 
[01/07 12:13:07.584970] INFO: thread[3] has currently inserted rows: 4900000, peroid insert rate: 163235.392 rows/s 
[01/07 12:13:07.959306] INFO: thread[0] has currently inserted rows: 4940000, peroid insert rate: 162537.426 rows/s 
[01/07 12:13:37.585407] INFO: thread[1] has currently inserted rows: 9790000, peroid insert rate: 162661.245 rows/s 
[01/07 12:13:37.585692] INFO: thread[2] has currently inserted rows: 9970000, peroid insert rate: 168977.470 rows/s 
[01/07 12:13:37.636150] INFO: thread[3] has currently inserted rows: 9990000, peroid insert rate: 169373.087 rows/s 
[01/07 12:13:37.973312] INFO: thread[0] has currently inserted rows: 10130000, peroid insert rate: 172919.304 rows/s 
[01/07 12:14:07.596251] INFO: thread[1] has currently inserted rows: 14850000, peroid insert rate: 168604.845 rows/s 
[01/07 12:14:07.602622] INFO: thread[2] has currently inserted rows: 15030000, peroid insert rate: 168571.143 rows/s 
[01/07 12:14:08.247951] INFO: thread[0] has currently inserted rows: 15090000, peroid insert rate: 163836.956 rows/s 
[01/07 12:14:08.303297] INFO: thread[3] has currently inserted rows: 15090000, peroid insert rate: 166302.540 rows/s 
[01/07 12:14:37.625015] INFO: thread[1] has currently inserted rows: 19790000, peroid insert rate: 164507.643 rows/s 
[01/07 12:14:37.629453] INFO: thread[2] has currently inserted rows: 19830000, peroid insert rate: 159856.129 rows/s 
[01/07 12:14:38.336561] INFO: thread[0] has currently inserted rows: 19880000, peroid insert rate: 159194.390 rows/s 
[01/07 12:14:38.388810] INFO: thread[3] has currently inserted rows: 19870000, peroid insert rate: 158883.164 rows/s 
[01/07 12:15:05.195084] SUCC: thread[3] progressive mode, completed total inserted rows: 24760000, 179445.39 records/second
[01/07 12:15:07.649704] INFO: thread[2] has currently inserted rows: 24590000, peroid insert rate: 158560.959 rows/s 
[01/07 12:15:07.675532] INFO: thread[1] has currently inserted rows: 24680000, peroid insert rate: 162728.785 rows/s 
[01/07 12:15:08.343712] INFO: thread[0] has currently inserted rows: 24650000, peroid insert rate: 158962.909 rows/s 
[01/07 12:15:08.756175] SUCC: thread[0] progressive mode, completed total inserted rows: 24820000, 175445.37 records/second
[01/07 12:15:08.756393] INFO:  pthread_join 1 ...
[01/07 12:15:09.262905] SUCC: thread[2] progressive mode, completed total inserted rows: 25200000, 177605.51 records/second
[01/07 12:15:11.574702] SUCC: thread[1] progressive mode, completed total inserted rows: 25220000, 174897.55 records/second
[01/07 12:15:11.574861] INFO:  pthread_join 2 ...
[01/07 12:15:11.574877] INFO:  pthread_join 3 ...
[01/07 12:15:11.576252] SUCC: Spent 154.008730 (real 141.383857) seconds to insert rows: 100000000 with 4 thread(s) into test 649313.84 (real 707294.33) records/second
[01/07 12:15:11.576289] SUCC: insert delay, min: 16.9580ms, avg: 56.5535ms, p90: 84.4130ms, p95: 95.8320ms, p99: 534.7680ms, max: 1878.0990ms
myw@myw-S451LN:~$ 

插入1亿条数据花的时间长了些 那是因为电脑是S451LN 很老很老的电脑了 如果是io高或者固态硬盘很快

查询超级表的总条数

SELECT COUNT(*) FROM test.meters;
taos> SELECT COUNT(*) FROM test.meters;
       count(*)        |
========================
             100000000 |
Query OK, 1 row(s) in set (0.284454s)

taos> 

查询 1 亿条记录的平均值、最大值、最小值

SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
taos> SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
       avg(current)        | max(voltage) |      min(phase)      |
==================================================================
         0.057360763841361 |           18 |           -1.0000000 |
Query OK, 1 row(s) in set (0.576719s)

taos>

查询 location = “California.SanFrancisco” 的记录总条数

SELECT COUNT(*) FROM test.meters WHERE location = "California.SanFrancisco";
taos> SELECT COUNT(*) FROM test.meters WHERE location = "California.SanFrancisco";
       count(*)        |
========================
              10200000 |
Query OK, 1 row(s) in set (0.052531s)

taos> 

查询 groupId = 10 的所有记录的平均值、最大值、最小值

SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
taos> SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
       avg(current)        | max(voltage) |      min(phase)      |
==================================================================
         0.057453115410926 |           18 |           -1.0000000 |
Query OK, 1 row(s) in set (0.096468s)

taos> 

对表 d10 按每 10 秒进行平均值、最大值和最小值聚合统计

SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
taos> SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
        first(ts)        |       avg(current)        | max(voltage) |      min(phase)      |
============================================================================================
 2017-07-14 10:40:00.000 |         0.054056339328364 |           18 |           -0.9998480 |
Query OK, 1 row(s) in set (0.030202s)

taos> 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1370397.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

一键搭建elk

一键启动elk 1. 生成环境的脚本 setup.sh #!/usr/bin/bash# logstash enviroment mkdir -p logstash touch logstash/logstash.conf # shellcheck disableSC1078 echo input {tcp {mode > "server"host > "0.0.0.0"port > 4560codec > jso…

Kubernetes WebHook 入门 -- 入门案例: apiserver 接入 github

博客原文 文章目录 k8s 集群配置介绍Admission WebhookWebHook 入门实践: github 认证接入web 服务器Dockerfile 镜像制作amd64x86_64构造镜像检验镜像 Makefilewebhook 接入 apiserverwebhook.yamlapiserver 挂载 webconfig在 github 中创建认证 token将 token 添加到 kubecon…

以某一web系统为测试对象(若依RuoYi为例)-软件测试实验报告作业

题目:以某一 web系统为测试对象&#xff0c;完成以下文档的编写(满分 100分) (1)产品规格说明书 (SPEC) 要求:功能完整(完成产品需求 70%以上)、UI 优良 (每个页面均有字段约 束和合理的出错提示)、流程完整 (一一对应功能)流程合理 (处理逻辑非直线) (2)测试计划要求 :测试进…

一、数据结构基本概念

数据结构基本概念 一、数据结构基本概念1.基本概念和术语1.1数据&#xff08;Data&#xff09;1.2 数据元素&#xff08;Data element&#xff09;1.3 数据项 &#xff08;Data Item&#xff09;1.4 数据对象 &#xff08;Data Object&#xff09;1.5 数据结构 &#xff08;Dat…

移除两个双向链表中的重复元素,每个链表中的元素不重复

移除两个双向链表中的重复元素&#xff0c;每个链表中的元素不重复&#xff0c;请给出算法。 ans: 该问题比单向链表要更加复杂一些&#xff0c;必须考虑并更新前向节点的指向情况&#xff0c;具体编码中存在一些难度&#xff0c;加上链表调试相对不容易&#xff0c;因此难度系…

Qt之有趣的数字钟

一.效果 基于网络代码修改,支持时、分、秒;支持滑动、翻页和旋转。 二.实现 #include <QtCore> #include <QPainter> #include <QAction> #include <QWidget> #include <QMainWindow> #include <QTimer> #include <QKeyEvent> #…

React ant table警告:Each child in a list should have a unique “key“ prop.

如下图&#xff1a; 原因 React Ant table表格每一行都需要一个唯一标识来确保不重复&#xff0c;如果不加该属性&#xff0c;就会出现这个警告。 修复 添加这一行&#xff1a; rowKey{(record) > record.id} # id为行idTable代码段&#xff1a; <TabledataSourc…

Armv8-R AArch32 architecture概念学习

提示 该博客主要为个人学习&#xff0c;通过阅读官网手册整理而来&#xff08;个人觉得阅读官网的英文文档非常有助于理解各个IP特性&#xff09;。若有不对之处请参考参考文档&#xff0c;以官网文档为准。阅读该文章&#xff0c;可以先查看AArch64 Exception Model学习&…

消息队列-RockMQ-定时延时发送消息

定时延时发送消息 任务需要延迟一段时间再进行处理。 生产者 public class Producer {public static void main(String[] args) throws Exception {DefaultMQProducer producer new DefaultMQProducer("producer_group");producer.setNamesrvAddr("ip:9876&q…

【从零开始学技术】Fiddler 抓取 https 请求大全

1.Fiddler代理浏览器设置 注意浏览器代理区别 Chrome/IE浏览器使用的都是系统代理设置 在chrome浏览器的设置中搜索代理&#xff0c;可以看到 打开IE浏览器&#xff0c;选择设置->Internet选项 Firefox浏览器使用的是单独的一套代理系统 在Firefox的代理设置中&#xff0c;我…

hadoop自动获取时间

1、自动获取前15分钟 substr(from_unixtime(unix_timestamp(concat(substr(20240107100000,1,4),-,substr(20240107100000,5,2),-,substr(20240107100000,7,2), ,substr(20240107100000,9,2),:,substr(20240107100000,11,2),:,00))-15*60,yyyyMMddHHmmss),1) unix_timestam…

sentinel熔断简单实现

sentinel详细介绍网址 基于qps限流 package mainimport ("fmt"sentinel "github.com/alibaba/sentinel-golang/api""github.com/alibaba/sentinel-golang/core/base""github.com/alibaba/sentinel-golang/core/flow""log"…

CMake入门教程【核心篇】设置和使用缓存变量

😈「CSDN主页」:传送门 😈「Bilibil首页」:传送门 😈「动动你的小手」:点赞👍收藏⭐️评论📝 文章目录 概述设置缓存变量使用缓存变量更改缓存变量完整代码示例实战使用技巧注意事项总结与分析

STM32-04-STM32时钟树

STM32时钟树 什么是时钟&#xff1f; 时钟是具有周期性的脉冲信号&#xff0c;最常用的是占空比50%的方波。&#xff08;时钟是单片机的脉搏&#xff0c;搞懂时钟走向及关系&#xff0c;对单片机使用至关重要&#xff09;。 时钟树 时钟源 2个外部时钟源 高速外部振荡器(HSE…

Lava多模态大模型调试(基于vscode框架)

文章目录 前言一、整体概括二、launch.json文件配置三、调试展示前言 之前博客这里介绍LLava1.5多模态大模型的安装、训练、预测等。但对于你想查看源码或多或少都有些麻烦,也不利于代码调试。基于此,本文是一篇基于vscode框架调试llava大模型的教程。 一、整体概括 我是在…

再谈前端算法

楔子 – 青蛙跳台阶什么是算法算法实例 &#xff1a; 实现一个LRU缓存 实现 LRUCache扩展&#xff1a; ES6 Map Map的创建和初始化&#xff1a;添加键值对&#xff1a;获取键值对&#xff1a;检查Map中是否存在某个键&#xff1a;删除键值对&#xff1a;遍历Map&#xff1a;获取…

MulticoreWare与Imagination一同按下汽车计算工作负载的“加速键”

中国北京 – 2024年1月8日 - MulticoreWare Inc与Imagination Technologies共同宣布已在德州仪器TDA4VM处理器上实现了GPU计算&#xff0c;不仅使算力提升了约50 GFLOPS&#xff0c;而且还实现了自动驾驶和高级驾驶辅助系统&#xff08;ADAS&#xff09;常见工作负载性能的跃升…

环境变量的使用

1.用法 1.建立文件夹.env.production&#xff08;开发&#xff09;.env.development(生产) 代码: NODE_ENVdevelopment VUE_APP_BASE_APIwww.aaa.comNODE_ENVproduction VUE_APP_BASE_APIwww.xxx.com 注意: 环境变量的文件夹应该是和src目录同级的: 2.获取 process.env.V…

php环境搭建

PHP环境搭建 1.软件下载及安装 php网址&#xff1a;php.net vscode网址&#xff1a;https://code.visualstudio.com/ 百度网盘&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/1kx_Z-2dz3kGozDcynW7C_Q 提取码&#xff1a;1234 PHP&#xff1a; PHP安装 解压到指定…

无线与局域网技术期末划题自制答案

简答题 1.描述5G的三大应用场景&#xff1f; 5G的三大应用场景包括增强型移动宽带&#xff08;eMBB&#xff09;、超可靠低延迟通信&#xff08;URLLC&#xff09;和大规模机器类型通信&#xff08;mMTC&#xff09;。增强型移动宽带&#xff08;eMBB&#xff09;主要用于支持…