• 安装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值应该一样)

      

  • 相关阅读:
    从头搭建Openstack运行环境(七)--实现负载均衡与外网访问
    ML2分层端口绑定技术在SDN开发中的应用(一)
    从头搭建Openstack运行环境(六)--租户网络间路由与防火墙
    翻译校对1
    pykube-pod.obj的json字符串解析
    第一版k8s
    the server does not allow access to the requested resource
    have fun of Docker
    Clean Development Series
    Understanding the GitHub Flow官方的是最好的,永远要看第一手资料
  • 原文地址:https://www.cnblogs.com/jimboi/p/8732507.html
Copyright © 2020-2023  润新知