@linux1s1s
2018-02-11T10:32:36.000000Z
字数 1120
阅读 1392
Big-Data
2018-02
sudo apt-get install zookeeperd
然后在终端中启动监听即可
netstat -ant | grep :2181
终端输出如下表示启动成功
tcp6 0 0 :::2181 :::* LISTEN
通过wget或者浏览器方式下载kafka以后,将其解压到/usr/local
目录即可
sudo tar -xvf kafka_2.11-0.11.0.2.tgz -C /usr/local/
sudo /usr/local/kafka_2.11-0.11.0.2/bin/kafka-server-start.sh /usr/local/kafka_2.11-0.11.0.2/config/server.properties
启动成功以后,我们新开一个终端,测试kafka server
sudo /usr/local/kafka_2.11-0.11.0.2/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testing
终端会提示
Created topic "testing".
sudo /usr/local/kafka_2.11-0.11.0.2/bin/kafka-topics.sh --list --zookeeper localhost:2181
终端会列举目前可用的主题
testing
How are you? I am fine.
等一些信息即可
sudo /usr/local/kafka_2.11-0.11.0.2/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testing
>How are you?
>I am fine.
>
sudo /usr/local/kafka_2.11-0.11.0.2/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic testing --from-beginning
How are you?
I am fine.
表示上述kafka配置完成,如下所示: