activemq 自啓動

最近設置activemq,遇到一個坑,記錄下來。

centos7,openjdk1.8, activemq5.11.2

設置自啓動是參考了一個設置,具體配置如下

[Unit]
Description=ActiveMQ service
After=network.target

[Service]
WorkingDirectory=/opt/activemq/data
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
User=root
Group=root

[Install]
WantedBy=multi-user.target

啓動之後,無錯誤消息提示,就被kill掉了。系統log如下

activemq: Connecting to pid: 7208
activemq: INFO: There are no brokers to stop.
activemq: .............................
activemq: INFO: Regular shutdown not successful,  sending SIGKILL to process with pid '7208'
systemd: activemq.service: control process exited, code=exited status=1
systemd: Unit activemq.service entered failed state.
systemd: activemq.service failed.

後來換了版本也還是出現同樣的狀況,試了一晚上也沒搞定。

後來看了另一篇,改了一個地方,神奇的居然成功了。

把工作目錄改爲pid文件

更改後如下:

[Unit]
Description=ActiveMQ service
After=network.target

[Service]
PIDFile=/opt/activemq/data/activemq.pid
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
User=root
Group=root

[Install]
WantedBy=multi-user.target

 

 

其實一開始參考這篇文章就直接搞定了。

https://www.vultr.com/docs/how-to-install-apache-activemq-on-centos-7

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章