The Kuiper rule command line tools allows you to manage rules, such as create, show, drop, describe, start, stop and restart rules.
The command is used for creating a rule. The rule's definition is specified with JSON format, read rule for more detailed information.
create rule $rule_name $rule_json | create rule $rule_name -f $rule_def_file
The rule can be created with two ways.
Sample:
# bin/cli create rule rule1 {"sql": "SELECT * from demo","actions": [{"log": {}},{"mqtt": {"server":"tcp://127.0.0.1:1883", "topic":"demoSink"}}]}
The command create a rule named rule1
.
-f
option.Sample:
# bin/cli create rule rule1 -f /tmp/rule.txt
Below is the contents of rule.txt
.
{
"sql": "SELECT * from demo",
"actions": [
{
"log": {}
},
{
"mqtt": {
"server": "tcp://127.0.0.1:1883",
"topic": "demoSink"
}
}
]
}
The command is used for displaying all of rules defined in the server.
show rules
Sample:
# bin/cli show rules
rule1
rule2
The command is used for print the detailed definition of rule.
describe rule $rule_name
Sample:
# bin/cli describe rule rule1
{
"sql": "SELECT * from demo",
"actions": [
{
"log": {}
},
{
"mqtt": {
"server": "tcp://127.0.0.1:1883",
"topic": "demoSink"
}
}
]
}
The command is used for drop the rule.
drop rule $rule_name
Sample:
# bin/cli drop rule rule1
rule rule1 dropped
The command is used to start running the rule.
start rule $rule_name
Sample:
# bin/cli start rule rule1
rule rule1 started
The command is used to stop running the rule.
stop rule $rule_name
Sample:
# bin/cli stop rule rule1
rule rule1 stopped
The command is used to restart the rule.
restart rule $rule_name
Sample:
# bin/cli restart rule rule1
rule rule1 restarted
The command is used to get the status of the rule. The status can be
getstatus rule $rule_name
Sample:
# bin/cli getstatus rule rule1
running