实时计算与存储
haproxy
滑动窗口计数与滑动窗口去重计数。当前处理时间,不可设置事件时间,性能最高.
redis-stack-server
RedisTimeSeries
Latest posts on Redistimeseries
Exploring RedisTimeSeries
数据查询与数据聚合
支持以下聚合函数: avg, sum, min, max, range, count, first, last, std.p, std.s, var.p, var.s, twa
How to Use TS.RANGE in Redis Time Series for Time Range Queries
删除数据
- 删除数据点 (
TS.DEL) 使用TS.DEL命令去删除指定时间( Unix millisecond timestamp range)的数据.
- Syntax:
TS.DEL key fromTimestamp toTimestamp - Examples:
- Delete a range:
TS.DEL sensor:temp 1600000000000 1600000100000(Removes points between these timestamps). - Delete a single point:
TS.DEL sensor:temp 1600000000000 1600000000000(Use the same timestamp for both start and end). - Delete everything in the series:
TS.DEL sensor:temp - +(The-and+symbols represent the earliest and latest possible timestamps).
- Delete a range:
- 删除整个时间序列(
DEL)
删除时间序列,像删除redis的一个键一样: Redis DEL command.
- Syntax:
DEL key - Example:
DEL sensor:temp
- 设置数据保留策略自动删除
最佳方案是给时序数据设置保留策略(retention policy), 这样可以自动删除过期数据.
- At creation:
TS.CREATE sensor:temp RETENTION 604800000(Deletes data older than 7 days). - Update existing series:
TS.ALTER sensor:temp RETENTION 86400000(Changes retention to 24 hours). [1]