zookeeper設(shè)置開機(jī)自啟
/etc/systemd/system/ 文件夾下創(chuàng)建一個(gè)啟動(dòng)腳本 zookeeper.service
chmod 755 zookeeper.service
設(shè)置文件內(nèi)容:
[Unit]
Description=zookeeper.service
After=network.target
[Service]
Type=forking
User=root
Group=root
Environment=ZOO_DIR=/opt/app/zookeeper/bin
Environment=JAVA_HOME=/usr/local/jdk11
ExecStart=/usr/local/zookeeper-3.6.3/bin/zkServer.sh start
ExecStop=/usr/local/zookeeper-3.6.3/bin/zkServer.sh stop
ExecReload=/usr/local/zookeeper-3.6.3/bin/zkServer.sh restart
Restart=always
RestartSec=10
TimeoutSec=360
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable zookeeper
啟動(dòng)zk:systemctl start zookeeper
停止zk:systemctl stop zookeeper
reboot 驗(yàn)證
kafka設(shè)置開機(jī)自啟
安裝目錄:/usr/local/kafka_2.13-2.7.0/
數(shù)據(jù)目錄:/kafka/data
服務(wù)端口:9092
設(shè)置開機(jī)啟動(dòng):
/etc/systemd/system/ 文件夾下創(chuàng)建一個(gè)啟動(dòng)腳本 kafka.service
chmod 755 kafka.service
設(shè)置文件內(nèi)容:
[Unit]
Description=kafka
After=network.target zookeeper.service
[Service]
Type=forking
User=root
Group=root
Environment=JAVA_HOME=/usr/local/jdk11
ExecStart=/usr/local/kafka_2.13-2.7.0/bin/kafka-server-start.sh -daemon /usr/local/kafka_2.13-2.7.0/config/server.properties
ExecStop=/usr/local/kafka_2.13-2.7.0/bin/kafka-server-stop.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable kafka
啟動(dòng):systemctl start kafka
停止:systemctl stop kafka
nginx安裝部署
上傳nginx安裝包
yum -y install gcc gcc-c++ autoconf automake make zlib-developenssl openssl-devel
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1/
./configure —prefix=/usr/local/nginx
make&&make install
cd /usr/local/nginx/sbin
./nginx
lsof -i:80
檢查是否安裝成功:http://10.10.108.2:80/
設(shè)置開機(jī)自啟:
/etc/systemd/system/ 文件夾下創(chuàng)建一個(gè)啟動(dòng)腳本 nginx.service
chmod 755 nginx.service
設(shè)置文件內(nèi)容:
[Unit]
Description=nginx service
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable nginx
啟動(dòng):systemctl start nginx
停止:systemctl stop nginx
reboot 驗(yàn)證是否開機(jī)自啟