kafka叢集安裝
1.前提需要java環境和zookeeper的支援
2.建立持久化目錄(根目錄)
mkdir /kafkaLogs
3.修改kafka的配置檔案(config)目錄
vim server.properties
1.修改broker.id
2.修改kafka監聽地址
3.修改持久化目錄
4.修改zk地址
5.新增啟用刪除topic配置
6.關閉自動建立topic
############################# Server Basics ############################# # The id of the broker. This must be set to a unique integer for each broker. broker.id=0 advertised.host.name=192.168.1.123 ############################# Socket Server Settings ############################# # The address the socket server listens on. It will get the value returned from # java.net.InetAddress.getCanonicalHostName() if not configured. # FORMAT: # listeners = listener_name://host_name:port # EXAMPLE: # listeners = PLAINTEXT://your.host.name:9092 #listeners=PLAINTEXT://:9092 # Hostname and port the broker will advertise to producers and consumers. If not set, # it uses the value for "listeners" if configured. Otherwise, it will use the value # returned from java.net.InetAddress.getCanonicalHostName(). #advertised.listeners=PLAINTEXT://your.host.name:9092 # Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL # The number of threads that the server uses for receiving requests from the network and sending responses to the network num.network.threads=3 # The number of threads that the server uses for processing requests, which may include 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 Basics ############################# # A comma separated list of directories under which to store log files log.dirs=/kafkaLogs # The default number of log partitions per topic. More partitions allow greater # parallelism for consumption, but this will also result in more files across # the brokers. num.partitions=1 # 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 ############################# Internal Topic Settings ############################# # The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state" # For anything other than development testing, a value greater than 1 is recommended for to ensure availability such as 3. offsets.topic.replication.factor=1 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 ############################# Log Flush Policy ############################# # Messages are immediately written to the filesystem but by default we only fsync() to sync # the OS cache lazily. The following configurations control the flush of data to disk. # There are a few important trade-offs here: # 1. Durability: Unflushed data may be lost if you are not using replication. # 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush. # 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks. # The settings below allow one to configure the flush policy to flush data after a period of time or # every N messages (or both). This can be done globally and overridden on a per-topic basis. # The number of messages to accept before forcing a flush of data to disk #log.flush.interval.messages=10000 # The maximum amount of time a message can sit in a log before we force a flush #log.flush.interval.ms=1000 ############################# Log Retention Policy ############################# # The following configurations control the disposal of log segments. The policy can # be set to delete segments after a period of time, or after a given size has accumulated. # A segment will be deleted whenever *either* of these criteria are met. Deletion always happens # from the end of the log. # The minimum age of a log file to be eligible for deletion due to age log.retention.hours=168 # A size-based retention policy for logs. Segments are pruned from the log unless the remaining # segments drop below log.retention.bytes. Functions independently of log.retention.hours. #log.retention.bytes=1073741824 # The maximum size of a log segment file. When this size is reached a new log segment will be created. log.segment.bytes=1073741824 # The interval at which log segments are checked to see if they can be deleted according # to the retention policies log.retention.check.interval.ms=300000 ############################# Zookeeper ############################# # Zookeeper connection string (see zookeeper docs for details). # This is a comma separated host:port pairs, each corresponding to a zk # server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002". # You can also append an optional chroot string to the urls to specify the # root directory for all kafka znodes. zookeeper.connect=192.168.1.123:2181,192.168.1.131:2181,192.168.1.148:2181 # Timeout in ms for connecting to zookeeper zookeeper.connection.timeout.ms=6000 ############################# Group Coordinator Settings ############################# # The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance. # The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms. # The default value for this is 3 seconds. # We override this to 0 here as it makes for a better out-of-the-box experience for development and testing. # However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup. group.initial.rebalance.delay.ms=0 ###########刪除topic############################# delete.topic.enable=true #########關閉自動建立topic################### auto.create.topics.enable=false |
4.複製該配置到叢集中的其他機器
scp -rp kafka_2.11-0.9.0.1 [email protected]***:/usr/local/
5.修改叢集中其他機器的broker.id
vim server.properties
broker.id=0 |
6.啟動kafka的相關命令:
主機啟動kafka:
JMX_PORT=9997 bin/kafka-server-start.sh -daemon config/server.properties &
停止kafka:
/usr/local/kafka_2.11-0.9.0.1/bin/kafka-server-stop.sh
7.設定指令碼,定期清理logs下的日誌(kafka的根目錄)
cd /usr/local/kafka_2.11-0.9.0.1/
vim clean_kafkalog.sh
#!/bin/bash ###Description:This script is used to clear kafka logs, not message file. ###Written by: jkzhao - [email protected] ###History: 2016-04-18 First release. # log filedir. logDir=/usr/local/kafka_2.11-0.9.0.1/logs # Reserved 7 files. COUNT=7 ls -t $logDir/server.log* | tail -n +$[$COUNT+1] | xargsrm -f ls -t $logDir/controller.log* | tail -n +$[$COUNT+1] | xargsrm -f ls -t $logDir/state-change.log* | tail -n +$[$COUNT+1] | xargsrm -f ls -t $logDir/log-cleaner.log* | tail -n +$[$COUNT+1] | xargsrm –f |
chmod +x clean_kafkalog.sh
週期性任務策略:每週日的0點0分去執行這個指令碼:
crontab -e 0 0 * * 0 /usr/local/kafka_2.11-0.9.0.1/clean_kafkalog.sh
相關推薦
大資料學習之路94-kafka叢集安裝
解壓 Kafka 安裝包 修改配置檔案 config/server.properties vi server.properties broker.id=0 //為依次增長的:0、1、2、3、4,叢集中唯一id log.dirs=/kafkaData/logs // Kafka
kafka叢集安裝步驟
準備工作: 安裝好zookeeper叢集 一、上傳並解壓 1. cd /usr/kafka (沒有目錄的話自己建立) 2. rz 3. tar -zxvf kafka_2.12-1.1.0.tgz 二、2.修改配置檔案 /usr/kafka/kafka_2.12-1.
Java架構-KafKa叢集安裝詳細步驟
最近在使用Spring Cloud進行分散式微服務搭建,順便對整合KafKa的方案做了一些總結,今天詳細介紹一下KafKa叢集安裝過程: 1.在根目錄建立kafka資料夾(service1、service2、service3都建立) [[email protected]
七 Kafka叢集安裝
2、Kafka叢集安裝 1)修改配置檔案config/server.properties 2)啟動伺服器bin/kafka-server-start.sh config/server.properties & 3)測試 建立topic bin/kafka-topics.sh --create
安裝部署(六) Kafka叢集安裝部署以及Producer和Consumer的JAVA程式碼測試
Kafka叢集安裝部署以及Producer和Consumer的JAVA程式碼測試 kafka scala2.11_0.10.0.0 ubuntu 14.04.04 x64 hadoop 2.7.2spark 2.0.0 scala 2.11.8 jdk 1.8.0_101
kafka叢集安裝與使用
kafaka中的名詞: Broker:安裝kafka服務大那臺機器就是一個broker (id要唯一) Producer:訊息的生產者,負責將資料寫入到broker中(push) Consumer:訊息的消費者,負責從kafka中讀取資料(pull),老版本 的消費者依賴zk,新
docker kafka叢集安裝部署
安裝包下載 前置準備 jdk映象 kafka安裝包 解壓 tar -zxvf kafka_2.10-0.8.2.1.tgz -C /usr/local mv kafka_2.10-0.8.2.1 kafka cd /usr/local/kafka/config
kafka叢集安裝配置
1,準備三臺機器,例如IP地址分別為109.105.111.11, 109.105.111.12, 109.105.111.13的三臺機器。 2,下載kafka穩定版本,我下載的是kafka_2.10-0.9.0.0.tgz。 3,分別在三臺機器上解壓放到想安裝的目錄,我的
kafka叢集安裝
1.前提需要java環境和zookeeper的支援 2.建立持久化目錄(根目錄) mkdir /kafkaLogs 3.修改kafka的配置檔案(config)目錄 vim server.properties 1.修改broker.id 2.修改kafka監聽
Kafka分散式叢集安裝
Kafka分散式叢集安裝 目錄 一、下載 二、安裝前提(zookeeper安裝) 三、安裝 2.1 上傳解壓縮 2.2 修改配置檔案 2.3 將kafka的安裝包分發到其他節點 2.4 建立軟連線 2.5 修改
安裝部署Kafka叢集
kafka是一個開源的分散式訊息訂閱系統(訊息中介軟體) 安裝過程 1.下載kafka_2.11-0.10.1.0.gz(ps:千萬不要下錯了,博主就是下到了src檔案上去了,kafka中的zookeeper起不起來) 2.上傳至/usr/local/src 3.解壓縮,並且移動到上級目錄 4.進入
Elk叢集安裝+配置(Elasticsearch+Logstash+Filebeat+Kafka+Kibana)
一、部署環境 1.基礎環境: 軟體 版本 作用 Linux Centos7.1,16g Jdk 1.8.0_151
docker-compose安裝kafka叢集及管理監控工具
編寫docker-compose檔案配置zk 和kafka叢集 #vim kafka.yml version: '2'services: zoo1: image: zooke
flink叢集一鍵安裝指令碼 -- kafka訊息中介軟體依賴zookeeper叢集安裝指令碼
#!/bin/sh INSTALL_PATH="/usr/local/src/"; ZOOKEEPER_VERSION="3.4.11" ZOOKEEPER_GZIP="zookeeper-${ZOOKEEPER_VERSION}.tar.gz"; ZOOKEEPER_CONF_DIR
雲伺服器環境安裝與配置:kafka叢集
本文詳細說明kafka叢集安裝和命令列的基本使用 環境 zk叢集:192.168.31.201、192.168.31.202、192.168.31.203 Centos7 三臺 對齊
Kafka的叢集安裝
修改server.properties 20 行 id 設定唯一識別 3臺機器 所以第一臺配置1 第二臺2第三臺3 50行 設定kafka的資料路徑 119行 加入zk的地址 檔案最後 如果有則修改屬性值,沒有就加上 #partion buff
Kafka叢集完全分散式安裝
一、上傳、解壓kafka壓縮包 將kafka壓縮包上傳到Linux系統中,並進行解壓 [[email protected] software]# pwd /home/software [[email protected] software]# ll
安裝kafka 叢集 步驟
1.下載 http://mirror.bit.edu.cn/apache/kafka/2.1.0/kafka_2.11-2.1.0.tgz 2.解壓 tar -zxvf kafka_2.11-2.1.0.tgz 3.建立兩份配置檔案 cd conf cp se
Kafka叢集的Linux安裝步驟
一、 環境準備 Kafka依賴ZooKeeper,首先需要確保ZooKeeper服務已經搭建完成。 作業系統: CentOS-7-x86_64-1611 節點IP埠: 192.168.2.2
zookeeper+kafka叢集的安裝部署
準備工作 上傳 zookeeper-3.4.6.tar.gz、scala-2.11.4.tgz、kafka_2.9.2-0.8.1.1.tgz、slf4j-1.7.6.zip 至/usr/local目錄 zookeeper叢集搭建 解壓zookeeper安裝包 # tar -zxvf zookeepe