nacos 加入開機啟動

walkersss發表於2024-12-06

cd /usr/lib/systemd/system/
vi nacos.service

[Unit]
Description=nacos
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nacos/bin/startup.sh -m standalone
ExecReload=/usr/local/nacos/bin/shutdown.sh
ExecStop=/usr/local/nacos/bin/shutdown.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

----------------------------------------------
systemctl enable nacos.service
systemctl daemon-reload

修改nacos的bin目錄下的啟動指令碼,startup.sh
修改jdk路徑和記憶體分配的大小

[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/local/jdk1.8.0_201/
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/taobao/java
[ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME


------------------------------------------------------------------
把 nacos.service 設定開機自啟
systemctl enable nacos.service

檢視是否開機自啟​
systemctl is-enabled nacos.service

啟動nacos.service 服務
systemctl start nacos.service

刪除nacos.service 服務開機自啟
systemctl disable nacos.service

開機驗證:重啟系統
reboot


#單機模式啟動
./startup.cmd -m standalone

相關文章