Run This Ai
EN DE

How to Deploy RisingWave with Docker: A Streaming SQL Tutorial

Learn to run RisingWave in Docker, create Kafka-backed streams, and query continuously updated materialized views in ten minutes — the pattern behind real-time AI agents.

In this hands-on tutorial you will deploy RisingWave with Docker, create a streaming source, and query a continuously updated materialized view — the exact pattern that powers real-time AI agents. It takes about ten minutes.

🚀 Want to deploy RisingWave yourself?

Docker configs, system requirements, and installation guides — all on one page.

View RisingWave Tool Page →

Step 1: Pull and run the container

RisingWave publishes an official image on Docker Hub. Start a single-node instance with:

docker run -d --name risingwave \
  -p 4566:4566 -p 8080:8080 \
  risingwavelabs/risingwave:latest

Port 4566 serves the Postgres-compatible SQL endpoint; 8080 exposes the web dashboard. Give the container a few seconds to boot, then verify with docker logs risingwave.

Step 2: Connect with psql

Because RisingWave speaks the Postgres wire protocol, any Postgres client works. From your host:

psql -h localhost -p 4566 -d dev -U root

You are now inside a streaming SQL engine. No Kafka, no Flink cluster, no YAML topology — just SQL.

Step 3: Create a stream and a materialized view

Create a source over a Kafka topic of user events:

CREATE SOURCE user_events (
  user_id INT, event_type VARCHAR, amount DOUBLE
) WITH (
  connector = 'kafka',
  topic = 'user-events',
  properties.bootstrap.server = 'kafka:9092',
  scan.startup.mode = 'earliest'
) FORMAT PLAIN ENCODE JSON;

Now the magic: a materialized view that stays fresh as events arrive — no manual refreshes ever.

CREATE MATERIALIZED VIEW per_user_totals AS
  SELECT user_id,
         SUM(amount) AS total,
         COUNT(*)    AS events
  FROM user_events
  GROUP BY user_id;

Step 4: Query like a normal table

SELECT * FROM per_user_totals ORDER BY total DESC LIMIT 10;

Every query returns results computed over all events that have arrived so far, with sub-second freshness. Point your AI agent at this view and it will always act on the latest state.

⚠️ Note: For a laptop test you can replace Kafka with a datagen connector to generate mock events — perfect for validating your agent before production.

Wrap-up

You have just built a real-time streaming pipeline with two SQL statements and one container. RisingWave's official image is the fastest route to streaming for AI; the tool page below collects the exact docker-compose file, resource requirements, and links to the full documentation.

🚀 Streaming in production?

Get the production Docker setup and sizing guidance on the tool page.

View RisingWave Tool Page →
#risingwave #docker #tutorial #streaming #sql