Skip to content

Commit acf5acb

Browse files
committed
docs: update README.md
1 parent c1156b2 commit acf5acb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ fs.cosn.bucket.endpoint_suffix: cos.ap-guangzhou.myqcloud.com
8686
4.在作业的 write 或 sink 路径中填写格式为:```cosn://bucket-appid/path```的路径信息即可,例如:
8787

8888
```java
89-
...
89+
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
90+
// 采用 Streaming File Sink 写入的话,必须启用 checkpoint,这里使用 COS 作为 StateBackend 举例子,也可以使用其他 checkpoint storage。
91+
env.setStateBackend(new FsStateBackend("cosn://bucket-name-125xxxxxx/checkpoint"));
92+
env.enableCheckpointing(1000);
93+
// 构造 Streaming File Sink 写入
9094
StreamingFileSink<String> streamingFileSink =
9195
StreamingFileSink.forRowFormat(
9296
new Path(outputPath), new SimpleStringEncoder<String>("UTF-8"))
@@ -100,6 +104,8 @@ fs.cosn.bucket.endpoint_suffix: cos.ap-guangzhou.myqcloud.com
100104
...
101105
```
102106

107+
⚠️**注意**:如果使用 Streaming File Sink 方式写入,需要同时启用 Flink 的 checkpoint,否则写入的数据始终处于 inprogress 不可见状态,无法被读取。
108+
103109
### 使用示例
104110

105111
以下给出 Flink Job 读写 COS 的示例代码:

0 commit comments

Comments
 (0)