Streams Management
The rekuiper stream command-line interface manages stream definitions. You can create, describe, list, drop, and query streams.
Create a Stream
Use this command to create a new stream. For syntax details, refer to Streams.
create stream $stream_name '$stream_def' | create stream -f $stream_def_fileSpecify the Stream Definition on the Command Line
Example command:
# bin/kuiper create stream my_stream '(id bigint, name string, score float) WITH ( datasource = "topic/temperature", FORMAT = "json", KEY = "id")'
stream my_stream createdThis command creates a stream named my_stream.
Specify the Stream Definition in a File
Use the -f flag to load complex stream definitions from a text file:
# bin/kuiper create stream -f /tmp/my_stream.txt
stream my_stream createdThe file /tmp/my_stream.txt contains:
my_stream(id bigint, name string, score float)
WITH ( datasource = "topic/temperature", FORMAT = "json", KEY = "id");Show Streams
Use this command to display all streams defined in the server:
show streamsExample command:
# bin/kuiper show streams
my_streamDescribe a Stream
Use this command to display the schema and configuration options of a stream:
describe stream $stream_name | describe stream $stream_name -jsonExample standard output:
# bin/kuiper describe stream my_stream
Fields
--------------------------------------------------------------------------------
id bigint
name string
score float
FORMAT: json
KEY: id
DATASOURCE: topic/temperatureUse the -json option to format the output as JSON:
# bin/kuiper describe stream my_stream -json
'{
"Fields": [
{
"Name": "id",
"Type": "bigint"
},
{
"Name": "name",
"Type": "string"
},
{
"Name": "score",
"Type": "float"
}
],
"Options": {
"DATASOURCE:": "topic/temperature",
"FORMAT:": "json",
"KEY:": "id"
}
}'Drop a Stream
Use this command to delete a stream definition:
drop stream $stream_nameExample command:
# bin/kuiper drop stream my_stream
stream my_stream droppedQuery Against Streams
Use this command to run interactive SQL queries against streams from the console:
queryExample interactive session:
# bin/kuiper query
kuiper >After the kuiper > prompt displays, enter an SQL statement (refer to rekuiper SQL Reference) and press Enter.
The CLI displays the results in the terminal:
kuiper > SELECT * FROM my_stream WHERE id > 10;
[{"...":"..." ....}]
...- Press
CTRL + Cto terminate the active query. - Enter
quitorexitto exit the interactive prompt console.