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

CentOS7部署kafka服务

时间:2019-07-25 00:35:04      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:root   exp   end   netstat   type   name   oca   targe   send   

1、安装jdk

[root@linux-host1 ~]# tail /etc/profile

export JAVA_HOME=/usr/local/jdk1.8.0_161

export PATH=$JAVA_HOME/bin:$PATH

[root@linux-host1 ~]# source /etc/profile

[root@linux-host1 ~]# which  java

/usr/local/jdk1.8.0_161/bin/java

[root@linux-host1 ~]# java -version

 

2、安装zookeeper

[root@linux-host1 ~]# cd  /opt/zookeeper-3.4.14/

[root@linux-host1 zookeeper-3.4.14]# ./bin/zkServer.sh start

[root@linux-host1 ~]# netstat  -lnpt

Proto Recv-Q Send-Q Local Address     Foreign Address     State     PID/Program name   

tcp        0      0 0.0.0.0:22        0.0.0.0:*               LISTEN      939/sshd           

tcp6       0      0 :::43727           :::*                    LISTEN      5399/java          

tcp6       0      0 :::80             :::*                    LISTEN      940/httpd          

tcp6       0      0 :::22             :::*                    LISTEN      939/sshd           

tcp6       0      0 :::2181           :::*                    LISTEN      5399/java    

配置systemd启动服务,

 技术图片

[root@linux-host1 ~]# vim /usr/lib/systemd/system/zookeeper.service

[Unit]

Description=zookeeper service

After=network.target

 

[Service]

Type=forking

Environment="PATH=/usr/local/jdk1.8.0_161/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"

User=root

Group=root

ExecStart=/opt/zookeeper-3.4.14/bin/zkServer.sh start

ExecStop=/opt/zookeeper-3.4.14/bin/zkServer.sh stop

Restart=on-failure

 

[Install]

WantedBy=multi-user.target

[root@linux-host1 ~]# systemctl daemon-reload

[root@linux-host1 ~]# systemctl stop zookeeper 

[root@linux-host1 ~]# systemctl status zookeeper

 

3、安装kafka

Kafka解压目录:/root/ansibles/kafka/kafka_2.12-1.0.0

[root@linux-host1 ~]# vim /lib/systemd/system/kafka.service

[Unit]

Description=Apache Kafka server (broker)

After=network.target

 

[Service]

Type=forking

Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/jdk1.8.0_161/bin"

User=root

Group=root

ExecStart=/opt/kafka_2.12-1.0.0/bin/kafka-server-start.sh -daemon /opt/kafka_2.12-1.0.0/config/server.properties
ExecStop=/opt/kafka_2.12-1.0.0/bin/kafka-server-stop.sh

 

[Install]

WantedBy=multi-user.target

技术图片

[root@linux-host1 ~]# systemctl daemon-reload

[root@linux-host1 ~]# systemctl status kafka

[root@linux-host1 ~]# systemctl start kafka

相关服务端口,

 技术图片

完成kafka安装部署。 

CentOS7部署kafka服务

标签:root   exp   end   netstat   type   name   oca   targe   send   

原文地址:https://www.cnblogs.com/sunnyyangwang/p/11241435.html

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