<commit_before>= Kafka 安装


参考
http://kafka.apache.org/documentation.html#quickstart

==== 下载
```
wget "http://apache.osuosl.org/kafka/0.10.0.0/kafka_2.11-0.10.0.0.tgz"
tar -zxvf kafka_2.11-0.10.0.0.tgz
sudo mv kafka_2.11-0.10.0.0 /usr/lib/kafka
```

==== 运行Kafka
启动zookeeper
```
cd /usr/lib/kafka
bin/zookeeper-server-start.sh config/zookeeper.properties
```
启动kafka
```
cd /usr/lib/kafka
bin/kafka-server-start.sh config/server.properties
```
==== 测试
运行producer
```
cd /usr/lib/kafka
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a message
This is another message

```
运行consumer
```
cd /usr/lib/kafka
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
```<commit_msg>Update 2016-05-26-Kafka.adoc<commit_after>= Kafka 安装


参考
http://kafka.apache.org/documentation.html#quickstart

==== 下载
```
wget "http://apache.osuosl.org/kafka/0.10.0.0/kafka_2.11-0.10.0.0.tgz"
tar -zxvf kafka_2.11-0.10.0.0.tgz
sudo mkdir /usr/lib/kafka
sudo mv kafka_2.11-0.10.0.0 /usr/lib/kafka
```

==== 运行Kafka
启动zookeeper
```
cd /usr/lib/kafka/kafka_2.11-0.10.0.0
bin/zookeeper-server-start.sh config/zookeeper.properties
```
启动kafka
```
cd /usr/lib/kafka/kafka_2.11-0.10.0.0
bin/kafka-server-start.sh config/server.properties
```
==== 测试
运行producer
```
cd /usr/lib/kafka/kafka_2.11-0.10.0.0
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a message
This is another message

```
运行consumer
```
cd /usr/lib/kafka/kafka_2.11-0.10.0.0
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
```
{'fraction_non_alphanumeric': 0.1867582760774516, 'fraction_numerical': 0.0712054965646471, 'mean_word_length': 3.767857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6116988', 'n_tokens_mistral': 788, 'n_tokens_neox': 729, 'n_words': 108}