ElasticSearch開機自動啓動

/etc/systemd/system/下新建文件elasticsearch.service

touch elasticsearch.service

編輯elasticsearch.service文件

vi elasticsearch.service
[Unit]
Description=ElasticSearchAutoStartService
[Service]
Type=forking
User=es
ExecStart=/opt/elasticsearch/bin/elasticsearch
[Install]
WantedBy=multi-user.target

啓動服務

systemctl enable elasticsearch
systemctl start elasticsearch

驗證是否自動啓動

# 重啓系統
reboot

# 查看ElasticSearch進程是否已啓動
ps -ef|grep elasticsearch

如需瞭解Centos開機自啓詳細信息請查看我的博文Shell腳本配置Centos7開機自啓動

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