如题,Seata 和 Nacos 的自启问题。
很久之前我提过一个类似的问题,https://www.v2ex.com/t/887703 ,当时就是需要执行 Tomcat 的启动脚本,不过当时用 rc-local 解决了,现在却怎么也启动不了了。
这种基于 tomcat 开发的程序大多是有一个启动脚本,执行该脚本后后会自动在后台启动对应的程序。
现在已经尝试过的方案:
systemd 的 service 文件:
[Unit]
Description = NacOS
After = network.target syslog.target
Wants = network.target
[Service]
Type=forking
Environment = "JAVA_HOME=/usr/local/jdk1.8.0_291"
Environment = "JRE_HOME=/usr/local/jdk1.8.0_291/jre"
Environment = "CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib"
Environment = "PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin"
ExecStart=/opt/nacos/bin/startup.sh -m standalone
#ExecStop=/opt/nacos/bin/shutdown.sh
[Install]
WantedBy = multi-user.target
报错:
● nacos.service - NacOS
Loaded: loaded (/etc/systemd/system/nacos.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2022-12-06 13:35:11 CST; 1min 47s ago
Process: 1048 ExecStart=/opt/nacos/bin/startup.sh -m standalone (code=exited, status=0/SUCCESS)
Main PID: 1278 (code=exited, status=127)
Dec 06 13:35:09 localhost.localdomain systemd[1]: Starting NacOS...
Dec 06 13:35:09 localhost.localdomain startup.sh[1048]: /opt/nacos/bin/startup.sh: line 19: uname: command not found
Dec 06 13:35:09 localhost.localdomain startup.sh[1048]: /opt/nacos/bin/startup.sh: line 108: sed: command not found
Dec 06 13:35:11 localhost.localdomain startup.sh[1048]: /usr/local/jdk1.8.0_291/bin/java -Xms2048m -Xmx2048m -Xmn256m -Dnacos.st...:+Prin
Dec 06 13:35:11 localhost.localdomain startup.sh[1048]: nacos is starting with standalone
Dec 06 13:35:11 localhost.localdomain startup.sh[1048]: nacos is starting ,you can check the /opt/nacos/logs/start.out
Dec 06 13:35:11 localhost.localdomain systemd[1]: Started NacOS.
Dec 06 13:35:11 localhost.localdomain systemd[1]: nacos.service: main process exited, code=exited, status=127/n/a
Dec 06 13:35:11 localhost.localdomain systemd[1]: Unit nacos.service entered failed state.
Dec 06 13:35:11 localhost.localdomain systemd[1]: nacos.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
/opt/nacos/logs/start.out
内容:
/usr/local/jdk1.8.0_291/bin/java -Xms2048m -Xmx2048m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/local/jdk1.8.0_291/jre/lib/ext:/usr/local/jdk1.8.0_291/lib/ext -Xloggc:/opt/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/opt/nacos/plugins/health,/opt/nacos/plugins/cmdb -Dnacos.home=/opt/nacos -jar /opt/nacos/target/nacos-server.jar --spring.config.additional-location=file:/opt/nacos/conf/ --logging.config=/opt/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
/opt/nacos/bin/startup.sh: line 142: nohup: command not found
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.