The first article

Installation and deployment Elastic Search

  1. In the /home/directory new elasticfolder, switch this file.

    cd /home
    mkdir elastic
    cd elastic
  2. downloadwget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz

  3. Decompression.tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz

  4. start upsh elasticsearch

    Will find the error, the error message:

    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
    [2019-09-24T10:27:40,249][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [localhost.localdomain] uncaught exception in thread [main]
    org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
     at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.3.2.jar:7.3.2]
     at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.3.2.jar:7.3.2]
     at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.3.2.jar:7.3.2]
    Caused by: java.lang.RuntimeException: can not run elasticsearch as root
     at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.3.2.jar:7.3.2]
     at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.3.2.jar:7.3.2]
     ... 6 more
    

    Meaning can not be started by the root user, then we create a new user to start.

    useradd elastic
    chown -R elastic:elastic elasticsearch-7.3.2
    su elastic
    sh elasticsearch-7.3.2/bin/elasticsearch

    Then start successfully. But now is the front desk to start, we can Ctrl + Cwithdraw, then sh elasticsearch-7.3.2/bin/elasticsearch -dthe command to start the background.

  5. After the start can use ps -ef | grep elasticsearchto view the process.

    elastic  14992     1 99 10:31 pts/1    00:00:24 /home/elastic/elasticsearch-7.3.2/jdk/bin/java -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 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch-13731651965100738695 -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=/home/elastic/elasticsearch-7.3.2 -Des.path.conf=/home/elastic/elasticsearch-7.3.2/config -Des.distribution.flavor=default -Des.distribution.type=tar -Des.bundled_jdk=true -cp /home/elastic/elasticsearch-7.3.2/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
    elastic  15008 14992  0 10:31 pts/1    00:00:00 /home/elastic/elasticsearch-7.3.2/modules/x-pack-ml/platform/linux-x86_64/bin/controller
    elastic  15024 14732  0 10:31 pts/1    00:00:00 grep --color=auto elasticsearch
  6. Test curl http://localhost:9200access . Displays the following information:

    {
      "name" : "localhost.localdomain",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "VFVnijYtRSOOaLP0HP37ow",
      "version" : {
        "number" : "7.3.2",
        "build_flavor" : "default",
        "build_type" : "tar",
        "build_hash" : "1c1faf1",
        "build_date" : "2019-09-06T14:40:30.409026Z",
        "build_snapshot" : false,
        "lucene_version" : "8.1.0",
        "minimum_wire_compatibility_version" : "6.8.0",
        "minimum_index_compatibility_version" : "6.0.0-beta1"
      },
      "tagline" : "You Know, for Search"
    }
  7. In the host computer to access external failure.

    An error

    ERROR: [2] bootstrap checks failed
    [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
    [2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
    

    Switching the root user,vi /etc/security/limits.conf

    In the penultimate line

    * soft nofile 65536
    * hard nofile 65536
    # End of file

    vi /etc/sysctl.confAdd to

    vm.max_map_count=655360

    After saving execution sysctl -p.

    Start, error

    ERROR: [1] bootstrap checks failed
    [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

    Modify elasticsearch.yml, cancel reservations a comment node
    cluster.initial_master_nodes: ["node-1","node-2"]

    Start again, ok. In an external browser access: HTTP: // ip: 9200

    {
      "name" : "localhost.localdomain",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "VFVnijYtRSOOaLP0HP37ow",
      "version" : {
        "number" : "7.3.2",
        "build_flavor" : "default",
        "build_type" : "tar",
        "build_hash" : "1c1faf1",
        "build_date" : "2019-09-06T14:40:30.409026Z",
        "build_snapshot" : false,
        "lucene_version" : "8.1.0",
        "minimum_wire_compatibility_version" : "6.8.0",
        "minimum_index_compatibility_version" : "6.0.0-beta1"
      },
      "tagline" : "You Know, for Search"
    }

    ok.

  8. References:

    https://blog.csdn.net/happyzxs/article/details/89156068

    http://blog.java1234.com/blog/articles/342.html

Guess you like

Origin www.cnblogs.com/kjgym/p/11577544.html