lyan094 2019-04-17 17:03:43 浏览 110 评论 0
架构
监控
TableStore
Image
表格存储
存储
数据存储
TSDB
时序
Timestream
时间线
摘要: 引言 随着近几年物联网的发展, 时序数据迎来了一个不小的爆发. 为了存储这些时序数据, 各大企业纷纷推出自己的时序数据库. Tablestore 作为阿里云自研的 NoSQL 多模型数据库, 能够提供海量结构化数据存储以及快速的查询和分析服务, 其在存储模型, 数据规模以及写入和查询能力上, 都能很好的满足时序数据的场景, 另外已经支持很多时序类业务, 例如监控类的云监控, 事件类的阿里健康药品追踪以及快递包裹轨迹等.
随着近几年物联网的发展, 时序数据迎来了一个不小的爆发. 为了存储这些时序数据, 各大企业纷纷推出自己的时序数据库.
Tablestore 作为阿里云自研的 NoSQL 多模型数据库, 能够提供海量结构化数据存储以及快速的查询和分析服务, 其在存储模型, 数据规模以及写入和查询能力上, 都能很好的满足时序数据的场景, 另外已经支持很多时序类业务, 例如监控类的云监控, 事件类的阿里健康药品追踪以及快递包裹轨迹等.
为了让用户能够更加专注于业务开发, 我们提供了 Timestream 时序模型, 其适用于监控, 金融, 轨迹溯源等时序业务场景.
时序数据简介
- AsyncClient asyncClient = new AsyncClient(endpoint, accessKeyId, accessKeySecret, instance);
- TimestreamDBConfiguration conf = new TimestreamDBConfiguration(metaTableName);
- TimestreamDB db = new TimestreamDBClient(asyncClient, conf);
- db.createMetaTable();
- db.createDataTable(dataTableName);
- TimestreamIdentifier identifier = new TimestreamIdentifier.Builder("cpu").build();
- Point point = new Point.Builder(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
- .addField("a1", 1)
- .build();
- // 写时序数据
- TimestreamDataTable dataTable = db.dataTable(dataTableName);
- dataTable.asyncWrite(identifier, point);
- // 查时序数据
- Iterator<Point> iter = dataTable.get(identifier)
- .timeRange(TimeRange.range(0, 10000, TimeUnit.MILLISECONDS)) // 查询 [0, 10000) 范围内的数据
- .fetchAll();
- // 写时间线元数据
- TimestreamMeta meta = new TimestreamMeta(identifier)
- .addAttribute("a1", "");
- TimestreamMetaTable metaTable = db.metaTable();
- metaWriter.put(meta);
- // 查时间线元数据
- TimestreamMeta meta = metaTable.get(identifier).fetch();
来源: https://yq.aliyun.com/articles/698650