码迷,mamicode.com
首页 > 其他好文 > 详细

[Hadoop][Kafka]

时间:2017-05-29 21:04:04      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:config   zookeeper   server   margin   normal   eof   创建   connect   nbsp   

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]

标签:config   zookeeper   server   margin   normal   eof   创建   connect   nbsp   

原文地址:http://www.cnblogs.com/wuzhenzhou/p/6918981.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!