• Elasticsearch6.8.12启动常见问题


    1. [2022-09-05T14:35:19,438][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [n32] [controller/8954] [Main.cc@114] controller (64 bit): Version 6.8.12 (Build 39bf066b214253) Copyright (c) 2020 Elasticsearch BV
    2. [2022-09-05T14:35:19,864][DEBUG][o.e.a.ActionModule ] [n32] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
    3. [2022-09-05T14:35:20,080][INFO ][o.e.d.DiscoveryModule ] [n32] using discovery type [zen] and host providers [settings]
    4. [2022-09-05T14:35:21,009][INFO ][o.e.n.Node ] [n32] initialized
    5. [2022-09-05T14:35:21,009][INFO ][o.e.n.Node ] [n32] starting ...
    6. [2022-09-05T14:35:21,473][INFO ][o.e.t.TransportService ] [n32] publish_address {172.20.251.32:9300}, bound_addresses {172.20.251.32:9300}
    7. [2022-09-05T14:35:21,492][INFO ][o.e.b.BootstrapChecks ] [n32] bound or publishing to a non-loopback address, enforcing bootstrap checks
    8. [2022-09-05T14:35:21,496][ERROR][o.e.b.Bootstrap ] [n32] node validation exception
    9. [2] bootstrap checks failed
    10. [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
    11. [2]: memory locking requested for elasticsearch process but memory is not locked
    12. [2022-09-05T14:35:21,498][INFO ][o.e.n.Node ] [n32] stopping ...
    13. [2022-09-05T14:35:21,542][INFO ][o.e.n.Node ] [n32] stopped
    14. [2022-09-05T14:35:21,542][INFO ][o.e.n.Node ] [n32] closing ...
    15. [2022-09-05T14:35:21,558][INFO ][o.e.n.Node ] [n32] closed

    按照提示,修改/etc/security/limits.conf,新增nofile为65536

     修改 /etc/sysctl.conf

    vm.max_map_count = 655360

    sudo sysctl -p 使参数生效,退出后重启elasticsearch

    报错仍热存在。

    1、修改/etc/security/limits.d/20-nproc.conf ,如果没有次文件,修改xx-nproc.conf文件

    1. # cat 20-nproc.conf
    2. # Default limit for number of user's processes to prevent
    3. # accidental fork bombs.
    4. # See rhbz #432903 for reasoning.
    5. * soft nofile 65536
    6. * hard nofile 65536
    7. * soft nproc 65536
    8. root soft nproc unlimited

    修改完后,重新进入,参数还未生效。

    1. [k8s@slcj-rzcl-es elasticsearch]$ ulimit -Hn
    2. 4096
    3. [k8s@slcj-rzcl-es elasticsearch]$ sudo su -
    4. Last login: Mon Sep 5 14:53:57 CST 2022 on pts/0
    5. [root@slcj-rzcl-es ~]# ulimit -Hn
    6. 65536
    7. [root@slcj-rzcl-es ~]#

    普通用户和root用户,执行相同的命令,显示的不一致。即root用户下,改完后是生效了的。

    继续更改配置文件,将/etc/security/limits.conf 中,* 用具体要操作的用户名替代。

    1. k8s soft nofile 65536
    2. k8s hard nofile 65536
    3. k8s soft nproc 65536
    4. k8s hard nproc 65536

    修改/etc/security/limits.d/20-nproc.conf  ,这个文件中,只配置nproc

    1. cat /etc/security/limits.d/20-nproc.conf
    2. # Default limit for number of user's processes to prevent
    3. # accidental fork bombs.
    4. # See rhbz #432903 for reasoning.
    5. * soft nproc 65536
    6. * hard nproc 65536
    7. root soft nproc 65536

    新建配置文件/etc/security/limits.d/def.conf 

    1. [root@slcj-rzcl-es ~]# cat /etc/security/limits.d/def.conf
    2. k8s soft nofile 65536
    3. k8s hard nofile 65536

    配置完,切换普通用户,ulimit -Hn  值未生效。

    继续

    修改 /etc/pam.d/login

    新建/etc/pam.d/sshd  文件,添加如下内容

    1.  [root@slcj-rzcl-es ~]# cat  /etc/pam.d/sshd
    2. session required pam_limits.so

    修改配置文件etc/ssh/ssd_config ,将UsePAM的注释放开

     在切到普通用户,验证成功

    1. [k8s@slcj-rzcl-es elasticsearch]$
    2. [k8s@slcj-rzcl-es elasticsearch]$ ulimit -Hn
    3. 65536
    4. [k8s@slcj-rzcl-es elasticsearch]$
    5. [k8s@slcj-rzcl-es elasticsearch]$
    6. [k8s@slcj-rzcl-es elasticsearch]$
    7. [k8s@slcj-rzcl-es elasticsearch]$ sudo su - root
    8. Last login: Mon Sep 5 18:08:06 CST 2022 on pts/3
    9. [root@slcj-rzcl-es ~]# ulimit -Hn
    10. 65536
    11. [root@slcj-rzcl-es ~]#
    12. [root@slcj-rzcl-es ~]#

    重新启动elasticsearch

    1. [2022-09-05T18:05:23,660][INFO ][o.e.x.s.a.s.FileRolesStore] [n32] parsed [0] roles from file [/data/log4x/apps/elasticsearch/config/roles.yml]
    2. [2022-09-05T18:05:24,235][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [n32] [controller/46559] [Main.cc@114] controller (64 bit): Version 6.8.12 (Build 39bf066b214253) Copyright (c) 2020 Elasticsearch BV
    3. [2022-09-05T18:05:24,686][DEBUG][o.e.a.ActionModule ] [n32] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
    4. [2022-09-05T18:05:24,865][INFO ][o.e.d.DiscoveryModule ] [n32] using discovery type [zen] and host providers [settings]
    5. [2022-09-05T18:05:25,577][INFO ][o.e.n.Node ] [n32] initialized
    6. [2022-09-05T18:05:25,578][INFO ][o.e.n.Node ] [n32] starting ...
    7. [2022-09-05T18:05:25,719][INFO ][o.e.t.TransportService ] [n32] publish_address {172.20.251.32:9300}, bound_addresses {172.20.xx.xx:9300}
    8. [2022-09-05T18:05:25,733][INFO ][o.e.b.BootstrapChecks ] [n32] bound or publishing to a non-loopback address, enforcing bootstrap checks
    9. [2022-09-05T18:05:28,780][INFO ][o.e.c.s.MasterService ] [n32] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {n32}{upc2qZ3vRFS8FNSgfsRU3Q}{I-bKOB_GQWWlVLdlGg3K6w}{172.20.xx.xx}{172.20.xx.xx:9300}{ml.machine_memory=33542516736, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
    10. [2022-09-05T18:05:28,784][INFO ][o.e.c.s.ClusterApplierService] [n32] new_master {n32}{upc2qZ3vRFS8FNSgfsRU3Q}{I-bKOB_GQWWlVLdlGg3K6w}{172.20.xx.xx}{172.20.xx.xx:9300}{ml.machine_memory=33542516736, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {n32}{upc2qZ3vRFS8FNSgfsRU3Q}{I-bKOB_GQWWlVLdlGg3K6w}{172.20.xx.xx}{172.20.xx.xx:9300}{ml.machine_memory=33542516736, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
    11. [2022-09-05T18:05:28,825][INFO ][o.e.h.n.Netty4HttpServerTransport] [n32] publish_address {172.20.251.32:9200}, bound_addresses {172.20.xx.xx:xx}
    12. [2022-09-05T18:05:28,825][INFO ][o.e.n.Node ] [n32] started
    13. [2022-09-05T18:05:29,076][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [n32] Failed to clear cache for realms [[]]
    14. [2022-09-05T18:05:29,116][INFO ][o.e.g.GatewayService ] [n32] recovered [0] indices into cluster_state
    15. [2022-09-05T18:05:29,242][INFO ][o.e.c.m.MetaDataIndexTemplateService] [n32] adding template [.watches] for index patt

    第二天,重启elasticsearch后,发现又重启不了,查看日志,仍报错文件数少的报错。

    挨个检查上面的配置文件,参数都已经设置了,怎么又失效了呢。

    因为没有重启  init 6

    重启完后,就检查了下主机参数,ulimit -Hn ,参数生效。

    至此,完结。

  • 相关阅读:
    LeetCode力扣014:最长公共前缀
    SpringCloud Alibaba—Nacos 服务注册和配置中心
    CMU15445 (Fall 2019) 之 Project#3 - Query Execution 详解
    Linux系统中curl命令用法详解
    Vue输入框卡死
    【高等数学重点题型篇】——不定积分
    呼叫中心和电话营销系统相关知识--中继线路
    DDOS攻击分析
    如何在 Xamarin 中快速集成 Android 版认证服务 - 邮箱地址篇
    基于SSM的论文投稿系统
  • 原文地址:https://blog.csdn.net/red_sky_blue/article/details/126704877