使用docker搭建

  1. 安装zookeeper
docker run -d --name gps180_zookeeper --publish 2181:2181 \
    --v /etc/localtime:/etc/localtime \
    --restart=always \
    wurstmeister/zookeeper
1
2
3
4
  1. 安装Kafka
docker run -d --name gps180_kafka --publish 9092:9092 \
    --link zookeeper:gps180_zookeeper \
    --env KAFKA_BROKER_ID=100 \
    --env HOST_IP=192.168.1.12 \
    --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
    --env KAFKA_ADVERTISED_HOST_NAME=192.168.1.12 \
    --env KAFKA_ADVERTISED_PORT=9092 \
    --v /etc/localtime:/etc/localtime \
    --restart=always \
    wurstmeister/kafka

1
2
3
4
5
6
7
8
9
10
11