echo “(4/6): 初次启动Zookeeper…”
zkServer.sh start
sleep 2
zkServer.sh status
echo “(4/6): Zookeeper初次启动完毕”
echo “(5/6): 开启2181端口…”
firewall-cmd --zone=public --add-port=2181/tcp --permanent && firewall-cmd --reload
echo “(5/6): 2181端口开启完毕”
echo “(6/6): Zookeeper加入到service服务并设置开机自启…”
cat <<‘EOF’ > /etc/rc.d/init.d/zookeeper
#!/bin/bash
chkconfig: 2345 10 90
description: service zookeeper
processname: zookeeper
export JAVA_HOME=/usr/local/java
ZOOKEEPER_HOME=/usr/local/zookeeper
case $1 in
start) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh start;;
start-foreground) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh start-foreground;;
stop) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh stop;;
status) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh status;;
restart) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh restart;;
upgrade) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh upgrade;;
print-cmd) su root ${ZOOKEEPER_HOME}/bin/zkServer.sh print-cmd;;
*) echo “require start|start-foreground|stop|status|restart|print-cmd”;;
esac
EOF
chmod +x /etc/rc.d/init.d/zookeeper
chkconfig --add /etc/rc.d/init.d/zookeeper
chkconfig zookeeper on
echo “(6/6): Zookeeper加入到service服务并设置开机自启完毕”
#### 1.2 Kafka
Kafka 安装文件为`apache-zookeeper-3.6.2-bin.tar.gz`脚本内容如下:
#!/bin/bash
rm -rf /usr/local/kafka
echo “(1/6): 解压Kafka安装文件…”
tar -zxvf kafka_2.12-2.6.0.tgz
sleep 10
echo “(1/6): Kafka安装文件解压完毕”
echo “(2/6): 配置Kafka环境变量…”
mv ./kafka_2.12-2.6.0/ /usr/local/kafka
sleep 2
cat <<‘EOF’ > /etc/profile.d/kafka.sh
export KAFKA_HOME=/usr/local/kafka
export PATH=
P
A
T
H
:
PATH:
PATH:KAFKA_HOME/bin
EOF
sleep 1
source /etc/profile.d/kafka.sh
echo “KAFKA_HOME目录:”${KAFKA_HOME}
echo “(2/6): Kafka环境变量配置完毕”
echo “(3/6): 配置Kafka运行参数…”
sed -i “32i listeners=PLAINTEXT://localhost:9092”
K
A
F
K
A
_
H
O
M
E
/
c
o
n
f
i
g
/
s
e
r
v
e
r
.
p
r
o
p
e
r
t
i
e
s
s
e
d
−
i
"
61
c
l
o
g
.
d
i
r
s
=
{KAFKA\_HOME}/config/server.properties sed -i "61c log.dirs=
KAFKA_HOME/config/server.propertiessed−i"61clog.dirs={KAFKA_HOME}/kafka-logs" ${KAFKA_HOME}/config/server.properties
echo “(3/6): Kafka运行参数配置完毕”
echo “(4/6): 首次启动Kafka…”
kafka-server-start.sh -daemon ${KAFKA_HOME}/config/server.properties
echo “(4/6): Kafka首次启动完毕”
echo “(5/6): 开启9092端口…”
firewall-cmd --zone=public --add-port=9092/tcp --permanent && firewall-cmd --reload
echo “(5/6): 9092端口开启完毕”
echo “(6/6): Kafka加入到service服务并设置开机自启…”
cat <<‘EOF’ > /etc/rc.d/init.d/kafka
#!/bin/bash
chkconfig: 2345 40 60
description: service kafka
processname: kafka
export JAVA_HOME=/usr/local/java
KAFKA_HOME=/usr/local/kafka
case $1 in
start) ${KAFKA_HOME}/bin/kafka-server-start.sh -daemon ${KAFKA_HOME}/config/server.properties;;
stop) ${KAFKA_HOME}/bin/kafka-server-stop.sh;;
status) ${JAVA_HOME}/bin/jps | grep Kafka;;
restart) ${KAFKA_HOME}/bin/kafka-server-stop.sh
${KAFKA_HOME}/bin/kafka-server-start.sh -daemon ${KAFKA_HOME}/config/server.properties;;
*) echo “require start|stop|status|restart”;;
esac
EOF
chmod +x /etc/rc.d/init.d/kafka
先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前在阿里
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上运维知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**