From 803e902fe2cdb481a10db34ece3683e9e0f6e111 Mon Sep 17 00:00:00 2001 From: Jove Zhong Date: Wed, 16 Oct 2024 14:33:42 -0700 Subject: [PATCH] Update README and sample docker compose --- README.md | 18 ++++++++++-------- docker/compose/docker-compose.yml | 6 +++--- examples/carsharing/README.md | 17 ++++++++--------- examples/cdc/README.md | 2 +- examples/clickhouse/README.md | 2 +- examples/coinbase/README.md | 8 +++----- examples/ecommerce/README.md | 4 ++-- examples/fraud_detection/README.md | 3 +-- examples/grafana/README.md | 15 +++++++-------- examples/hackernews/README.md | 4 ++-- examples/jdbc/README.md | 6 +++--- 11 files changed, 41 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 5c0e7aafe1d..d9c369c8876 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ The [Docker Compose stack](https://github.com/timeplus-io/proton/tree/develop/ex ### Timeplus Cloud: -Don't want to setup by yourself? Try Timeplus Proton in [Cloud](https://us-west-2.timeplus.cloud/) +Don't want to setup by yourself? Try Timeplus in [Cloud](https://us-west-2.timeplus.cloud/) ### 🔎 Usage @@ -84,18 +84,19 @@ SQL is the main interface. You can start a new terminal window with `proton clie > [!NOTE] > You can also integrate Timeplus Proton with Python/Java/Go SDK, REST API, or BI plugins. Please check Integrations -In the `proton client`, you can write SQL to create [External Stream for Kafka](https://docs.timeplus.com/proton-kafka) or [External Table for ClickHouse](https://docs.timeplus.com/proton-clickhouse-external-table). You can also run the following SQL to create a stream of random data: +In the `proton client`, you can write SQL to create [External Stream for Kafka](https://docs.timeplus.com/proton-kafka) or [External Table for ClickHouse](https://docs.timeplus.com/proton-clickhouse-external-table). + +You can also run the following SQL to create a stream of random data: ```sql -- Create a stream with random data CREATE RANDOM STREAM devices( device string default 'device'||to_string(rand()%4), - temperature float default rand()%1000/10) -``` -```sql + temperature float default rand()%1000/10); + -- Run the streaming SQL SELECT device, count(*), min(temperature), max(temperature) -FROM devices GROUP BY device +FROM devices GROUP BY device; ``` You should see data like the following: @@ -119,8 +120,8 @@ What features are available with Timeplus Proton versus Timeplus Enterprise? | | **Timeplus Proton** | **Timeplus Enterprise** | | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Deployment** | | | -| **Data sources** | | | -| **Data destinations (sinks)** | | | +| **Data sources** | | | +| **Data destinations (sinks)** | | | | **Support** | | | ## 🧩 Integrations @@ -133,6 +134,7 @@ The following drivers are available: Integrations with other systems: * ClickHouse https://docs.timeplus.com/proton-clickhouse-external-table +* Docker and Testcontainers https://docs.timeplus.com/tutorial-testcontainers-java * Sling https://docs.timeplus.com/sling * Grafana https://github.com/timeplus-io/proton-grafana-source * Metabase https://github.com/timeplus-io/metabase-proton-driver diff --git a/docker/compose/docker-compose.yml b/docker/compose/docker-compose.yml index 893b612d284..4aa15e021af 100644 --- a/docker/compose/docker-compose.yml +++ b/docker/compose/docker-compose.yml @@ -2,7 +2,7 @@ version: "3" services: proton-server: - image: ghcr.io/timeplus-io/proton:latest + image: d.timeplus.com/timeplus-io/proton:latest pull_policy: always ports: - "8123:8123" # HTTP @@ -42,14 +42,14 @@ services: - redpanda - start - --smp - - '1' + - "1" - --memory - 1G - --reserve-memory - 0M - --overprovisioned - --node-id - - '0' + - "0" - --kafka-addr - PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 - --advertise-kafka-addr diff --git a/examples/carsharing/README.md b/examples/carsharing/README.md index e1efb0418f1..03add40751a 100644 --- a/examples/carsharing/README.md +++ b/examples/carsharing/README.md @@ -2,7 +2,7 @@ -This docker compose file demonstrates some typical query patterns that you can achieve in Proton to solve various use cases. +This docker compose file demonstrates some typical query patterns that you can achieve in Proton to solve various use cases. For more details, please check https://docs.timeplus.com/usecases @@ -12,7 +12,7 @@ For more details, please check https://docs.timeplus.com/usecases Simply run `docker compose up` in this folder. Two docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming database +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming database 2. timeplus/cardemo:latest, as the data generator ## Customer Scenario and Data Model @@ -76,19 +76,19 @@ Please check https://docs.timeplus.com/usecases for more sample queries. ```sql -- List live data -SELECT * FROM car_live_data; +SELECT * FROM car_live_data; -- Filter data -SELECT time,cid,gas_percent FROM car_live_data WHERE gas_percent < 25; +SELECT time,cid,gas_percent FROM car_live_data WHERE gas_percent < 25; -- Downsampling SELECT window_start,cid, avg(gas_percent) AS avg_gas_percent,avg(speed_kmh) AS avg_speed FROM -tumble(car_live_data,1m) GROUP BY window_start, cid; +tumble(car_live_data,1m) GROUP BY window_start, cid; -- Create materlized view CREATE MATERIALIZED VIEW car_live_data_1min as -SELECT window_start AS time,cid, avg(gas_percent) AS avg_gas,avg(speed_kmh) AS avg_speed -FROM tumble(car_live_data,1m) GROUP BY window_start, cid; +SELECT window_start AS time,cid, avg(gas_percent) AS avg_gas,avg(speed_kmh) AS avg_speed +FROM tumble(car_live_data,1m) GROUP BY window_start, cid; SELECT * FROM car_live_data_1min; -- Top K @@ -99,9 +99,8 @@ SELECT avg(gap) FROM ( SELECT date_diff('second', bookings.booking_time, trips.start_time) AS gap FROM bookings - INNER JOIN trips ON (bookings.bid = trips.bid) + INNER JOIN trips ON (bookings.bid = trips.bid) AND date_diff_within(2m, bookings.booking_time, trips.start_time) ) WHERE _tp_time >= now()-1d; ``` - diff --git a/examples/cdc/README.md b/examples/cdc/README.md index 3df0f1534f6..41befe9e70b 100644 --- a/examples/cdc/README.md +++ b/examples/cdc/README.md @@ -6,7 +6,7 @@ This docker compose file demonstrates how to capture live database change from a Simply run `docker compose up` in this folder. Five docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming database. +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming database. 2. docker.redpanda.com/redpandadata/redpanda, as the Kafka compatiable streaming message bus 3. docker.redpanda.com/redpandadata/console, as the web UI to explore data in Kafka/Redpanda 4. debezium/connect, as the CDC engine to read changes from OLTP and send data to Kafka/Redpanda diff --git a/examples/clickhouse/README.md b/examples/clickhouse/README.md index 504e9897746..72a99b845dc 100644 --- a/examples/clickhouse/README.md +++ b/examples/clickhouse/README.md @@ -8,7 +8,7 @@ A YouTube video tutorial is available for visual learners: https://youtu.be/ga_D Simply run `docker compose up` in this folder. Three docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming SQL engine. +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming SQL engine. 2. clickhouse/clickhouse-server:latest 3. quay.io/cloudhut/owl-shop:latest, as the data generator. [Owl Shop](https://github.com/cloudhut/owl-shop) is an imaginary ecommerce shop that simulates microservices exchanging data via Apache Kafka. 4. docker.redpanda.com/redpandadata/redpanda, as the Kafka compatiable streaming message bus diff --git a/examples/coinbase/README.md b/examples/coinbase/README.md index 9c3f7b61d61..6d7212808d4 100644 --- a/examples/coinbase/README.md +++ b/examples/coinbase/README.md @@ -2,7 +2,7 @@ -This docker compose file demonstrates how to ingest WebSocket data into Proton by using Benthos pipeline. +This docker compose file demonstrates how to ingest WebSocket data into Proton by using Benthos pipeline. @@ -10,7 +10,7 @@ This docker compose file demonstrates how to ingest WebSocket data into Proton b Simply run `docker compose up` in this folder. Three docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming database +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming database 2. jeffail/benthos:latest, a [Benthos](https://www.benthos.dev/) service as the data pipeline 3. init container, create the tickers stream when Proton database server is ready @@ -54,7 +54,7 @@ output: http_client: url: http://proton:8123/proton/v1/ingest/streams/tickers verb: POST - headers: + headers: Content-Type: application/json batching: count: 10 @@ -85,5 +85,3 @@ WHERE GROUP BY window_start, product_id ``` - - diff --git a/examples/ecommerce/README.md b/examples/ecommerce/README.md index 95563c38234..e34754a55a6 100644 --- a/examples/ecommerce/README.md +++ b/examples/ecommerce/README.md @@ -7,7 +7,7 @@ For more details, please check https://docs.timeplus.com/proton-kafka#tutorial ## Start the example Simply run `docker compose up` in this folder. Four docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming database. +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming database. 2. quay.io/cloudhut/owl-shop:latest, as the data generator. [Owl Shop](https://github.com/cloudhut/owl-shop) is an imaginary ecommerce shop that simulates microservices exchanging data via Apache Kafka. 3. docker.redpanda.com/redpandadata/redpanda, as the Kafka compatiable streaming message bus 4. docker.redpanda.com/redpandadata/console, as the web UI to explore data in Kafka/Redpanda @@ -20,7 +20,7 @@ Run the following commands: ```sql -- Create externarl stream to read data from Kafka/Redpanda CREATE EXTERNAL STREAM frontend_events(raw string) -SETTINGS type='kafka', +SETTINGS type='kafka', brokers='redpanda:9092', topic='owlshop-frontend-events'; diff --git a/examples/fraud_detection/README.md b/examples/fraud_detection/README.md index c635cc6e563..95c9cb43f91 100644 --- a/examples/fraud_detection/README.md +++ b/examples/fraud_detection/README.md @@ -5,7 +5,7 @@ This docker compose file demonstrates how to leverage proton to build a real-tim ## Start the example Simply run `docker compose up` in this folder. three docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming database. +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming database. 2. timeplus/fraud:latest, a online payment transaction data generator 3. jupyter/scipy-notebook:latest, jupyter notebook @@ -13,4 +13,3 @@ Simply run `docker compose up` in this folder. three docker containers in the st ## Run Notebook Visit `http://localhost:8888/notebooks/work/fraud_detection.ipynb` to access the notebook. And then just follow the code in the notebook step by step. - diff --git a/examples/grafana/README.md b/examples/grafana/README.md index 5e271516b03..a867209836a 100644 --- a/examples/grafana/README.md +++ b/examples/grafana/README.md @@ -8,7 +8,7 @@ A YouTube video tutorial is available for visual learners: https://www.youtube.c Simply run `docker compose up` in this folder. Three docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming SQL engine. Port 8463 and 3218 are exposed so that Grafana can connect to it. +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming SQL engine. Port 8463 and 3218 are exposed so that Grafana can connect to it. 2. timeplus/cardemo:latest, as the data generator 3. grafana/grafana:latest, with pre-configured Proton dashboard and a live dashboard @@ -20,19 +20,19 @@ Please check https://docs.timeplus.com/usecases for more sample queries. ```sql -- List live data -SELECT * FROM car_live_data; +SELECT * FROM car_live_data; -- Filter data -SELECT time,cid,gas_percent FROM car_live_data WHERE gas_percent < 25; +SELECT time,cid,gas_percent FROM car_live_data WHERE gas_percent < 25; -- Downsampling SELECT window_start,cid, avg(gas_percent) AS avg_gas_percent,avg(speed_kmh) AS avg_speed FROM -tumble(car_live_data,1m) GROUP BY window_start, cid; +tumble(car_live_data,1m) GROUP BY window_start, cid; -- Create materlized view CREATE MATERIALIZED VIEW car_live_data_1min as -SELECT window_start AS time,cid, avg(gas_percent) AS avg_gas,avg(speed_kmh) AS avg_speed -FROM tumble(car_live_data,1m) GROUP BY window_start, cid; +SELECT window_start AS time,cid, avg(gas_percent) AS avg_gas,avg(speed_kmh) AS avg_speed +FROM tumble(car_live_data,1m) GROUP BY window_start, cid; SELECT * FROM car_live_data_1min; -- Top K @@ -43,9 +43,8 @@ SELECT avg(gap) FROM ( SELECT date_diff('second', bookings.booking_time, trips.start_time) AS gap FROM bookings - INNER JOIN trips ON (bookings.bid = trips.bid) + INNER JOIN trips ON (bookings.bid = trips.bid) AND date_diff_within(2m, bookings.booking_time, trips.start_time) ) WHERE _tp_time >= now()-1d; ``` - diff --git a/examples/hackernews/README.md b/examples/hackernews/README.md index 086f9c05820..6adf242c34e 100644 --- a/examples/hackernews/README.md +++ b/examples/hackernews/README.md @@ -5,7 +5,7 @@ Inspired by https://bytewax.io/blog/polling-hacker-news, you can call Hacker New ## Start the example Simply run `docker compose up` in this folder and it will start -1. ghcr.io/timeplus-io/proton:latest, with pre-configured streams, materialized views and views. +1. d.timeplus.com/timeplus-io/proton:latest, with pre-configured streams, materialized views and views. 2. timeplus/hackernews_bytewax:latest, leveraging [bytewax](https://bytewax.io) to call Hacker News HTTP API with Bytewax and send latest news to Proton. [Source code](https://github.com/timeplus-io/proton-python-driver/tree/develop/example/bytewax) 3. A pre-configured Grafana instance to visulaize the live data. @@ -36,7 +36,7 @@ With all those streams and views, you can query the data in whatever ways, e.g. ```sql select * from comment; -select +select story._tp_time as story_time,comment._tp_time as comment_time, story.id as story_id, comment.id as comment_id, substring(story.title,1,20) as title,substring(comment.raw:text,1,20) as comment diff --git a/examples/jdbc/README.md b/examples/jdbc/README.md index a7d6dafd9cb..ac0b2fcf89a 100644 --- a/examples/jdbc/README.md +++ b/examples/jdbc/README.md @@ -6,7 +6,7 @@ This docker compose file demonstrates how to connect to Proton via JDBC driver. Simply run `docker compose up` in this folder. Two docker containers in the stack: -1. ghcr.io/timeplus-io/proton:latest, as the streaming database. Port 8123 is exposed so that JDBC driver can connect to it. +1. d.timeplus.com/timeplus-io/proton:latest, as the streaming database. Port 8123 is exposed so that JDBC driver can connect to it. 2. timeplus/cardemo:latest, as the data generator Please note port 8123 from the Proton container is exposed to the host. You need this port to connect to Proton via JDBC driver. @@ -55,7 +55,7 @@ public class App { } return count; } - } + } public static void main(String[] args) { String url = "jdbc:proton://localhost:8123"; String user = System.getProperty("user", "default"); @@ -85,7 +85,7 @@ First add the Proton JDBC driver to DBeaver. Taking DBeaver 23.2.3 as an example * Default User: default * Allow Empty Password -In the "Libaries" tab, click "Add Artifact" and type `com.timeplus:proton-jdbc:0.6.0`. Click the "Find Class" button to load the class. +In the "Libaries" tab, click "Add Artifact" and type `com.timeplus:proton-jdbc:0.6.0`. Click the "Find Class" button to load the class. Create a new database connection, choose "Timeplus Proton" and accept the default settings. Click the "Test Connection.." to verify the connection is okay.