sudo vim /etc/profile
在末尾附加:
export path=/opt/kafka/zookeeper/bin:$path
最後 source /etc/profile
2.需先搭建zookeeper環境
cp zoo_sample.cfg zoo.cfg 在 conf裡面根據需要改 zoo.cfg 如果不做集群 ,只按原來的就好了vim zoo.cfg
# the number of milliseconds of each tick
ticktime=2000
# the number of ticks that the initial
# synchronization phase can take
initlimit=10
# the number of ticks that can pass between
# sending a request and getting an acknowledgement
synclimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
datadir=/opt/kafka/zookeeper/data
# the port at which the clients will connect
clientport=2181
initlimit=5
synclimit=2
server.1=192.168
.195
.149:2888:3888
server.2=192.168
.195
.150:2888:3888
server.3=192.168
.195
.151:2888:3888
然後在datadir 裡面 (我的例子是data目錄下) 新建乙個 zookeeper_server.pid
然後再搭建kafka集群
bin/zkserver.sh start 在三颱機器上啟動
bin/zkserver.sh status 檢視狀態
bin/kafka-server-start.sh config/server.properties 在三颱機器上啟動
bin/kafka-topics.sh –describe –zookeeper 192.168.195.128:2181, –topic test
bin/kafka-console-producer.sh –broker-list master:9092 –topic test
bin/kafka-console-consumer.sh –zookeeper master:2181 –topic test –from-beginning
Linux環境下kafka集群搭建
kafka集群的搭建比較簡單,分以下三步完成.1 解壓 2 配置並分發安裝包 1 配置kafka環境變數 2 修改kafka配置項 log.dir和zookeeper.connect 3 啟動kafka集群 1 修改kafka集群broker的brokerid,遵循0,1,2,3 2 分別啟動bro...
linux 搭建 kafka集群
wget tar zxvf kafka 2.11 0.10.2.0.tgz mkdir kafka logs cd soft kafka kafka 2.11 0.10.2.0 config vi server.properties 修改 broker.id 0 注釋掉,每台伺服器的broker.i...
linux搭建kafka集群
tar zxvf kafka 2.12 2.3.1.tgz新增環境變數 開啟環境變數配置檔案 vim etc profile加入kafka配置 export kafka home usr local programs kafka 2.12 2.3.1 export path bin path 讓環境...