坦笑&&life 2023-04-03 10:50 采纳率: 18.2%
浏览 10

centos7 elasticsearch开机自启动失败

centos7 elasticsearch开机自启动失败

1.在 /etc/systemd/system 创建了 elasticsearch

Unit]
Description=elasticsearch
[Service]
User=elasticsearch
LimitNOFILE=100000
LimitNPROC=100000
# elasticsearch安装路径 (指定自己的安装路径)
ExecStart=/usr/local/elasticsearch/elasticsearch-7.6.2/bin/elasticsearch
[Install]
WantedBy=multi-user.target


sudo systemctl daemon-reload
#设置启动服务
sudo systemctl enable elasticsearch.service
#启动elasticsearch
sudo systemctl start elasticsearch.service

2.在/etc/init.d 创建了 elasticsearch

#!/bin/bash
#chkconfig: 345 63 37
#description: elasticsearch
#processname: elasticsearch-7.3.2
export ES_HOME=/usr/local/elasticsearch-7.3.2
case $1 in
        start)
                su elastic<<!
                cd $ES_HOME
                ./bin/elasticsearch -d -p pid
                exit
!
                echo "elasticsearch is started"
                ;;
        stop)
                pid=`cat $ES_HOME/pid`
                kill -9 $pid
                echo "elasticsearch is stopped"
                ;;
        restart)
                pid=`cat $ES_HOME/pid`
                kill -9 $pid
                echo "elasticsearch is stopped"
                sleep 1
                su elastic<<!
                cd $ES_HOME
                ./bin/elasticsearch -d -p pid
                exit
!
                echo "elasticsearch is started"
        ;;
    *)
        echo "start|stop|restart"
        ;;
esac
exit 0

chmod 777 elasticsearch
chkconfig --add elasticsearch

得到的结果

[root@VM-24-12-centos system]# systemctl status elasticsearch
● elasticsearch.service - SYSV: elasticsearch
   Loaded: loaded (/etc/rc.d/init.d/elasticsearch; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2023-04-03 10:34:54 CST; 12min ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 715 (code=exited, status=217/USER)

Apr 03 10:34:54 VM-24-12-centos systemd[1]: Started elasticsearch.
Apr 03 10:34:54 VM-24-12-centos systemd[1]: elasticsearch.service: main proc...R
Apr 03 10:34:54 VM-24-12-centos systemd[1]: Unit elasticsearch.service enter....
Apr 03 10:34:54 VM-24-12-centos systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

关于权限

[root@VM-24-12-centos es]# ll
total 8
drwxr-xr-x 6 shcms root 4096 Mar 31 18:12 elasticsearch-7.6.1
drwxr-xr-x 4 root  root 4096 Apr  3 09:04 kibana
[root@VM-24-12-centos es]# cd elasticsearch-7.6.1/
[root@VM-24-12-centos elasticsearch-7.6.1]# ll
total 16
drwxrwxr-x  3 shcms shcms 4096 Mar 31 16:57 data
drwxr-xr-x 11 shcms shcms 4096 Mar 31 16:32 elasticsearch-7.6.1
drwxrwxr-x  2 shcms shcms 4096 Mar 31 18:11 installtation
drwxrwxr-x  2 shcms shcms 4096 Apr  3 01:07 log
[root@VM-24-12-centos elasticsearch-7.6.1]#

  • 写回答

2条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-04-03 12:14
    关注
    评论

报告相同问题?

问题事件

  • 创建了问题 4月3日

悬赏问题

  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法