RedisTimeSeriesによる時系列データ
RedisTimeSeriesモジュールを使い、保持期間、圧縮、集計を設定してメトリクスを効率的に保存、ダウンサンプリング、クエリします。
「RedisTimeSeriesによる時系列データ」はCoddyKit上の無料Redis Caching & Messaging (Pub/Sub, Streams)レッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはRedis Caching & Messaging (Pub/Sub, Streams)学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Redis Caching & Messaging (Pub/Sub, Streams)コースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Why a Time Series Module?
Storing metrics (CPU, temperature, request counts) as plain keys wastes memory and makes range queries awkward. RedisTimeSeries is a module purpose-built for timestamped numeric data, with compression, retention, and downsampling.
Creating a Series
TS.CREATE makes a new series. You can set retention (how long to keep samples) and labels for filtering.
TS.CREATE sensor:temp RETENTION 86400000 LABELS room kitchenAdding Samples
TS.ADD appends a timestamped value. Use * for the current server time, or supply an explicit millisecond timestamp.
TS.ADD sensor:temp * 21.5
TS.ADD sensor:temp 1716900000000 22.0Auto-Creating on Add
If a series does not exist, TS.ADD can create it on the fly, optionally with retention and labels, which is handy for high-cardinality ingest.
TS.ADD sensor:hum * 55 RETENTION 3600000 LABELS room kitchenQuerying a Range
TS.RANGE returns samples between two timestamps. Use - and + for the minimum and maximum bounds.
TS.RANGE sensor:temp - +
TS.RANGE sensor:temp 1716900000000 1716903600000Aggregating Buckets
Add AGGREGATION to bucket and summarize samples, for example averaging into 60-second windows.
- Functions:
avg, min, max, sum, count
TS.RANGE sensor:temp - + AGGREGATION avg 60000Downsampling with Rules
A compaction rule automatically writes aggregated values from a source series into a lower-resolution destination, keeping long-term data cheap.
TS.CREATE sensor:temp:hourly
TS.CREATERULE sensor:temp sensor:temp:hourly AGGREGATION avg 3600000Querying Across Series
TS.MRANGE queries multiple series at once, filtered by labels, ideal for dashboards showing all sensors in a room.
TS.MRANGE - + FILTER room=kitchenRetention in Action
The RETENTION setting (in milliseconds) auto-expires old samples. Combine short retention on raw series with long retention on downsampled series for a tiered storage strategy.
TS.ALTER sensor:temp RETENTION 604800000Inspecting a Series
TS.INFO reports sample count, memory, retention, labels, and any compaction rules attached to a series.
TS.INFO sensor:tempWhere It Fits
RedisTimeSeries shines for monitoring, IoT telemetry, and real-time analytics where you need fast appends, range queries, and automatic downsampling without a separate time-series database.
Quick Check
Test your understanding of RedisTimeSeries.
Recap
You used RedisTimeSeries to create series with retention and labels, add samples, query ranges with aggregation, downsample via compaction rules, query many series with TS.MRANGE, and inspect them with TS.INFO. It is a compact way to handle metrics and telemetry inside Redis.
AI チューターと学ぶ Redis Caching & Messaging (Pub/Sub, Streams) — 無料
ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。
- コース
- 12
- レッスン
- 48
よくある質問
「RedisTimeSeriesによる時系列データ」レッスンは無料ですか?
はい。「RedisTimeSeriesによる時系列データ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Redis Caching & Messaging (Pub/Sub, Streams)コースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Redis Caching & Messaging (Pub/Sub, Streams)コースには全4レッスンが含まれています。
「RedisTimeSeriesによる時系列データ」で何を学びますか?
RedisTimeSeriesモジュールを使い、保持期間、圧縮、集計を設定してメトリクスを効率的に保存、ダウンサンプリング、クエリします。 ブラウザで直接実行するハンズオンコードでRedis Caching & Messaging (Pub/Sub, Streams)を演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Redis Caching & Messaging (Pub/Sub, Streams)を始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのRedis Caching & Messaging (Pub/Sub, Streams)は初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「RedisTimeSeriesによる時系列データ」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このRedis Caching & Messaging (Pub/Sub, Streams)レッスンでコードを書いて実行できますか?
はい。すべてのRedis Caching & Messaging (Pub/Sub, Streams)レッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Redis Modules の概要
- 全文検索のための RediSearch
- RedisJSON と RedisGraph の基礎
- RedisTimeSeriesによる時系列データ