• Elasticsearch7.4安装部署


    一 ES基础知识介绍

    Near Reamtime(NRT)

    Elasticsearch 是一个实时的查询平台,从索引数据开始到索引数据结束几乎是1s的时间

    Cluster

    集群是一个或多个节点的集合,这些节点一起保存数据,并在所有节点上提供联合索引和搜索功能,集群通过唯一的名称(默认为elasticsearch)加以标记,同一个节点只能加入一个集群中。

    Node

    节点是集群中用来存储数据、参与集群中索引和搜索功能的一台单独的服务器,节点在启动时默认会分配一个随机的UUID作为集群中该节点的身份标识,该名称可以手动在配置文件中指定。

    Index

    Elasticsearch和RDBMS名词对比
    Elasticsearch RDBMS
    Indices(indices1,indices2,indices3...) Database(database1,database2,database3...)
    Types Tables
    Documents Rows
    Fileds Columns

    Elasticsearch7.4下载

    https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-linux-x86_64.tar.gz

    JDK1.8下载

    http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz

    二  安装Elasticsearch

    1. 新建用户,并为用户配置环境变量

    # groupadd -r elasticsearch
    # useradd -r -g elasticsearch -G root elasticsearch
    # cat /home/elasticsearch /.bash_profile 
    
    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    export JAVA_HOME=/usr/java/jdk1.8.0_111
    export ES_HOME=/usr/local/elasticsearch
    export PATH=$JAVA_HOME/bin:$ES_HOME/bin:$PATH

    2. 系统和内核参数优化

    # echo "vm.max_map_count=655360" >> /etc/sysctl.conf
    # sysctl -p
    # cat /etc/security/limits.conf
    elasticsearch soft nproc 65536
    elasticsearch hard nproc 65536
    elasticsearch soft nofile 65536
    elasticsearch hard nofile 65536
    elasticsearch soft memlock unlimited
    elasticsearch hard memlock unlimited

    注:如果不进行参数优化,启动elasticsearch时候可能会报如下错误

    [2018-09-07T09:55:27,564][INFO ][o.e.b.BootstrapChecks    ] [sht-sgmhadoopdn-04] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
    ERROR: [2] bootstrap checks failed
    [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
    [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
    [2018-09-07T09:55:27,572][INFO ][o.e.n.Node               ] [sht-sgmhadoopdn-04] stopping ...
    [2018-09-07T09:55:27,604][INFO ][o.e.n.Node               ] [sht-sgmhadoopdn-04] stopped
    [2018-09-07T09:55:27,604][INFO ][o.e.n.Node               ] [sht-sgmhadoopdn-04] closing ...
    [2018-09-07T09:55:27,613][INFO ][o.e.n.Node               ] [sht-sgmhadoopdn-04] closed

    注:运行elasticsearch的用户最好为elasticsearch,我曾试着用mysqladmin用户运行elasticsearch,但是会报java版本不匹配的错,实际上我的mysqladmin用户的环境变量里已经配置了java,并且已经生效,但是elasticsearch还是读取系统全局的变量,暂时不清楚原因,可以理解为一个未知的bug吧

    $ ./elasticsearch --help
    Elasticsearch requires at least Java 8 but your Java version from /bin/java does not meet this requirement
    [mysqladmin@sht-sgmhadoopdn-04 bin]$ java -version
    java version "1.8.0_111"
    Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
    [mysqladmin@sht-sgmhadoopdn-04 bin]$ which java
    /usr/java/jdk1.8.0_111/bin/java
    [mysqladmin@sht-sgmhadoopdn-04 bin]$ /bin/java -version
    java version "1.7.0_40"
    Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
    Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

     3.修改elasticsearch配置文件

    $ cat elasticsearch.yml  | grep -v "$^" | grep -v "^#"
    cluster.name: dev-es
    node.name: sht-sgmhadoopnn-01
    node.attr.rack: r1
    path.data: /usr/local/elasticsearch/data
    path.logs: /usr/local/elasticsearch/data/logs
    bootstrap.memory_lock: false
    network.host: 0.0.0.0
    http.port: 9200
    cluster.initial_master_nodes: ["sht-sgmhadoopnn-01"]

    4.启动elasticsearch

    $ cd /usr/local/elasticsearch/bin/
    $ ./elasticsearch
    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
    [2019-11-29T21:40:49,749][INFO ][o.e.e.NodeEnvironment    ] [sht-sgmhadoopnn-01] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [41.5gb], net total_space [76.4gb], types [rootfs]
    [2019-11-29T21:40:49,756][INFO ][o.e.e.NodeEnvironment    ] [sht-sgmhadoopnn-01] heap size [1007.3mb], compressed ordinary object pointers [true]
    [2019-11-29T21:40:49,762][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] node name [sht-sgmhadoopnn-01], node ID [VwFAki8mQjqxSuujq579NA], cluster name [dev-es]
    [2019-11-29T21:40:49,763][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] version[7.4.2], pid[15451], build[default/tar/2f90bbf7b93631e52bafb59b3b049cb44ec25e96/2019-10-28T20:40:44.881551Z], OS[Linux/3.10.0-957.12.2.el7.x86_64/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/13.0.1/13.0.1+9]
    [2019-11-29T21:40:49,763][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] JVM home [/usr/local/elasticsearch-7.4.2/jdk]
    [2019-11-29T21:40:49,764][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-14884986979711276651, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/usr/local/elasticsearch, -Des.path.conf=/usr/local/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
    [2019-11-29T21:40:54,923][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [aggs-matrix-stats]
    [2019-11-29T21:40:54,923][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [analysis-common]
    [2019-11-29T21:40:54,924][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [data-frame]
    [2019-11-29T21:40:54,924][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [flattened]
    [2019-11-29T21:40:54,929][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [frozen-indices]
    [2019-11-29T21:40:54,930][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [ingest-common]
    [2019-11-29T21:40:54,930][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [ingest-geoip]
    [2019-11-29T21:40:54,931][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [ingest-user-agent]
    [2019-11-29T21:40:54,931][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [lang-expression]
    [2019-11-29T21:40:54,931][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [lang-mustache]
    [2019-11-29T21:40:54,934][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [lang-painless]
    [2019-11-29T21:40:54,934][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [mapper-extras]
    [2019-11-29T21:40:54,935][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [parent-join]
    [2019-11-29T21:40:54,935][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [percolator]
    [2019-11-29T21:40:54,935][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [rank-eval]
    [2019-11-29T21:40:54,939][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [reindex]
    [2019-11-29T21:40:54,939][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [repository-url]
    [2019-11-29T21:40:54,940][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [search-business-rules]
    [2019-11-29T21:40:54,940][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [spatial]
    [2019-11-29T21:40:54,940][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [transport-netty4]
    [2019-11-29T21:40:54,944][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [vectors]
    [2019-11-29T21:40:54,945][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-analytics]
    [2019-11-29T21:40:54,945][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-ccr]
    [2019-11-29T21:40:54,946][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-core]
    [2019-11-29T21:40:54,946][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-deprecation]
    [2019-11-29T21:40:54,946][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-graph]
    [2019-11-29T21:40:54,953][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-ilm]
    [2019-11-29T21:40:54,954][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-logstash]
    [2019-11-29T21:40:54,954][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-ml]
    [2019-11-29T21:40:54,954][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-monitoring]
    [2019-11-29T21:40:54,955][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-rollup]
    [2019-11-29T21:40:54,955][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-security]
    [2019-11-29T21:40:54,959][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-sql]
    [2019-11-29T21:40:54,959][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-voting-only-node]
    [2019-11-29T21:40:54,960][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] loaded module [x-pack-watcher]
    [2019-11-29T21:40:54,961][INFO ][o.e.p.PluginsService     ] [sht-sgmhadoopnn-01] no plugins loaded
    [2019-11-29T21:41:04,226][INFO ][o.e.x.s.a.s.FileRolesStore] [sht-sgmhadoopnn-01] parsed [0] roles from file [/usr/local/elasticsearch/config/roles.yml]
    [2019-11-29T21:41:06,319][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [sht-sgmhadoopnn-01] [controller/15548] [Main.cc@110] controller (64 bit): Version 7.4.2 (Build 473f61b8a5238b) Copyright (c) 2019 Elasticsearch BV
    [2019-11-29T21:41:07,855][DEBUG][o.e.a.ActionModule       ] [sht-sgmhadoopnn-01] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
    [2019-11-29T21:41:08,615][INFO ][o.e.d.DiscoveryModule    ] [sht-sgmhadoopnn-01] using discovery type [zen] and seed hosts providers [settings]
    [2019-11-29T21:41:10,403][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] initialized
    [2019-11-29T21:41:10,404][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] starting ...
    [2019-11-29T21:41:10,642][INFO ][o.e.t.TransportService   ] [sht-sgmhadoopnn-01] publish_address {172.16.101.55:9300}, bound_addresses {[::]:9300}
    [2019-11-29T21:41:10,657][INFO ][o.e.b.BootstrapChecks    ] [sht-sgmhadoopnn-01] bound or publishing to a non-loopback address, enforcing bootstrap checks
    [2019-11-29T21:41:10,688][INFO ][o.e.c.c.Coordinator      ] [sht-sgmhadoopnn-01] setting initial configuration to VotingConfiguration{VwFAki8mQjqxSuujq579NA}
    [2019-11-29T21:41:11,063][INFO ][o.e.c.s.MasterService    ] [sht-sgmhadoopnn-01] elected-as-master ([1] nodes joined)[{sht-sgmhadoopnn-01}{VwFAki8mQjqxSuujq579NA}{vo1YU6yIR5y3eevPfr-PvQ}{172.16.101.55}{172.16.101.55:9300}{dilm}{ml.machine_memory=6087860224, rack=r1, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, reason: master node changed {previous [], current [{sht-sgmhadoopnn-01}{VwFAki8mQjqxSuujq579NA}{vo1YU6yIR5y3eevPfr-PvQ}{172.16.101.55}{172.16.101.55:9300}{dilm}{ml.machine_memory=6087860224, rack=r1, xpack.installed=true, ml.max_open_jobs=20}]}
    [2019-11-29T21:41:11,180][INFO ][o.e.c.c.CoordinationState] [sht-sgmhadoopnn-01] cluster UUID set to [kfD_MSD4SOSuF0gPlKBWVQ]
    [2019-11-29T21:41:11,257][INFO ][o.e.c.s.ClusterApplierService] [sht-sgmhadoopnn-01] master node changed {previous [], current [{sht-sgmhadoopnn-01}{VwFAki8mQjqxSuujq579NA}{vo1YU6yIR5y3eevPfr-PvQ}{172.16.101.55}{172.16.101.55:9300}{dilm}{ml.machine_memory=6087860224, rack=r1, xpack.installed=true, ml.max_open_jobs=20}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
    [2019-11-29T21:41:11,428][INFO ][o.e.h.AbstractHttpServerTransport] [sht-sgmhadoopnn-01] publish_address {172.16.101.55:9200}, bound_addresses {[::]:9200}
    [2019-11-29T21:41:11,429][INFO ][o.e.n.Node               ] [sht-sgmhadoopnn-01] started
    [2019-11-29T21:41:11,669][INFO ][o.e.g.GatewayService     ] [sht-sgmhadoopnn-01] recovered [0] indices into cluster_state
    [2019-11-29T21:41:12,228][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.triggered_watches] for index patterns [.triggered_watches*]
    [2019-11-29T21:41:12,370][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.watches] for index patterns [.watches*]
    [2019-11-29T21:41:12,517][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.watch-history-10] for index patterns [.watcher-history-10*]
    [2019-11-29T21:41:12,637][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.slm-history] for index patterns [.slm-history-1*]
    [2019-11-29T21:41:12,741][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-7-*]
    [2019-11-29T21:41:12,916][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.monitoring-es] for index patterns [.monitoring-es-7-*]
    [2019-11-29T21:41:13,079][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.monitoring-beats] for index patterns [.monitoring-beats-7-*]
    [2019-11-29T21:41:13,195][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.monitoring-alerts-7] for index patterns [.monitoring-alerts-7]
    [2019-11-29T21:41:13,291][INFO ][o.e.c.m.MetaDataIndexTemplateService] [sht-sgmhadoopnn-01] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-7-*]
    [2019-11-29T21:41:13,385][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [sht-sgmhadoopnn-01] adding index lifecycle policy [watch-history-ilm-policy]
    [2019-11-29T21:41:13,503][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [sht-sgmhadoopnn-01] adding index lifecycle policy [slm-history-ilm-policy]
    [2019-11-29T21:41:13,934][INFO ][o.e.l.LicenseService     ] [sht-sgmhadoopnn-01] license [c6634b36-15ab-4c2f-a1d1-01dfc4dafe4e] mode [basic] - valid
    [2019-11-29T21:41:13,935][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [sht-sgmhadoopnn-01] Active license is now [BASIC]; Security is disabled
    View Code

    注:我在CentOS6启动时会报错

    [2018-09-10T10:35:24,090][WARN ][o.e.b.JNANatives         ] unable to install syscall filter: 
    java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
        at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:350) ~[elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:638) ~[elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:245) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.cli.Command.main(Command.java:88) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.5.3.jar:5.5.3]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.5.3.jar:5.5.3]

    https://github.com/elastic/elasticsearch/issues/22899

    解决办法:在elasticsearch.yml配置文件添加

    bootstrap.memory_lock: false
    bootstrap.system_call_filter: false

    注:不加任何参数为前台启动,以后台进程启动的话需执行下面的命令

    [elsearch@sht-sgmhadoopdn-04 bin]$ ./elasticsearch &

    [elsearch@sht-sgmhadoopdn-04 bin]$ ./elasticsearch -d

    5.将elasticsearch添加为系统服务

    # cat /usr/lib/systemd/system/elasticsearch.service
    [Unit]
    Description=Elasticsearch
    Documentation=http://www.elastic.co
    Wants=network-online.target
    After=network-online.target
    
    [Service]
    Type=notify
    RuntimeDirectory=elasticsearch
    PrivateTmp=true
    Environment=ES_HOME=/usr/local/elasticsearch
    Environment=ES_PATH_CONF=/usr/local/elasticsearch/config
    Environment=PID_DIR=/var/run/elasticsearch
    Environment=ES_SD_NOTIFY=true
    EnvironmentFile=-/etc/sysconfig/elasticsearch
    
    WorkingDirectory=/usr/local/elasticsearch
    
    User=elasticsearch
    Group=elasticsearch
    Type=forking
    Restart=always
    
    ExecStart=/usr/local/elasticsearch/bin/elasticsearch -d -p ${PID_DIR}/elasticsearch.pid
    
    # StandardOutput is configured to redirect to journalctl since
    # some error messages may be logged in standard output before
    # elasticsearch logging system is initialized. Elasticsearch
    # stores its logs in /var/log/elasticsearch and does not use
    # journalctl by default. If you also want to enable journalctl
    # logging, you can simply remove the "quiet" option from ExecStart.
    StandardOutput=journal
    StandardError=inherit
    
    # Specifies the maximum file descriptor number that can be opened by this process
    LimitNOFILE=65535
    
    # Specifies the maximum number of processes
    LimitNPROC=4096
    
    # Specifies the maximum size of virtual memory
    LimitAS=infinity
    
    # Specifies the maximum file size
    LimitFSIZE=infinity
    
    # Disable timeout logic and wait until process is stopped
    TimeoutStopSec=0
    
    # SIGTERM signal is used to stop the Java process
    KillSignal=SIGTERM
    
    # Send the signal only to the JVM rather than its control group
    KillMode=process
    
    # Java process is never killed
    SendSIGKILL=no
    
    # When a JVM receives a SIGTERM signal it exits with code 143
    SuccessExitStatus=143
    
    [Install]
    WantedBy=multi-user.target
    
    # Built for ${project.name}-${project.version} (${project.name})
    # systemctl daemon-reload
    # systemctl enable elasticsearch
    # systemctl start elasticsearch
    # systemctl status elasticsearch
    ● elasticsearch.service - Elasticsearch
       Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
       Active: active (running) since Fri 2019-12-06 21:29:41 CST; 34s ago
         Docs: http://www.elastic.co
      Process: 8675 ExecStart=/usr/local/elasticsearch/bin/elasticsearch -d -p ${PID_DIR}/elasticsearch.pid (code=exited, status=0/SUCCESS)
     Main PID: 8756 (java)
        Tasks: 66
       Memory: 1.2G
       CGroup: /system.slice/elasticsearch.service
               ├─8756 /usr/local/elasticsearch/jdk/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+Alw...
               └─8774 /usr/local/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
    
    Dec 06 21:29:39 sht-sgmhadoopnn-01 systemd[1]: Starting Elasticsearch...
    Dec 06 21:29:41 sht-sgmhadoopnn-01 systemd[1]: Started Elasticsearch.
  • 相关阅读:
    Oracle 实现自动递增的功能
    解决升级chrome导致“Silverlight ”插件失效
    解决笔记:转载篇
    MSP432在CCS上新建工程,导入固件库
    操作系统复习文档
    数据结构
    数据结构
    蓝桥
    ACM山东工商 数据结构与算法 第3章 双向栈的操作
    ACM山东工商 栈和队列算法练习
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/9603713.html
Copyright © 2020-2023  润新知