Jelajahi Sumber

fix(doc): fix problems of CLI and REST API port (#803)

1. cli create stream/rule json string must be quoted
2. REST samples, default port must be 9081
ngjaying 3 tahun lalu
induk
melakukan
7e6a6a028a

+ 3 - 3
docs/en_US/cli/rules.md

@@ -7,17 +7,17 @@ The Kuiper rule command line tools allows you to manage rules, such as create, s
 The command is used for creating a rule.  The rule's definition is specified with JSON format, read [rule](../rules/overview.md) for more detailed information.
 
 ```shell
-create rule $rule_name $rule_json | create rule $rule_name -f $rule_def_file
+create rule $rule_name '$rule_json' | create rule $rule_name -f $rule_def_file
 ```
 
 The rule can be created with two ways. 
 
-- Specify the rule definition in command line.
+- Specify the rule definition in command line. Notice that, the json string must be quoted.
 
 Sample:
 
 ```shell
-# bin/kuiper create rule rule1 {"sql": "SELECT * from demo","actions": [{"log":  {}},{"mqtt":  {"server":"tcp://127.0.0.1:1883", "topic":"demoSink"}}]}
+# bin/kuiper 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``. 

+ 2 - 2
docs/en_US/cli/streams.md

@@ -7,7 +7,7 @@ The Kuiper stream command line tools allows you to manage the streams, such as c
 The command is used for creating a stream. For more detailed information of stream definition, please refer to [streams](../sqls/streams.md).
 
 ```shell
-create stream $stream_name $stream_def | create stream -f $stream_def_file
+create stream $stream_name '$stream_def' | create stream -f $stream_def_file
 ```
 
 - Specify the stream definition in command line.
@@ -15,7 +15,7 @@ create stream $stream_name $stream_def | create stream -f $stream_def_file
 Sample:
 
 ```shell
-# bin/kuiper create stream my_stream '(id bigint, name string, score float) WITH ( datasource = "topic/temperature", FORMAT = "json", KEY = "id");'
+# bin/kuiper create stream my_stream '(id bigint, name string, score float) WITH ( datasource = "topic/temperature", FORMAT = "json", KEY = "id")'
 stream my_stream created
 ```
 

+ 4 - 4
docs/en_US/restapi/plugins.md

@@ -121,13 +121,13 @@ Response Sample:
 The API is used for drop the plugin. The kuiper server needs to be restarted to take effect.
 
 ```shell
-DELETE http://localhost:8080/plugins/sources/{name}
-DELETE http://localhost:8080/plugins/sinks/{name}
-DELETE http://localhost:8080/plugins/functions/{name}
+DELETE http://localhost:9081/plugins/sources/{name}
+DELETE http://localhost:9081/plugins/sinks/{name}
+DELETE http://localhost:9081/plugins/functions/{name}
 ```
 The user can pass a query parameter to decide if Kuiper should be stopped after a delete in order to make the deletion take effect. The parameter is `restart` and only when the value is `1` will the Kuiper be stopped. The user has to manually restart it.
 ```shell
-DELETE http://localhost:8080/plugins/sources/{name}?restart=1
+DELETE http://localhost:9081/plugins/sources/{name}?restart=1
 ```
 
 ## APIs to handle function plugin with multiple functions

+ 7 - 7
docs/en_US/restapi/rules.md

@@ -78,7 +78,7 @@ Response Sample:
 The API accepts a JSON content and update a rule.
 
 ```shell
-PUT http://localhost:8080/rules/{id}
+PUT http://localhost:9081/rules/{id}
 ```
 
 Path parameter `id` is the id or name of the old rule.
@@ -100,7 +100,7 @@ Request Sample
 The API is used for drop the rule.
 
 ```shell
-DELETE http://localhost:8080/rules/{id}
+DELETE http://localhost:9081/rules/{id}
 ```
 
 
@@ -109,7 +109,7 @@ DELETE http://localhost:8080/rules/{id}
 The API is used to start running the rule.
 
 ```shell
-POST http://localhost:8080/rules/{id}/start
+POST http://localhost:9081/rules/{id}/start
 ```
 
 
@@ -118,7 +118,7 @@ POST http://localhost:8080/rules/{id}/start
 The API is used to stop running the rule.
 
 ```shell
-POST http://localhost:8080/rules/{id}/stop
+POST http://localhost:9081/rules/{id}/stop
 ```
 
 ## restart a rule
@@ -126,7 +126,7 @@ POST http://localhost:8080/rules/{id}/stop
 The API is used to restart the rule.
 
 ```shell
-POST http://localhost:8080/rules/{id}/restart
+POST http://localhost:9081/rules/{id}/restart
 ```
 
 ## get the status of a rule
@@ -136,7 +136,7 @@ The command is used to get the status of the rule. If the rule is running, the m
 - stopped: $reason
 
 ```shell
-GET http://localhost:8080/rules/{id}/status
+GET http://localhost:9081/rules/{id}/status
 ```
 
 Response Sample:
@@ -168,7 +168,7 @@ The command is used to get the status of the rule represented as a json string.
 - edges: it is a hash map of all edges categorized by nodes. The keys are the starting point of an edge. And the value is a collection of ending point.
 
 ```shell
-GET http://localhost:8080/rules/{id}/topo
+GET http://localhost:9081/rules/{id}/topo
 ```
 
 Response Sample:

+ 1 - 1
docs/en_US/restapi/services.md

@@ -64,7 +64,7 @@ The path parameter `name` is the name of the external service.
 This API is used to delete external services, and all functions defined under the service will be deleted.
 
 ```shell
-DELETE http://localhost:8080/services/{name}
+DELETE http://localhost:9081/services/{name}
 ```
 
 ## Update external services

+ 1 - 1
docs/en_US/streams.md

@@ -158,7 +158,7 @@ Run `kuiper stream` command, after `kuiper >` prompt shown, enter stream related
 
 ```bash
 cli stream
-kuiper > CREATE STREAM sname (count bigint) WITH (source="users", FORMAT="AVRO", KEY="USERID")
+kuiper > CREATE STREAM sname '(count bigint) WITH (source="users", FORMAT="AVRO", KEY="USERID")'
 kuiper > DESCRIBE STREAM sname
 ...
 ```

+ 3 - 3
docs/zh_CN/cli/rules.md

@@ -7,17 +7,17 @@ Kuiper 规则命令行工具可以管理规则,例如创建、显示、删除
 如下命令用于创建规则。 规则的定义以 JSON 格式指定,请阅读 [规则](../rules/overview.md) 以获取更多详细信息。
 
 ```shell
-create rule $rule_name $rule_json | create rule $rule_name -f $rule_def_file
+create rule $rule_name '$rule_json' | create rule $rule_name -f $rule_def_file
 ```
 
 可以通过两种方式创建规则。
 
-- 在命令行中指定规则定义。
+- 在命令行中指定规则定义。注意规则 json 明文必须放在引号里。
 
 示例:
 
 ```shell
-# bin/kuiper create rule rule1 {"sql": "SELECT * from demo","actions": [{"log":  {}},{"mqtt":  {"server":"tcp://127.0.0.1:1883", "topic":"demoSink"}}]}
+# bin/kuiper create rule rule1 '{"sql": "SELECT * from demo","actions": [{"log":  {}},{"mqtt":  {"server":"tcp://127.0.0.1:1883", "topic":"demoSink"}}]}'
 ```
 
 该命令创建一个名为 `rule1` 的规则。

+ 2 - 2
docs/zh_CN/cli/streams.md

@@ -7,7 +7,7 @@ Kuiper 流命令行工具可用于管理流,例如创建、描述、显示和
 该命令用于创建流。有关流定义的更多详细信息,请参考[流](../sqls/streams.md)。
 
 ```shell
-create stream $stream_name $stream_def | create stream -f $stream_def_file
+create stream $stream_name '$stream_def' | create stream -f $stream_def_file
 ```
 
 - 在命令行中指定流定义。
@@ -15,7 +15,7 @@ create stream $stream_name $stream_def | create stream -f $stream_def_file
 示例:
 
 ```shell
-# bin/kuiper create stream my_stream '(id bigint, name string, score float) WITH ( datasource = "topic/temperature", FORMAT = "json", KEY = "id");'
+# bin/kuiper create stream my_stream '(id bigint, name string, score float) WITH ( datasource = "topic/temperature", FORMAT = "json", KEY = "id")'
 stream my_stream created
 ```
 

+ 4 - 4
docs/zh_CN/restapi/plugins.md

@@ -122,14 +122,14 @@ GET http://localhost:9081/plugins/functions/{name}
 该 API 用于删除插件。 需要重启 kuiper 服务器才能生效。
 
 ```shell
-DELETE http://localhost:8080/plugins/sources/{name}
-DELETE http://localhost:8080/plugins/sinks/{name}
-DELETE http://localhost:8080/plugins/functions/{name}
+DELETE http://localhost:9081/plugins/sources/{name}
+DELETE http://localhost:9081/plugins/sinks/{name}
+DELETE http://localhost:9081/plugins/functions/{name}
 ```
 用户可以传递查询参数来决定是否应在删除后停止 Kuiper,以使删除生效。 参数是`restart`,只有当值是1时,Kuiper 才停止。 用户必须手动重新启动它。
 
 ```shell
-DELETE http://localhost:8080/plugins/sources/{name}?restart=1
+DELETE http://localhost:9081/plugins/sources/{name}?restart=1
 ```
 
 ## 用于导出多函数的函数插件的相关 API

+ 6 - 6
docs/zh_CN/restapi/rules.md

@@ -78,7 +78,7 @@ GET http://localhost:9081/rules/{id}
 该 API 接受 JSON 内容并更新规则。
 
 ```shell
-PUT http://localhost:8080/rules/{id}
+PUT http://localhost:9081/rules/{id}
 ```
 
 路径参数  `id` 是原有规则的 id 或名称。
@@ -100,7 +100,7 @@ PUT http://localhost:8080/rules/{id}
 该 API 用于删除规则。
 
 ```shell
-DELETE http://localhost:8080/rules/{id}
+DELETE http://localhost:9081/rules/{id}
 ```
 
 ## 启动规则
@@ -108,7 +108,7 @@ DELETE http://localhost:8080/rules/{id}
 该 API 用于开始运行规则。
 
 ```shell
-POST http://localhost:8080/rules/{id}/start
+POST http://localhost:9081/rules/{id}/start
 ```
 
 
@@ -117,7 +117,7 @@ POST http://localhost:8080/rules/{id}/start
 该 API 用于停止运行规则。
 
 ```shell
-POST http://localhost:8080/rules/{id}/stop
+POST http://localhost:9081/rules/{id}/stop
 ```
 
 ## 重启规则
@@ -125,7 +125,7 @@ POST http://localhost:8080/rules/{id}/stop
 该 API 用于重启规则。
 
 ```shell
-POST http://localhost:8080/rules/{id}/restart
+POST http://localhost:9081/rules/{id}/restart
 ```
 
 ## 获取规则的状态
@@ -136,7 +136,7 @@ POST http://localhost:8080/rules/{id}/restart
 - 停止: $reason
 
 ```shell
-GET http://localhost:8080/rules/{id}/status
+GET http://localhost:9081/rules/{id}/status
 ```
 
 响应示例:

+ 1 - 1
docs/zh_CN/restapi/services.md

@@ -64,7 +64,7 @@ GET http://localhost:9081/services/{name}
 该 API 用于删除外部服务,服务之下定义的所有函数都将被删除。
 
 ```shell
-DELETE http://localhost:8080/services/{name}
+DELETE http://localhost:9081/services/{name}
 ```
 
 ## 更新外部服务

+ 1 - 1
docs/zh_CN/streams.md

@@ -158,7 +158,7 @@ my_stream, iot_stream
 
 ```bash
 cli stream
-kuiper > CREATE STREAM sname (count bigint) WITH (source="users", FORMAT="AVRO", KEY="USERID")
+kuiper > CREATE STREAM 'sname (count bigint) WITH (source="users", FORMAT="AVRO", KEY="USERID")'
 kuiper > DESCRIBE STREAM sname
 ...
 ```