elasticsearch-安装

一.版本说明

  elasticsearch-5.6.0

  Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

  java version "1.8.0_144"
  Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
  Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

二.解压安装

  tar zvxf elasticsearch-5.6.0.tar.gz

三.目录结构

├── bin

├── config
│   └── scripts
├── data
│   └── nodes
│   └── 0
│   └── _state
├── lib
├── logs
├── modules
│   ├── aggs-matrix-stats
│   ├── ingest-common
│   ├── lang-expression
│   ├── lang-groovy
│   ├── lang-mustache
│   ├── lang-painless
│   ├── parent-join
│   ├── percolator
│   ├── reindex
│   ├── transport-netty3
│   └── transport-netty4
└── plugins

四.启动服务

  ./bin/elasticsearch

[2017-09-16T02:12:39,550][INFO ][o.e.t.TransportService ] [7fXAbFa] publish_address {192.168.239.129:9300}, bound_addresses {[::]:9300}
[2017-09-16T02:12:39,602][INFO ][o.e.b.BootstrapChecks ] [7fXAbFa] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-09-16T02:12:45,330][WARN ][o.e.m.j.JvmGcMonitorService] [7fXAbFa] [gc][young][1][2] duration [4.5s], collections [1]/[5.6s], total [4.5s]/[5.8s], memory [266.2mb]->[43.1mb]/[1.9gb], all_pools {[young] [249.1mb]->[8.6mb]/[266.2mb]}{[survivor] [17mb]->[33.2mb]/[33.2mb]}{[old] [0b]->[7.2mb]/[1.6gb]}
[2017-09-16T02:12:45,415][WARN ][o.e.m.j.JvmGcMonitorService] [7fXAbFa] [gc][1] overhead, spent [4.5s] collecting in the last [5.6s]
[2017-09-16T02:12:53,399][INFO ][o.e.c.s.ClusterService ] [7fXAbFa] new_master {7fXAbFa}{7fXAbFa0Qw61rnNG1BfJIQ}{z9_mWtcORrGu42LUxAvp3g}{192.168.239.129}{192.168.239.129:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-09-16T02:12:53,941][INFO ][o.e.h.n.Netty4HttpServerTransport] [7fXAbFa] publish_address {192.168.239.129:9200}, bound_addresses {[::]:9200}
[2017-09-16T02:12:53,942][INFO ][o.e.n.Node ] [7fXAbFa] started
[2017-09-16T02:12:54,019][INFO ][o.e.g.GatewayService ] [7fXAbFa] recovered [0] indices into cluster_state

五.如何测试是否安装成功

  浏览器输入:ip地址:9200.

{
  "name" : "7fXAbFa",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "OX33WAUQSW6yLg_feAL2-g",
  "version" : {
    "number" : "5.6.0",
    "build_hash" : "781a835",
    "build_date" : "2017-09-07T03:09:58.087Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}
  看到以上内容,说明服务已经启动成功啦.

到了这里服务已启动完毕

注意:启动elk服务不建议用root启动,新建用户并把elk目录权限给新建用户.

六.安装遇到的问题

  1.max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

  执行:sysctl -w vm.max_map_count=262144  注意:临时生效

        永久生效:
    vi /etc/sysctl.conf
    vm.max_map_count=262144
    sysctl -p (这句话必须执行,否则无法及时生效         -      从配置文件“/etc/sysctl.conf”加载内核参数设置)

  2.OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

         # There is insufficient memory for the Java Runtime Environment to continue.
         # Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.
         # An error report file with more information is saved as:
    vi config/jvm.options

  将

  -Xms2g

  -Xmx2g

  修改成

  -Xms512m

  -Xmx512m

  3.max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
     执行:ulimit -n 65536
  永久生效:
  
vi /etc/security/limits.conf 增加内容如下:
  
* hard nofile 65536
  * soft nofile 65536

  安装错误问题汇总:

  http://blog.csdn.net/qq942477618/article/details/53414983

原文地址:https://www.cnblogs.com/zhanghuizong/p/elk.html