Apache Kafka 的安装与使用
来源:互联网 发布:数据库系统的作用 编辑:程序博客网 时间:2024/05/16 01:31
安装Java
> sudo apt-get install openjdk-8-jdk
安装Kafka
# Download> wget http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.10.2.0/kafka_2.11-0.10.2.0.tgz> tar -xzf kafka_2.11-0.10.2.0.tgz> cd kafka_2.11-0.10.2.0# start a ZooKeeper server> ./bin/zookeeper-server-start.sh config/zookeeper.properties# start the Kafka server:> ./bin/kafka-server-start.sh config/server.properties# Create a topic> ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test# list topic> ./bin/kafka-topics.sh --list --zookeeper localhost:2181# Delete a Topic> vim server.properties delete.topic.enable=true> ./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic test1# Run the producer:> ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test# Start a consumer> ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
Setting up a multi-broker cluster
# copy config> cp config/server.properties config/server-1.properties> cp config/server.properties config/server-2.properties# edit config> vim config/server-1.properties: broker.id=1 listeners=PLAINTEXT://:9093 log.dir=/tmp/kafka-logs-1> vim config/server-2.properties: broker.id=2 listeners=PLAINTEXT://:9094 log.dir=/tmp/kafka-logs-2note: The broker.id property is the unique and permanent name of each node in the cluster.# Running node> ./bin/kafka-server-start.sh config/server-1.properties &> ./bin/kafka-server-start.sh config/server-2.properties &# Create a new topic with a replication factor> ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 2 --topic my-replicated-topic# Describe topics> ./bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic my-replicated-topic# Start procedure:> ./bin/kafka-console-producer.sh --broker-list localhost:9093,localhost:9094 --sync --topic my-replicated-topic# Start Consumer:> ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9093,localhost:9094 --from-beginning --topic my-replicated-topic
Fault-tolerance Test
# we kill cluster leader 1, system should auto randomly to a new cluster node.> sudo netstat -ntlp> kill -9 10598
阅读全文
0 0
- Apache Kafka 的安装与使用
- apache kafka系列之安装与使用
- linux apache kafka安装与使用
- Apache Kafka 简介与使用
- kafka安装与使用
- Kafka安装与使用
- kafka的安装配置与使用
- kafka集群安装与使用
- kafka eagle安装与使用
- Apache Kafka安装配置
- Apache-Kafka集群安装
- Apache安装与使用
- apache服务器的安装与使用
- apache服务器的安装与使用
- Apache Http Sever的安装与使用
- apache ant 的安装与使用
- Apache Kafka 分布式消息队列中间件安装与配置
- Apache Kafka 分布式消息队列中间件安装与配置
- 字典转字符串,字符串转字典
- 2017年9月11日09:02:10笔记
- Java中一对多映射关联关系
- 智慧北京(2017.09.01)
- 编程技巧干货笔记 【关于内联函数】
- Apache Kafka 的安装与使用
- 带参数的函数
- Java基本注解分析,为什么要使用@Override
- 2017/09/11综测工作总结
- Ubuntu——子进程已安装错误代码1
- 存储过程
- Java基础(Java、linux、sql优化)
- linux查看tomcat实时日志
- JavaSSM学习小结(2):DAO层学习