[Hadoop][Kafka]

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Hadoop][Kafka]相关的知识,希望对你有一定的参考价值。

tar -C /opt -xf /tmp/kafka_2.12-0.10.2.1.tar

ln -s /opt/kafka_2.12-0.10.2.1 /opt/kafka

 

# 创建组和用户

groupadd kafka

useradd -g kafka kafka -s /sbin/nologin

 

# 文件存放目录

mkdir -p /mnt/kafka/data

mkdir -p /var/log/kafka

chown kafka:kafka -R /mnt/kafka/data

chown kafka:kafka -R /var/log/kafka

chown kafka:kafka -R /opt/kafka_2.12-0.10.2.1

chown kafka:kafka -R /opt/kafka

 

#修改配置文件

sed -i ‘s/broker.id=0/broker.id=1/‘ /opt/kafka/config/server.properties

sed -i ‘s/log.dirs=\/tmp\/kafka-logs/log.dirs=\/var\/log\/kafka/‘ /opt/kafka/config/server.properties

sed -i ‘s/zookeeper.connect=localhost:2181/zookeeper.connect=zookeeper01:2181,zookeeper02:2181,zookeeper03:2181/‘ /opt/kafka/config/server.properties

 

#systemd开机配置

cat <<EOF | tee /usr/lib/systemd/system/kafka.service

[Unit]

Description=Kafka

After=network.target

#After=zookeeper.service

 

[Service]

Type=forking

Restart=on-failure

 

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

User=kafka

Group=kafka

 

[Install]

WantedBy=multi-user.target

EOF

 

systemctl enable kafka

systemctl start kafka

以上是关于[Hadoop][Kafka]的主要内容,如果未能解决你的问题,请参考以下文章

hadoop kafka install

[Hadoop][Kafka]

黑马12期大数据教程(hadoop,storm,kafka,hbase,hive,sqoop)

Hadoop集群高可用及zookeeper+kafka组件搭建

Hadoop之Apache Kafka

Kafka---将kafka中的数据导入HBase