docker部署kafka集群

2021-10-24 12:52:11 字數 2160 閱讀 2204

sudo curl -l " -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# zookeeper映象

docker pull zookeeper

# kafka-manager映象

docker pull sheepkiller/kafka-manager

# kafka映象

docker pull wurstmeister/kafka

注意將192.168.1.193替換自己的ip

version

:'2'

services

:# zookeeper註冊中心

zookeeper

:image

: zookeeper

ports:-

"2181:2181"

# kafka管理後台

kafka-manager

:image

: sheepkiller/kafka-manager

environment

:zk_hosts

: 192.168.1.193:

2181

:"gx"

ports:-

"9000:9000"

expose:-

"9000"

kafka0

:image

: wurstmeister/kafka

build

: . ports:-

"9092:9092"

environment

:kafka_listeners

: plaintext:

9092

kafka_advertised_listeners

: plaintext:

9092

kafka_broker_id:0

kafka_create_topics

:"test:1:1"

kafka_zookeeper_connect

: zookeeper:

2181

kafka1

:image

: wurstmeister/kafka

build

: . ports:-

"9093:9093"

environment

:kafka_listeners

: plaintext:

9093

kafka_advertised_listeners

: plaintext:

9093

kafka_broker_id:1

kafka_create_topics

:"test:1:1"

kafka_zookeeper_connect

: zookeeper:

2181

kafka2

:image

: wurstmeister/kafka

build

: . ports:-

"9094:9094"

environment

:kafka_listeners

: plaintext:

9094

kafka_advertised_listeners

: plaintext:

9094

kafka_broker_id:2

kafka_create_topics

:"test:1:1"

kafka_zookeeper_connect

: zookeeper:

2181

進入docker-compose.yml所在目錄,執行命令

docker-compose up -d
這樣就啟動成功了

http://[自己的ip]:9000

新增集群

在docker環境下部署kafka集群

利用docker可以很方便的在一台機子上搭建kafka集群並進行測試。為了簡化配置流程,我們採用docker compose進行進行搭建。docker環境的部署參考 docker compose的部署參考 kafka搭建過程如下 編寫docker compose.yml檔案,內容如下 version...

Kafka 集群部署

kafka是乙個分布式訊息佇列,需要依賴zookeeper,請先安裝好zk集群 kafka安裝包解壓 tar xf kafka 2.10 0.9.0.1 tgz mv kafka 2.10 0.9.0.1 usr kafka cd usr kafka 配置檔案 server.properties t...

kafka集群部署

一台伺服器上可以啟動多個broker例項,或者將broker部署到多台伺服器上,以下以172.16.50.21集群為例,多台伺服器上部署broker。tar xzf kafka 2.11 1.0.0.tgz cd kafka 2.11 1.0.0kafka依賴zookeeper,如果環境中沒有zoo...