「存圖方式」學習筆記
阿新 • • 發佈:2021-12-12
目錄
一.環境準備
當前環境:centos7.3三臺
軟體版本:kafka_2.12
部署目錄:/usr/local/kafka
啟動埠:9092
配置檔案:/usr/local/kafka/config/server.properties
yum依賴(3臺同時操作)
yum install java-1.8.0-openjdk
二.安裝
1.下載kafka包(3臺節點都執行)
wget http://mirror.bit.edu.cn/apache/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz
2.解壓並移動,然後建立日誌目錄(3臺節點都執行)
tar zxvf kafka_2.12-0.10.2.1.tgz
mv kafka_2.12-0.10.2.1 /usr/local/kafka
mkdir /var/log/kafka
3.修改配置檔案(3臺同時操作,需要更改的地方不一樣)
vim /usr/local/kafka/config/server.properties
#此為第一臺,第二臺為2 第三臺為3 broker.id=1 # Switch to enable topic deletion or not, default value is false delete.topic.enable=true #本機開啟埠和監聽埠 advertised.host.name=192.168.1.189 # The number of threads handling network requests num.network.threads=3 # The number of threads doing disk I/O num.io.threads=8 # The send buffer (SO_SNDBUF) used by the socket server socket.send.buffer.bytes=102400 # The receive buffer (SO_RCVBUF) used by the socket server socket.receive.buffer.bytes=102400 # The maximum size of a request that the socket server will accept (protection against OOM) socket.request.max.bytes=104857600 #日誌目錄 log.dirs=/var/log/kafka #開啟10個分割槽 num.partitions=10 #kafka儲存訊息的副本數 default.replication.factor=3 # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown. # This value is recommended to be increased for installations with data dirs located in RAID array. num.recovery.threads.per.data.dir=1 #持久化時間 log.retention.hours=48 # The maximum size of a log segment file. When this size is reached a new log segment will be created. log.segment.bytes=1073741824 # to the retention policies log.retention.check.interval.ms=300000 #連線zookeeper地址埠 zookeeper.connect=192.168.1.189:2181,192.168.1.190:2181,192.168.1.191:2181 # Timeout in ms for connecting to zookeeper zookeeper.connection.timeout.ms=6000
三.使用驗證
啟動(3臺都需要啟動)
/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
檢查
netstat -unltp | grep 9092