# Ruleset Management
The eKuiper rule command line tools allows to import and export all the stream and rule configurations.
# Ruleset Format
The file format for importing and exporting ruleset is JSON, which can contain three parts: streams
, tables
and rules
. Each type holds the the key-value pair of the name and the creation statement. In the following example file, we define a stream and two rules.
{
"streams": {
"demo": "CREATE STREAM demo () WITH (DATASOURCE=\"users\", FORMAT=\"JSON\")"
},
"tables": {},
"rules": {
"rule1": "{\"id\": \"rule1\",\"sql\": \"SELECT * FROM demo\",\"actions\": [{\"log\": {}}]}",
"rule2": "{\"id\": \"rule2\",\"sql\": \"SELECT * FROM demo\",\"actions\": [{ \"log\": {}}]}"
}
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# Import Ruleset
This command accepts the ruleset and imports it into the system. If a stream or rule in the ruleset already exists, it is not created. The imported rules are started immediately. The command returns text about the number of streams and rules created
# bin/kuiper import ruleset -f myrules.json
1
# Export Ruleset
This command exports the ruleset to the specified file. The command returns text about the number of streams and rules exported.
# bin/kuiper export ruleset myrules.json
1
What’s on this page