zoukankan      html  css  js  c++  java
  • CENTOS安装ElasticSearch(转)

    From: https://my.oschina.net/topeagle/blog/591451?fromerr=mzOr2qzZ


    CENTOS安装ElasticSearch
    ElasticSearch 概述
    • ElasticSearch是一个高可扩展的开源的全文搜索分析引擎。
      它允许你快速的存储、搜索和分析大量数据。ElasticSearch通常作为后端程序,为需要复杂查询的应用提供服务。
    • Elasticsearch是一个基于Lucene的开源分布式搜索引擎,具有分布式多用户能力。Elasticsearch是用java开发,提供Restful接口,能够达到实时搜索、高性能计算;同时Elasticsearch的横向扩展能力非常强,不需要重启服务,基本上达到了零配置。

    ElasticSearch 安装
    安装前准备
    • 安装JDK7及以上版本(这里不再讲述JDK安装步骤)
    • 下载ElasticSearch安装包,点击 获取elasticsearch-2.1.1.tar.gz安装包
    安装ElasticSearch
    • 运行下面命令将安装包移动到 /opt 目录,然后转到 opt 目录

      mv elasticsearch-2.1.1.tar.gz /opt cd /opt
    • 解压安装包,然后重命名为 elasticsearch

      tar zxvf elasticsearch-2.1.1.tar.gz
       mv elasticsearch-2.1.1 elasticsearch
    • 进入elasticsearch/bin下运行elasticsearch脚本启动

      cd elasticsearch/bin
          ./elasticsearch
    如果是用root启动,需要继续下面步骤
    • 如果是用root账号启动,会报以下错误

      Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Refer to the log for complete error details.
    • 这是出于系统安全考虑设置的条件。由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑,
      建议创建一个单独的用户用来运行ElasticSearch

    • 创建elsearch用户组及elsearch用户

      groupadd elsearch
      useradd elsearch -g elsearch -p elasticsearch
    • 更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch

      cd /opt
      chown -R elsearch:elsearch  elasticsearch
    • 切换到elsearch用户再启动

      su elsearch cd elasticsearch/bin
      ./elasticsearch
    • 启动后打印信息如下

      [2015-12-30 10:15:44,876][WARN ][bootstrap                ] unable to install syscall filter: prctl(PR_GET_NO_NEW_PRIVS): Invalid argument
      [2015-12-30 10:15:45,175][INFO ][node                     ] [Grim Hunter] version[2.1.1], pid[26383], build[40e2c53/2015-12-15T13:05:55Z]
      [2015-12-30 10:15:45,176][INFO ][node                     ] [Grim Hunter] initializing ...
      [2015-12-30 10:15:45,243][INFO ][plugins                  ] [Grim Hunter] loaded [], sites []
      [2015-12-30 10:15:45,272][INFO ][env                      ] [Grim Hunter] using [1] data paths, mounts [[/ (/dev/mapper/vg_yong-lv_root)]], net usable_space [33.3gb], net total_space [49gb], spins? [no], types [ext4]
      [2015-12-30 10:15:47,318][INFO ][node                     ] [Grim Hunter] initialized
      [2015-12-30 10:15:47,318][INFO ][node                     ] [Grim Hunter] starting ...
      [2015-12-30 10:15:47,388][INFO ][discovery                ] [Grim Hunter] elasticsearch/fnXUCLOQQBiC1aR7hhB82Q
      [2015-12-30 10:15:50,442][INFO ][cluster.service          ] [Grim Hunter] new_master {Grim Hunter}{fnXUCLOQQBiC1aR7hhB82Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
      [2015-12-30 10:15:50,491][INFO ][node                     ] [Grim Hunter] started
      [2015-12-30 10:15:50,526][INFO ][gateway                  ] [Grim Hunter] recovered [0] indices into cluster_state
    ElasticSearch后端启动命令
    ./elasticsearch –d




    附常见问题: 
    1, max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] :
      https://my.oschina.net/u/2510243/blog/810520 

    2, http://www.cnblogs.com/woxpp/p/6061073.html
  • 相关阅读:
    ElasticSearch权威指南学习(分布式搜索)
    ElasticSearch5.0之后的改变
    ElasticSearch权威指南学习(排序)
    ElasticSearch权威指南学习(结构化查询)
    ElasticSearch权威指南学习(映射和分析)
    ElasticSearch权威指南学习(分布式文档存储)
    ElasticSearch权威指南学习(文档)
    ElasticSearch权威指南学习(分布式集群)
    ElasticSearch核心知识总结(二)
    [书籍分享]0-006.微信从业人员推荐阅读的100本经典图书
  • 原文地址:https://www.cnblogs.com/zbw911/p/7592227.html
Copyright © 2011-2022 走看看