linux安装elasticsearch5.5

大家好,我是烤鸭:

我是采用官网下载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



本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/413061.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

eclipse创建folder变成package解决方案

1,项目右键—-选择properties 2,选择Java Build Path—-选择Source 3,选择xxxx/src/main/resources下面的Excluded,点击Edit 4,在Exclusion patterns下面选中第一个,点击右边的edit 5,方案一:在Browse按钮左边的输入框修改为 ** 方案二:…

[css] 手写一个使用css3旋转硬币的效果

[css] 手写一个使用css3旋转硬币的效果 两种实现方式&#xff1a;1、animationkeyframes 2、transition&#xff1a; //第一种实现方式 <style type"text/css"> .around{ width:200px; height:200px; background:orange; /*圆形的话看不出效果&#xff0c;所以…

0076-小升初1:生日蛋糕

题目 小升初1&#xff1a;生日蛋糕难度级别&#xff1a;B&#xff1b; 运行时间限制&#xff1a;1000ms&#xff1b; 运行空间限制&#xff1a;256000KB&#xff1b; 代码长度限制&#xff1a;2000000B 试题描述一个中学生&#xff08;在线测评系统的系统管理员&#xff09;过生…

tomcat9-jenkins:insufficient free space available after evicting expired cache entries-consider

解决该问题方法&#xff0c;修改tomcat/conf/context.xml文件&#xff0c;增加资源最大可缓存的大小&#xff1a;<Context><!-- Default set of monitored resources. If one of these changes, the --><!-- web application will be reloaded. …

[css] height和line-height的区别是什么呢?

[css] height和line-height的区别是什么呢&#xff1f; height&#xff1a;元素content area的高度line-height&#xff1a;元素中&#xff0c;多行文字基线的距离个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易&#xff0c; 但坚持一定很酷。欢迎大…

laydate根据开始时间或者结束时间限制范围

$(window).load(function(){//初始化时间控件var cartimeDate laydate.render({elem: #cartime //用车时间,type: datetime,format: yyyy-MM-dd HH:mm,done:function(value, date){returntimeDate.config.mingetDateArray(date);//重点}});var returntimeDate laydate.render…

Django Form -- 字段的用法扩展

form.py的代码 from django import forms from django.forms import fields from django.forms import widgetsclass DetailForm(forms.Form):inp fields.CharField()required inp fields.CharField(requiredFalse)  #表单可以为空 inp fields.CharField(requiredTrue) …

linux部署jenkins,tomcat9

大家好&#xff0c;我是烤鸭&#xff1a;今天分享的是 linux部署jenkins,tomcat9 安装环境&#xff1a;linux centos7.2tomcat 9.1Jenkins 2.73JDK 1.8maven 3.5git 2.91. 下载jenkins&#xff1a;https://jenkins.io/download/ 我选择的war下载。2. 安装…

[css] 请用css写一个扫码的加载动画图

[css] 请用css写一个扫码的加载动画图 Keyframes donut-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .donut { display: inline-block; border: 4px solid rgba(0, 0, 0, 0.1); border-left-color: #7983ff; border-radius: 50%; width: 3…

java.lang.OutOfMemoryError: PermGen space及其解决方法

Run—-Debug Configurations -Xms2096m -Xmx2096m -XX:MaxNewSize2096m -XX:MaxPermSize2096m

【洛谷P1795 无穷的序列_NOI导刊2010提高(05)】模拟

分析 map搞一下 AC代码 #include <bits/stdc.h> using namespace std; map<int,int> mp; inline int read() {int w0,x0; char ch0;while (!isdigit(ch)) {w|ch-;chgetchar();}while (isdigit(ch)) {x(x<<1)(x<<3)(ch^48);chgetchar();}return w?-x:x…

[css] 举例说明伪类:focus-within的用法

[css] 举例说明伪类:focus-within的用法 类似于事件的冒泡机制&#xff0c;可以从获取焦点的元素一职冒泡到根元素上个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易&#xff0c; 但坚持一定很酷。欢迎大家一起讨论 主目录 与歌谣一起通关前端面试…

jeesite的junit,数据没有插入?

jeesite框架自带的test方法 在common/test/SpringTransactionalContextTests.class 说一下遇到的问题。 sql执行成功了,但是数据库没有数据。what&#xff1f;&#xff1f;&#xff1f; 第一时间就想到了是事务的问题&#xff0c;事务没有提交。 RunWith(SpringJUnit4Class…

Zimbra开发接口文档API下载地址

开源版本下载地址: https://www.zimbra.com/documentation/ 文档API接口下载地址: https://wiki.zimbra.com/wiki/SOAP_API_Reference_Material_Beginning_with_ZCS_8 其他资料(每条互不关联): 1,构建: https://wiki.zimbra.com/index.php?titleBuilding_Zimbra_Desktop…

[css] border-radius:50%和border-radius:100%有什么区别?

[css] border-radius:50%和border-radius:100%有什么区别&#xff1f; 这个实际上可以仔细区分一下&#xff0c;楼上的两个图具体来说应该是 border-top-left-radius 的50%和100%的区别&#xff0c;假如我们直接设置border-radius: 100%; 或者为50%我们会发现这两个图实际上没…

JAVA实现美团电影价格抓取(附代码)

各位老大好&#xff0c;我是烤鸭&#xff1a; 最近在研究爬虫,看到有意思的是美团的电影票价&#xff0c;普通的抓取是抓不到的。例如网址&#xff1a;http://bj.meituan.com/shop/105355906?mtt1.movie/cinemalist.0.0.j8oaf2un&#xff08;当你打开403或者404的话&#xff0…

使用jieba和wordcloud进行中文分词并生成《悲伤逆流成河》词云

因为词云有利于体现文本信息&#xff0c;所以我就将那天无聊时爬取的《悲伤逆流成河》的评论处理了一下&#xff0c;生成了词云。 关于爬取影评的爬虫大概长这个样子(实际上是没有爬完的): #!/usr/bin/env python # -*- coding: utf-8 -*- # Time : 2018/10/15 16:34 # Auth…

[css] 如何使用CSS实现段落首字母或首字放大效果?

[css] 如何使用CSS实现段落首字母或首字放大效果&#xff1f; ::first-letter 伪元素选择器p::first-letter {font-size: 2em;font-weight: bold; }个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易&#xff0c; 但坚持一定很酷。欢迎大家一起讨论 主…

jqweui的picker动态加载数据

大家好&#xff0c;我是烤鸭&#xff1a; jqweui的picker动态加载数据 jqweui是jquery对weui的拓展开发,picker就是其中的一个拓展组件&#xff0c; 1. 先附上官网显示地址和代码&#xff1a; http://jqweui.com/extends#picker <input type"text" idpicker/&g…

eclipse的workset项目重复显示解决方案

问题描述: 两个workset里面出现同样的项目 解决方案: 1,删除某一个workset 2,File - NEW - Other - Java Working Set 3,输入刚刚删除的那一个workset的名称 4,在workspace content中选择你要加入的项目,然后点击Finish