大家好,我是烤鸭:

我是采用官网下载tar包的方式安装的。

安装环境:centos 7.2,jdk1.8

下载地址:
https://www.elastic.co/downloads/elasticsearch
1.解压缩:
解压 elasticsearch.5.5.2.tar.gz

tar -zxvf  elasticsearch-5.2.2.tar.gz

2.创建用户:
因为Elasticsearch5.0之后,不能使用root账户启动,我们先创建一个elasticsearch组和账户

useradd  elasticsearch -g elasticsearch -p elasticsearch
chown -R elasticsearch:elasticsearch elasticsearch-5.2.2

3.修改配置文件:
贴一下我的elasticsearch.yml配置文件::

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#   集群名称
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#   节点名称
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#数据路径(我是在elasticsearch的安装目录下新建了data文件夹)
path.data: /usr/my/elasticsearch/elasticsearch-5.5.2/data
# Path to log files:
#日志路径(我是在elasticsearch的安装目录下新建了logs文件夹)
path.logs: /usr/my/elasticsearch/elasticsearch-5.5.2/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# 当JVM开始写入交换空间时(swapping)ElasticSearch性能会低下,你应该保证它不会写入交换空间
# 设置这个属性为true来锁定内存,同时也要允许elasticsearch的进程可以锁住内存,linux下可以通过 `ulimit -l unlimited` 命令
bootstrap.memory_lock: false
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#设置绑定的ip地址,可以是ipv4或ipv6的,默认为0.0.0.0
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
# 设置对外服务的http端口,默认为9200
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#这是一个集群中的主节点的初始列表,当节点(主节点或者数据节点)启动时使用这个列表进行探测 ["192.168.0.1(服务器ip):9300"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
# 设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点.默认为1,对于大的集群来说,可以设置大一点的值(2-4)
discovery.zen.minimum_master_nodes: 1
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#开启跨域访问支持,默认为false
http.cors.enabled: true
#跨域访问允许的域名地址,以上使用正则,(域名这里我替换了IP /http?:\/\/192.168.10.139(:[0-9]+)?/)
http.cors.allow-origin: "*"

4.启动
可以前台启动或者后台启动,进入elasticsearch目录
前台启动:

./bin/elasticsearch

后台启动:(个人喜欢后台启动,启动失败可以logs下查看日志方便)

./bin/elasticsearch -d

按照以上配置,我的是可以正常启动的。

另外说一下,防火墙,阿里云是有安全组配置的,如果不在安全组开放端口的话,服务器关闭防火墙也是没用的。
贴一下centos 7.2,7.3关闭防火墙的命令:
关闭防火墙:

systemctl stop firewalld.service

关闭防火墙开机自启动功能:

systemctl disable firewalld.service

出现以下命令,就启动成功了:

[2017-09-20T10:36:10,400][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [29.9gb], net total_space [39.2gb], spins? [unknown], types [rootfs]
[2017-09-20T10:36:10,401][INFO ][o.e.e.NodeEnvironment    ] [node-1] heap size [495.3mb], compressed ordinary object pointers [true]
[2017-09-20T10:36:10,401][INFO ][o.e.n.Node               ] [node-1] node name [node-1], node ID [uoi6ZmIbSNGu6xaol_OCpw]
[2017-09-20T10:36:10,402][INFO ][o.e.n.Node               ] [node-1] version[5.5.2], pid[9979], build[b2f0c09/2017-08-14T12:33:14.154Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
[2017-09-20T10:36:10,402][INFO ][o.e.n.Node               ] [node-1] JVM arguments [-Xms512m, -Xmx512m, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/my/elasticsearch/elasticsearch-5.5.2]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [aggs-matrix-stats]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-common]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-expression]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-groovy]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-mustache]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-painless]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [parent-join]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [percolator]
[2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [reindex]
[2017-09-20T10:36:11,175][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty3]
[2017-09-20T10:36:11,175][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty4]
[2017-09-20T10:36:11,175][INFO ][o.e.p.PluginsService     ] [node-1] no plugins loaded
[2017-09-20T10:36:12,770][INFO ][o.e.d.DiscoveryModule    ] [node-1] using discovery type [zen]
[2017-09-20T10:36:13,234][INFO ][o.e.n.Node               ] [node-1] initialized
[2017-09-20T10:36:13,235][INFO ][o.e.n.Node               ] [node-1] starting ...
[2017-09-20T10:36:13,389][INFO ][o.e.t.TransportService   ] [node-1] publish_address {172.17.214.191:9300}, bound_addresses {0.0.0.0:9300}
[2017-09-20T10:36:13,398][INFO ][o.e.b.BootstrapChecks    ] [node-1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-09-20T10:36:16,446][INFO ][o.e.c.s.ClusterService   ] [node-1] new_master {node-1}{uoi6ZmIbSNGu6xaol_OCpw}{kGPZi3xEREuq_Nb-s5yEKQ}{172.17.214.191}{172.17.214.191:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-09-20T10:36:16,469][INFO ][o.e.g.GatewayService     ] [node-1] recovered [0] indices into cluster_state
[2017-09-20T10:36:16,469][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-1] publish_address {172.17.214.191:9200}, bound_addresses {0.0.0.0:9200}
[2017-09-20T10:36:16,469][INFO ][o.e.n.Node               ] [node-1] started

访问成功:

关于之前遇到的坑,也记录一下:

1、Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

修改elasticsearch目录中config/jvm.options
vim config/jvm.options
将原来的:

-Xms2g
-Xmx2g 

修改为:

-Xms512m
-Xmx512m

2、max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
修改 /etc/security/limits.d/90-nproc.conf

*          soft    nproc     1024
*          soft    nproc     2048

3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf配置文件,

cat /etc/sysctl.conf | grep vm.max_map_count
vm.max_map_count=262144

如果不存在则添加

echo "vm.max_map_count=262144" >>/etc/sysctl.conf

4.uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address];

修改elasticsearch下的config/elasticsearch.yml
这里的network.host原本写的是服务器ip地址,
改成

network.host: 0.0.0.0

也有的说是,之前生成的结点数据没有清除,
找到配置文件中的配置的结点目录(path.data: /usr/my/elasticsearch/elasticsearch-5.5.2/dat)

清空原来的内容

5.[1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
修改elasticsearch下的config/elasticsearch.yml
修改bootstrap.memory_lock:true

bootstrap.memory_lock: false

linux安装elasticsearch5.5相关推荐

  1. linux 查看es安装目录,Linux安装Elasticsearch

    本文介绍Linux环境如何安装Elasticsearch. 本文环境是在腾讯云服务器CentOS7.2搭建的,JDK1.8,elasticsearch-5.4.2. 1 安装JDK 网上教程很多,也可 ...

  2. 详解centos7虚拟机安装elasticsearch5.0.x-安装篇(自己做测试了,es启动有错误可以在这上面找)

    本篇文章主要介绍了centos7虚拟机安装elasticsearch5.0.x-安装篇,具有一定的参考价值,感兴趣的小伙伴们可以参考一下. centos7虚拟机安装elasticsearch5.0.x ...

  3. 实用的Linux 安装 zip unzip

    Linux 安装 zip unzip 1.apt-get 安装 apt-get install zip 2.yum 安装 yum install -y unzip zip 命令实例 1.把/home目 ...

  4. nginx linux 安装

    nginx linux 安装 进入http://nginx.org/en/download.html 下载 n  gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gc ...

  5. Linux安装Nodejs

    Linux安装Nodejs 阿里云镜像: https://npm.taobao.org/mirrors/node/ 选择所需版本,进行下载. 我这边下载的是:https://npm.taobao.or ...

  6. linux命令安装组件,Linux安装各种组件

    [TOC] Linux安装各种组件 ============================= ## 安装JDK 官网下载最新JDK ``` http://www.oracle.com/technet ...

  7. arch linux安装_如何从头开始安装Arch Linux

    arch linux安装 by Andrea Giammarchi 由Andrea Giammarchi In this article, you'll learn how to install Ar ...

  8. linux安装eclipse运行web,Linux安装Tomcat,运行Eclipse,web项目

    到官网下载:https://tomcat.apache.org/download-80.cgi  在这里是8.5.39版本 下载tar,gz 提取解压后,我这里是放到opt目录下 cd  切换目录 / ...

  9. Linux安装CentOS7(图文详解)

    Linux安装centos7 准备 软件:VMware workstation 镜像文件:CentOS-7-x86_64-Minimal-1810.iso 一.安装centos7 1.点击创建新的虚拟 ...

最新文章

  1. python高阶函数filter_Python进阶系列连载(13)——Python内置高阶函数filter(上)...
  2. 前端学习(3054):vue+element今日头条管理-状态展示处理
  3. python什么软件开发好_python怎样才能学好?python软件开发什么
  4. 《高性能MySQL》读书笔记-mysql数据类型和应用
  5. 拓端tecdat|R语言实现MCMC中的Metropolis–Hastings算法与吉布斯采样
  6. Linux 安装flash
  7. 从零开始了解 kubernetes,还有谁不会?
  8. 公司年会要求搞一个抽奖程序,及时安排一波
  9. 基于opencv的对CV_16U深度图像MAT中某点的像素值提取问题
  10. 计算机休眠唤醒后没声音,MacBook Pro从睡眠模式中唤醒后突然没有声音
  11. C++基础知识 - 浮点类型
  12. 群聊消息“已读”/“未读” 功能解决方案!
  13. chrome控制台如何把vw显示成px_Chrome 开发者工具的11 个高级使用技巧
  14. 【水果识别】柑橘质量检测及分级系统【含GUI Matlab源码 738期】
  15. P2791 幼儿园篮球题
  16. excel单元格内容拆分_自学EXCEL小技巧003→单元格内容拆分
  17. vs2019创建dll以及使用
  18. 3. ESP8266开发板自动连接室内Wi-Fi
  19. Go语言Web项目搭建
  20. 【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(十五)

热门文章

  1. [html] Standards模式和Quirks模式有什么区别?
  2. [vue] vue要做权限管理该怎么做?如果控制到按钮级别的权限怎么做?
  3. 工作324:uni-时间过滤器封装
  4. 前端学习(2749):uniapp项目目录结构介绍
  5. “约见”面试官系列之常见面试题之第一百零七篇之vue的作用(建议收藏)
  6. 前端学习(1607):跨域请求
  7. 前端学习(1045):todolist本地存储加载到页面
  8. 前端学习(687):for循环执行流程
  9. 第一百零三期:解读回归测试:类型、选择、挑战和实践
  10. html:(36):间距和对齐