2016-11-14 105 views

回答

0

在您的終端上使用此命令。

nc -lk 9999 

這將是這樣的:

# TERMINAL 1: 
# Running Netcat 

$ nc -lk 9999 
apache spark 
apache hadoop 

輸出將是:

------------------------------------------- 
Batch: 0 
------------------------------------------- 
+------+-----+ 
| value|count| 
+------+-----+ 
|apache| 1| 
| spark| 1| 
+------+-----+ 

------------------------------------------- 
Batch: 1 
------------------------------------------- 
+------+-----+ 
| value|count| 
+------+-----+ 
|apache| 2| 
| spark| 1| 
|hadoop| 1| 
+------+-----+ 
... 

並據此查看輸出。

其更好地記錄在這裏:https://home.apache.org/~pwendell/spark-nightly/spark-branch-2.0-docs/latest/structured-streaming-programming-guide.html#quick-example