Tag Archives: kafka

centos install kafka


yum install java wget -y
wget https://downloads.apache.org/kafka/2.4.0/kafka_2.13-2.4.0.tgz
tar xvf kafka_2.13-2.4.0.tgz
mv -v kafka_2.13-2.4.0 /opt/kafka
adduser kafka
chown -R kafka.kafka /opt/kafka

vi /etc/systemd/system/kafka.service

[Unit]
Description=Apache Kafka
Requires=zookeeper.service
After=zookeeper.service

[Service]
Type=simple

User=kafka
Group=kafka

ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh

[Install]
WantedBy=multi-user.target

vi /etc/systemd/system/zookeeper.service

[Unit]
Description=zookeeper
After=syslog.target network.target

[Service]
Type=simple

User=kafka
Group=kafka

ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh

[Install]
WantedBy=multi-user.target

systemctl start kafka zookeeper

Loaded: loaded (/etc/systemd/system/kafka.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-02-18 11:01:54 UTC; 3min 58s ago
Process: 1991 ExecStop=/opt/kafka/bin/kafka-server-stop.sh (code=exited, status=0/SUCCESS)
Main PID: 2014 (java)
Tasks: 64 (limit: 9189)
Memory: 323.1M
CGroup: /docker/a5855c3d46b38df0737879ebf1b5bc90a11d9a2c0604ae3bac810683aeb0e44e/system.slice/kafka.service
└─2014 java -Xmx1G -Xms1G -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/opt/kafka/bin/../logs/kafkaServer-gc.log -verbose>

Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,391] INFO [TransactionCoordinator id=0] Starting up. (kafka.coordinator.transaction.TransactionCoordinator)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,411] INFO [TransactionCoordinator id=0] Startup complete. (kafka.coordinator.transaction.TransactionCoordinator)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,431] INFO [Transaction Marker Channel Manager 0]: Starting (kafka.coordinator.transaction.TransactionMarkerChannelManager)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,579] INFO [ExpirationReaper-0-AlterAcls]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,742] INFO [/config/changes-event-process-thread]: Starting (kafka.common.ZkNodeChangeNotificationListener$ChangeEventProcessThread)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,928] INFO [SocketServer brokerId=0] Started data-plane processors for 1 acceptors (kafka.network.SocketServer)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,935] INFO Kafka version: 2.4.0 (org.apache.kafka.common.utils.AppInfoParser)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,935] INFO Kafka commitId: 77a89fcf8d7fa018 (org.apache.kafka.common.utils.AppInfoParser)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,935] INFO Kafka startTimeMs: 1582023721929 (org.apache.kafka.common.utils.AppInfoParser)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,937] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

● zookeeper.service - zookeeper
Loaded: loaded (/etc/systemd/system/zookeeper.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-02-18 11:01:54 UTC; 3min 58s ago
Process: 2003 ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh (code=exited, status=0/SUCCESS)
Main PID: 2013 (java)
Tasks: 26 (limit: 9189)
Memory: 74.0M
CGroup: /docker/a5855c3d46b38df0737879ebf1b5bc90a11d9a2c0604ae3bac810683aeb0e44e/system.slice/zookeeper.service
└─2013 java -Xmx512M -Xms512M -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/opt/kafka/bin/../logs/zookeeper-gc.log -verbo>

Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,502] INFO maxSessionTimeout set to 60000 (org.apache.zookeeper.server.ZooKeeperServer)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,502] INFO Created server with tickTime 3000 minSessionTimeout 6000 maxSessionTimeout 60000 datadir /tmp/zookeeper/version-2 snapdir /tmp/zookeeper/versio>
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,534] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,545] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 2 worker threads, and 64 kB direct buffers. (>
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,565] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,657] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,670] INFO Reading snapshot /tmp/zookeeper/version-2/snapshot.0 (org.apache.zookeeper.server.persistence.FileSnap)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,731] INFO Snapshotting: 0x1d to /tmp/zookeeper/version-2/snapshot.1d (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,853] INFO Using checkIntervalMs=60000 maxPerMinute=10000 (org.apache.zookeeper.server.ContainerManager)
Feb 18 11:01:58 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:58,606] INFO Creating new log file: log.1e (org.apache.zookeeper.server.persistence.FileTxnLog)