当前位置:   article > 正文

LINUX搭建kafka环境_deepin安装kafka

deepin安装kafka

 

  1. 1.首先搭建zookeeper
  2. 1.创建zookeeper
  3. cd zookeeper
  4. mkdir server1
  5. mkdir server2
  6. mkdir server3
  7. tar -zxvf zookeeper.tar.gz
  8. cp -r zookeeper server1
  9. cp -r zookeeper server2
  10. cp -r zookeeper server3
  11. server1配置
  12. tickTime=2000
  13. initLimit=10
  14. syncLimit=5
  15. dataDir=/home/ixj/zookeeper/server1/data
  16. dataLogDir=/home/ixj/zookeeper/server1/datalog
  17. clientPort=2181
  18. server.1=127.0.0.1:2888:3888
  19. server.2=127.0.0.1:2889:3889
  20. server.3=127.0.0.1:2890:3890
  21. server2配置
  22. tickTime=2000
  23. initLimit=10
  24. syncLimit=5
  25. dataDir=/home/ixj/zookeeper/server2/data
  26. dataLogDir=/home/ixj/zookeeper/server2/datalog
  27. clientPort=2182
  28. server.1=127.0.0.1:2888:3888
  29. server.2=127.0.0.1:2889:3889
  30. server.3=127.0.0.1:2890:3890
  31. server3配置
  32. tickTime=2000
  33. initLimit=10
  34. syncLimit=5
  35. dataDir=/home/ixj/zookeeper/server3/data
  36. dataLogDir=/home/ixj/zookeeper/server3/datalog
  37. clientPort=2183
  38. server.1=127.0.0.1:2888:3888
  39. server.2=127.0.0.1:2889:3889
  40. server.3=127.0.0.1:2890:3890

                         

  1. 2.搭建kafka
  2. 下载解压,复制三份,分别更改config/server.properties
  3. kafka1配置
  4. broker.id=0
  5. num.network.threads=3
  6. num.io.threads=8
  7. socket.send.buffer.bytes=102400
  8. socket.receive.buffer.bytes=102400
  9. socket.request.max.bytes=104857600
  10. log.dirs=/home/ixj/kafka/kafkalogs1
  11. num.partitions=1
  12. num.recovery.threads.per.data.dir=1
  13. offsets.topic.replication.factor=1
  14. listeners=PLAINTEXT://127.0.0.1:9092
  15. port=9092
  16. host.name=127.0.0.1
  17. transaction.state.log.replication.factor=1
  18. transaction.state.log.min.isr=1
  19. #log.flush.interval.ms=1000
  20. log.retention.hours=168
  21. log.segment.bytes=1073741824
  22. log.retention.check.interval.ms=300000
  23. zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
  24. zookeeper.connection.timeout.ms=6000
  25. group.initial.rebalance.delay.ms=0
  26. kafka2配置
  27. broker.id=0
  28. num.network.threads=3
  29. num.io.threads=8
  30. socket.send.buffer.bytes=102400
  31. socket.receive.buffer.bytes=102400
  32. socket.request.max.bytes=104857600
  33. log.dirs=/home/ixj/kafka/kafkalogs2
  34. num.partitions=1
  35. num.recovery.threads.per.data.dir=1
  36. offsets.topic.replication.factor=1
  37. listeners=PLAINTEXT://127.0.0.1:9093
  38. port=9093
  39. host.name=127.0.0.1
  40. transaction.state.log.replication.factor=1
  41. transaction.state.log.min.isr=1
  42. #log.flush.interval.ms=1000
  43. log.retention.hours=168
  44. log.segment.bytes=1073741824
  45. log.retention.check.interval.ms=300000
  46. zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
  47. zookeeper.connection.timeout.ms=6000
  48. group.initial.rebalance.delay.ms=0
  49. kafka3配置
  50. broker.id=0
  51. num.network.threads=3
  52. num.io.threads=8
  53. socket.send.buffer.bytes=102400
  54. socket.receive.buffer.bytes=102400
  55. socket.request.max.bytes=104857600
  56. log.dirs=/home/ixj/kafka/kafkalogs3
  57. num.partitions=1
  58. num.recovery.threads.per.data.dir=1
  59. offsets.topic.replication.factor=1
  60. listeners=PLAINTEXT://127.0.0.1:9094
  61. port=9094
  62. host.name=127.0.0.1
  63. transaction.state.log.replication.factor=1
  64. transaction.state.log.min.isr=1
  65. #log.flush.interval.ms=1000
  66. log.retention.hours=168
  67. log.segment.bytes=1073741824
  68. log.retention.check.interval.ms=300000
  69. zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
  70. zookeeper.connection.timeout.ms=6000
  71. group.initial.rebalance.delay.ms=0

 

 

  1. 启动
  2. 1. ./bin/kafka-server-start.sh config/server.properties
  3. 创建:bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic test
  4. 发送消息:bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
  5. 接收消息:bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/79062?site
推荐阅读
相关标签
  

闽ICP备14008679号