mirror of https://github.com/apache/kafka.git
MINOR: Fix code listings in quickstart.html (#10767)
* MINOR: Fix code listings in quickstart Uses the right syntax highlighting Reviewers: Mickael Maison <mickael.maison@gmail.com>, Luke Chen <showuon@gmail.com>
This commit is contained in:
parent
829d5d45c4
commit
f54975c331
|
@ -152,7 +152,7 @@ $ bin/kafka-server-start.sh config/server.properties</code></pre>
|
||||||
|
|
||||||
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-topics.sh --describe --topic quickstart-events --bootstrap-server localhost:9092
|
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-topics.sh --describe --topic quickstart-events --bootstrap-server localhost:9092
|
||||||
Topic: quickstart-events TopicId: NPmZHyhbR9y00wMglMH2sg PartitionCount: 1 ReplicationFactor: 1 Configs:
|
Topic: quickstart-events TopicId: NPmZHyhbR9y00wMglMH2sg PartitionCount: 1 ReplicationFactor: 1 Configs:
|
||||||
Topic: quickstart-events Partition: 0 Leader: 0 Replicas: 0 Isr: 0</code></pre>
|
Topic: quickstart-events Partition: 0 Leader: 0 Replicas: 0 Isr: 0</code></pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="quickstart-step">
|
<div class="quickstart-step">
|
||||||
|
@ -173,8 +173,8 @@ Topic: quickstart-events TopicId: NPmZHyhbR9y00wMglMH2sg PartitionCount:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092
|
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092
|
||||||
This is my first event
|
>This is my first event
|
||||||
This is my second event</code></pre>
|
>This is my second event</code></pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
You can stop the producer client with <code>Ctrl-C</code> at any time.
|
You can stop the producer client with <code>Ctrl-C</code> at any time.
|
||||||
|
@ -233,19 +233,16 @@ This is my second event</code></pre>
|
||||||
Edit the <code class="language-bash">config/connect-standalone.properties</code> file, add or change the <code>plugin.path</code> configuration property match the following, and save the file:
|
Edit the <code class="language-bash">config/connect-standalone.properties</code> file, add or change the <code>plugin.path</code> configuration property match the following, and save the file:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ echo "plugin.path=libs/connect-file-{{fullDotVersion}}.jar >> config/connect-standalone.properties"</code></pre>
|
||||||
> echo "plugin.path=libs/connect-file-{{fullDotVersion}}.jar"</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Then, start by creating some seed data to test with:
|
Then, start by creating some seed data to test with:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ echo -e "foo\nbar" > test.txt</code></pre>
|
||||||
> echo -e "foo\nbar" > test.txt</pre>
|
|
||||||
Or on Windows:
|
Or on Windows:
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ echo foo> test.txt
|
||||||
> echo foo> test.txt
|
$ echo bar>> test.txt</code></pre>
|
||||||
> echo bar>> test.txt</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Next, we'll start two connectors running in <i>standalone</i> mode, which means they run in a single, local, dedicated
|
Next, we'll start two connectors running in <i>standalone</i> mode, which means they run in a single, local, dedicated
|
||||||
|
@ -255,8 +252,7 @@ This is my second event</code></pre>
|
||||||
class to instantiate, and any other configuration required by the connector.
|
class to instantiate, and any other configuration required by the connector.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties</code></pre>
|
||||||
> bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
These sample configuration files, included with Kafka, use the default local cluster configuration you started earlier
|
These sample configuration files, included with Kafka, use the default local cluster configuration you started earlier
|
||||||
|
@ -273,10 +269,9 @@ This is my second event</code></pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ more test.sink.txt
|
||||||
> more test.sink.txt
|
|
||||||
foo
|
foo
|
||||||
bar</pre>
|
bar</code></pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Note that the data is being stored in the Kafka topic <code>connect-test</code>, so we can also run a console consumer to see the
|
Note that the data is being stored in the Kafka topic <code>connect-test</code>, so we can also run a console consumer to see the
|
||||||
|
@ -284,16 +279,14 @@ bar</pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic connect-test --from-beginning
|
||||||
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic connect-test --from-beginning
|
|
||||||
{"schema":{"type":"string","optional":false},"payload":"foo"}
|
{"schema":{"type":"string","optional":false},"payload":"foo"}
|
||||||
{"schema":{"type":"string","optional":false},"payload":"bar"}
|
{"schema":{"type":"string","optional":false},"payload":"bar"}
|
||||||
...</pre>
|
…</code></pre>
|
||||||
|
|
||||||
<p>The connectors continue to process data, so we can add data to the file and see it move through the pipeline:</p>
|
<p>The connectors continue to process data, so we can add data to the file and see it move through the pipeline:</p>
|
||||||
|
|
||||||
<pre class="brush: bash;">
|
<pre class="line-numbers"><code class="language-bash">$ echo Another line>> test.txt</code></pre>
|
||||||
> echo Another line>> test.txt</pre>
|
|
||||||
|
|
||||||
<p>You should see the line appear in the console consumer output and in the sink file.</p>
|
<p>You should see the line appear in the console consumer output and in the sink file.</p>
|
||||||
|
|
||||||
|
@ -318,7 +311,7 @@ bar</pre>
|
||||||
|
|
||||||
<p>To give you a first taste, here's how one would implement the popular <code>WordCount</code> algorithm:</p>
|
<p>To give you a first taste, here's how one would implement the popular <code>WordCount</code> algorithm:</p>
|
||||||
|
|
||||||
<pre class="line-numbers"><code class="language-bash">KStream<String, String> textLines = builder.stream("quickstart-events");
|
<pre class="line-numbers"><code class="language-java">KStream<String, String> textLines = builder.stream("quickstart-events");
|
||||||
|
|
||||||
KTable<String, Long> wordCounts = textLines
|
KTable<String, Long> wordCounts = textLines
|
||||||
.flatMapValues(line -> Arrays.asList(line.toLowerCase().split(" ")))
|
.flatMapValues(line -> Arrays.asList(line.toLowerCase().split(" ")))
|
||||||
|
|
Loading…
Reference in New Issue