docker-compose-kafka-cluster.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. version: '2'
  2. services:
  3. zookeeper1:
  4. image: 'zookeeper'
  5. restart: always
  6. hostname: zookeeper1
  7. #ports:
  8. # - 2181:2181
  9. environment:
  10. ZOO_MY_ID: 1
  11. ZOO_SERVERS: server.1=zookeeper1:2888:3888 server.2=zookeeper2:2888:3888 server.3=zookeeper3:2888:3888
  12. zookeeper2:
  13. image: 'zookeeper'
  14. restart: always
  15. hostname: zookeeper2
  16. #ports:
  17. # - 2182:2181
  18. environment:
  19. ZOO_MY_ID: 2
  20. ZOO_SERVERS: server.1=zookeeper1:2888:3888 server.2=zookeeper2:2888:3888 server.3=zookeeper3:2888:3888
  21. zookeeper3:
  22. image: 'zookeeper'
  23. restart: always
  24. hostname: zookeeper3
  25. #ports:
  26. # - 2183:2181
  27. environment:
  28. ZOO_MY_ID: 3
  29. ZOO_SERVERS: server.1=zookeeper1:2888:3888 server.2=zookeeper2:2888:3888 server.3=zookeeper3:2888:3888
  30. kafka1:
  31. image: 'wurstmeister/kafka'
  32. ports:
  33. - 9091:9091
  34. volumes:
  35. - /mnt/data/dendrite/kafka1/log:/kafka/kafka-logs-localhost
  36. environment:
  37. KAFKA_BROKER_ID: 1
  38. #KAFKA_ADVERTISED_HOST_NAME: kafka1
  39. KAFKA_ADVERTISED_PORT: 9091
  40. KAFKA_AUTO_CREATE_TOPICS: "true"
  41. KAFKA_DELETE_TOPIC_ENABLE: "false"
  42. #KAFKA_CREATE_TOPICS: keyUpdate:3:3,clientapiOutput:3:3,dbUpdates:3:3,receiptUpdate:3:3,roomserverOutput:3:3,roomserverOutput-push:3:3,roomserverInput:3:3
  43. KAFKA_LOG_RETENTION_HOURS: 720
  44. KAFKA_NUM_PARTITIONS: 3
  45. KAFKA_REPLICATION_FACTOR: 3
  46. KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
  47. KAFKA_LISTENERS: PLAINTEXT://:9091
  48. KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9091
  49. depends_on:
  50. - zookeeper1
  51. - zookeeper2
  52. - zookeeper3
  53. links:
  54. - 'zookeeper1'
  55. - 'zookeeper2'
  56. - 'zookeeper3'
  57. kafka2:
  58. image: 'wurstmeister/kafka'
  59. ports:
  60. - 9092:9092
  61. volumes:
  62. - /mnt/data/dendrite/kafka2/log:/kafka/kafka-logs-localhost
  63. environment:
  64. KAFKA_BROKER_ID: 2
  65. #KAFKA_ADVERTISED_HOST_NAME: kafka2
  66. KAFKA_ADVERTISED_PORT: 9092
  67. KAFKA_AUTO_CREATE_TOPICS: "true"
  68. KAFKA_DELETE_TOPIC_ENABLE: "false"
  69. KAFKA_LOG_RETENTION_HOURS: 720
  70. KAFKA_NUM_PARTITIONS: 3
  71. KAFKA_REPLICATION_FACTOR: 3
  72. KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
  73. KAFKA_LISTENERS: PLAINTEXT://:9092
  74. KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9092
  75. depends_on:
  76. - zookeeper1
  77. - zookeeper2
  78. - zookeeper3
  79. links:
  80. - 'zookeeper1'
  81. - 'zookeeper2'
  82. - 'zookeeper3'
  83. kafka3:
  84. image: 'wurstmeister/kafka'
  85. ports:
  86. - 9093:9093
  87. volumes:
  88. - /mnt/data/dendrite/kafka3/log:/kafka/kafka-logs-localhost
  89. environment:
  90. KAFKA_BROKER_ID: 3
  91. #KAFKA_ADVERTISED_HOST_NAME: kafka3
  92. KAFKA_ADVERTISED_PORT: 9093
  93. KAFKA_AUTO_CREATE_TOPICS: "true"
  94. KAFKA_DELETE_TOPIC_ENABLE: "false"
  95. KAFKA_LOG_RETENTION_HOURS: 720
  96. KAFKA_NUM_PARTITIONS: 3
  97. KAFKA_REPLICATION_FACTOR: 3
  98. KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
  99. KAFKA_LISTENERS: PLAINTEXT://:9093
  100. KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka3:9093
  101. depends_on:
  102. - zookeeper1
  103. - zookeeper2
  104. - zookeeper3
  105. links:
  106. - 'zookeeper1'
  107. - 'zookeeper2'
  108. - 'zookeeper3'