• 安装ElasticSearch


    官网:https://www.elastic.co/guide/en/elasticsearch/reference/5.6/rpm.html

    Download and install the public signing key:

    rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

    Installing from the RPM repository

    add the repository file /etc/yum.repos.d/elasticsearch.repo with the following contents

    [elasticsearch-5.x]
    name=Elasticsearch repository for 5.x packages
    baseurl=https://artifacts.elastic.co/packages/5.x/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    autorefresh=1
    type=rpm-md

    install Elasticsearch :

    sudo yum install elasticsearch 

    Running Elasticsearch with systemd

    To configure Elasticsearch to start automatically when the system boots up, run the following commands:

    sudo /bin/systemctl daemon-reload
    sudo /bin/systemctl enable elasticsearch.service

    Elasticsearch can be started and stopped as follows:

    sudo systemctl start elasticsearch.service
    sudo systemctl stop elasticsearch.service

    These commands provide no feedback as to whether Elasticsearch was started successfully or not. Instead, this information will be written in the log files located in /var/log/elasticsearch/.

    By default the Elasticsearch service doesn’t log information in the systemd journal. To enable journalctl logging, the --quiet option must be removed from the ExecStart command line in the elasticsearch.service file.

    When systemd logging is enabled, the logging information are available using the journalctlcommands:

    To tail the journal:

    sudo journalctl -f

    To list journal entries for the elasticsearch service:

    sudo journalctl --unit elasticsearch

    To list journal entries for the elasticsearch service starting from a given time:

    sudo journalctl --unit elasticsearch --since  "2016-10-30 18:17:16"

    Checking that Elasticsearch is running

    You can test that your Elasticsearch node is running by sending an HTTP request to port 9200 on localhost:

    curl -X get localhost:9200

    which should give you a response something like this:

    {
      "name" : "Cp8oag6",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
      "version" : {
        "number" : "5.6.8",
        "build_hash" : "f27399d",
        "build_date" : "2016-03-30T09:51:41.449Z",
        "build_snapshot" : false,
        "lucene_version" : "6.6.1"
      },
      "tagline" : "You Know, for Search"
    }

    配置文件:

    [root@localhost elasticsearch]# pwd
    /etc/elasticsearch
    [root@localhost elasticsearch]# ll
    total 16
    -rw-rw----. 1 root elasticsearch 2875 Apr  7 09:58 elasticsearch.yml
    -rw-rw----. 1 root elasticsearch 3068 Apr  7 10:10 jvm.options
    -rw-rw----. 1 root elasticsearch 4456 Feb 17 00:48 log4j2.properties
    drwxr-x---. 2 root elasticsearch    6 Feb 17 00:48 scripts

      

    NOTE1:通过ip:9200无法访问

           解决方案:修改elasticsearch.yml文件的network.host属性

    NOTE2:elasticsearch因内存不足启动失败

        解决方案:修改jvm.options文件的-Xms和-Xmx值(Xms和Xmx值应该一样)

      

  • 相关阅读:
    JQUERY1.9学习笔记 之基本过滤器(八) 最后元素选择器
    解决接收参数乱码,tomcat的URIEncoding=UTF-8
    mac下配置maven
    [forwarding] Struts2中action接收中文参数为乱码解决方法
    [forwarding]软考复习之软件架构风格
    [forwarding]Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允许问题
    [forwarding]详解Linux命令行下常用svn命令
    [forwarding]mysql用户授权
    【转】Hibernate 查询语言Query Language(HQL)
    java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I错误
  • 原文地址:https://www.cnblogs.com/jimboi/p/8732507.html
Copyright © 2020-2023  润新知