鼎鼎知识库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2021胶州开启时序数据库.md 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. - 准备好接收时序数据库的邮箱
  2. ```
  3. https://exmail.qq.com/login
  4. darren@ddingsafe.com
  5. TecheDing2019
  6. ```
  7. - 安装时序数据库
  8. ```
  9. --登录网址:https://www.taosdata.com/cn/getting-started/
  10. --下载deb包
  11. --确认安装位置:/home/dingding/下载/
  12. --在下载位置打开命令行终端
  13. --开始安装:sudo dpkg -i TDengine-server-2.0.13.0-Linux-x64.deb
  14. --检查状态:sudo systemctl status taosd
  15. --启动:sudo systemctl start taosd
  16. ```
  17. - 来到配置文件,查看配置:etc/taos/taos.cfg
  18. ```
  19. 时序数据库API地址:http://127.0.0.1:6020/rest/sql
  20. 时序数据库用户名:root
  21. 时序数据库密码:taosdata
  22. 时序数据库名称:rlq_jiaozhou_10_12(集团编号_项目编号)
  23. ```
  24. - 小试
  25. ```
  26. create database db;
  27. show databases;
  28. use db;
  29. create table t(ts timestamp, cdata int);
  30. insert into t values ('2019-07-15 00:00:00');
  31. select * from t;
  32. ```
  33. - 应用程序配置连接字符串
  34. ```
  35. "cloudgo": "0", //云端关系数据库是否开通
  36. "shixugo": "1", //云端时序数据库是否开通
  37. "groupid": "10", //集团编号
  38. "projectid": "12", //集团项目编号
  39. "TDegnine": {
  40. "DataSource": "http://127.0.0.1:6041/rest/sql",
  41. "Username": "root",
  42. "Password": "taosdata",
  43. "Database": "rlq_jiaozhou_10_12",
  44. "PlanInterval": 5000,
  45. "CDataSource": "http://47.102.145.164:6020/rest/sql",
  46. "CUsername": "root",
  47. "CPassword": "taosdata",
  48. "CDatabase": "rlq_huaian_7_10"
  49. },
  50. ```
  51. - 局域网时序数据库的原理
  52. ```
  53. --RealDataToTDengine,每5分钟运行一次
  54. --时序数据库
  55. --时序超级表
  56. --时序子表
  57. ```
  58. - 修改RealDataToTDengine,只支持本地数据库
  59. - 修改批量创建子表:ShiXuChild
  60. - 修改创建超级表:SuperTable
  61. - 开始实施
  62. ```
  63. --更新程序
  64. --更新设置,除了shixugo之外的先更新
  65. "cloudgo": "0", //云端关系数据库是否开通
  66. "shixugo": "0", //云端时序数据库是否开通
  67. "groupid": "10", //集团编号
  68. "projectid": "12", //集团项目编号
  69. "TDegnine": {
  70. "DataSource": "http://127.0.0.1:6041/rest/sql",
  71. "Username": "root",
  72. "Password": "taosdata",
  73. "Database": "rlq_jiaozhou_10_12",
  74. "PlanInterval": 5000,
  75. "CDataSource": "http://47.102.145.164:6020/rest/sql",
  76. "CUsername": "root",
  77. "CPassword": "taosdata",
  78. "CDatabase": "rlq_huaian_7_10"
  79. },
  80. -- 启动程序:dotnet DD.Local.Web.dll
  81. -- 创建数据库:create database rlq_jiaozhou_10_12 KEEP 365;
  82. -- 创建超级表
  83. -- 确定超级表是否存在:show stables;
  84. -- 创建所有SuperReal的子表
  85. -- 确认子表是否创建:describe real_187ed532492c;
  86. -- 开启本地时序
  87. "cloudgo": "0", //云端关系数据库是否开通
  88. "shixugo": "1", //云端时序数据库是否开通
  89. -- 开启程序
  90. -- 验证是否成功
  91. 日志:上传实时时序数据第{i}
  92. 187ED532492C,187ED5329AEC,187ED53218F4,187ED53297F0,187ED53298B0,187ED5328B40,187ED5329A0C,187ED53287F8,187ED5324FAC,187ED5329C44上传实时时序数据第0次成功
  93. select * from real_187ed532492c where ts > now - 1d;
  94. select * from real_187ed5329aec where ts > now - 1d;
  95. select * from real_187ed53218f4 where ts > now - 1d;
  96. select * from real_187ed53297f0 where ts > now - 1d;
  97. select * from real_187ed53298b0 where ts > now - 1d;
  98. select * from real_187ed5328b40 where ts > now - 1d;
  99. select * from real_187ed5329a0c where ts > now - 1d;
  100. select * from real_187ed53287f8 where ts > now - 1d;
  101. select * from real_187ed5324fac where ts > now - 1d;
  102. select * from real_187ed5329c44 where ts > now - 1d;
  103. ```