centos7虚拟机安装elasticsearch5.0.x-安装篇
https://blog.csdn.net/u012371450/article/details/51776505
请预先安装jdk
创建新用户(非root用户)
elasticsearch只能用非root启动,这里我创建了一个叫seven的用户
[root@localhost ~]# useradd seven
[root@localhost ~]# passwd seven
1
2
下载elasticsearch
[root@localhost ~]# su seven
[seven@localhost root]$ cd /home/seven
[seven@localhost ~]$ mkdir download
[seven@localhost ~]$ cd download
[seven@localhost download]$ wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/5.0.0-alpha3/elasticsearch-5.0.0-alpha3.tar.gz
1
2
3
4
5
6
解压并运行elasticsearch
解压
[seven@localhost download]$ tar -zxvf elasticsearch-5.0.0-alpha3.tar.gz
1
移动到指定文件夹并重命名(方便管理)
[seven@localhost download]$ mv elasticsearch-5.0.0-alpha3 /usr/java/elasticsearch
1
修改访问elasticsearch的IP及端口
[seven@localhost config]$ vim /usr/java/elasticsearch/config/elasticsearch.yml
1
找到如下代码段,并取消network.host及http.port所在行的注释,修改IP及端口
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.0.155
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
1
2
3
4
5
6
7
8
9
10
11
12
直接运行bin/elasticsearch文件启动elasticsearch
[seven@localhost bin]$ cd /usr/java/elasticsearch/bin/
[seven@localhost bin]$ ./elasticsearch
1
2
启动时发现报错了。。。
[seven@localhost bin]$ ./elasticsearch
[2016-06-28 13:49:27,899][INFO ][node ] [Mondo] version[5.0.0-alpha3], pid[3671], build[cad959b/2016-05-26T08:25:57.564Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1 .0_91/25.91-b14]
▽2016-06-28 13:49:27,900][INFO ][node ] [Mondo] initializing ...
[2016-06-28 13:49:28,941][INFO ][plugins ] [Mondo] modules [percolator, lang-mustache, lang-painless, ingest-grok, reindex, lang-expression, lang-groovy], plugins []
[2016-06-28 13:49:28,963][INFO ][env ] [Mondo] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [15.7gb], net total_space [17.4gb], spins? [unknown], types [rootfs]
[2016-06-28 13:49:28,963][INFO ][env ] [Mondo] heap size [1.9gb], compressed ordinary object pointers [true]
[2016-06-28 13:49:31,980][INFO ][node ] [Mondo] initialized
[2016-06-28 13:49:31,980][INFO ][node ] [Mondo] starting ...
[2016-06-28 13:49:32,115][INFO ][transport ] [Mondo] publish_address {192.168.0.155:9300}, bound_addresses {192.168.0.155:9300}
Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed
initial heap size [268435456] not equal to maximum heap size [2147483648]; this can cause resize pauses and prevents mlockall from locking the entire heap
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:125)
at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:85)
at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:65)
at org.elasticsearch.bootstrap.Bootstrap$5.validateNodeBeforeAcceptingRequests(Bootstrap.java:183)
at org.elasticsearch.node.Node.start(Node.java:337)
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:198)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:257)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:96)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:91)
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
at org.elasticsearch.cli.Command.main(Command.java:53)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:70)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:63)
Refer to the log for complete error details.
[2016-06-28 13:49:32,144][INFO ][node ] [Mondo] stopping ...
[2016-06-28 13:49:32,198][INFO ][node ] [Mondo] stopped
[2016-06-28 13:49:32,198][INFO ][node ] [Mondo] closing ...
[2016-06-28 13:49:32,210][INFO ][node ] [Mondo] closed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
于是我临时提高了vm.max_map_count的大小
*此操作需要root权限
[root@localhost ~]# sysctl -w vm.max_map_count=262144
1
查看修改结果
[root@localhost ~]# sysctl -a|grep vm.max_map_count
vm.max_map_count = 262144
1
2
或者永久性修改
[root@localhost ~]# cat /etc/sysctl.conf | grep -v "vm.max_map_count" > /tmp/system_sysctl.conf
[root@localhost ~]# echo "vm.max_map_count=262144" >> /tmp/system_sysctl.conf
[root@localhost ~]# mv /tmp/system_sysctl.conf /etc/sysctl.conf
mv:是否覆盖"/etc/sysctl.conf"? y
[root@localhost ~]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
vm.max_map_count=262144
[root@localhost ~]# sysctl -p
vm.max_map_count = 262144
1
2
3
4
5
6
7
8
9
10
11
12
上面还有一个错误是关于jvm内存分配的问题heap size [268435456] not equal to maximum heap size [2147483648],需要修改的jvm配置
[seven@localhost bin]$ vim /usr/java/elasticsearch/config/jvm.options
1
将-Xmx2g改成-Xmx256m,也就是heap size [268435456] /1024/1024的值
又有新的错误。。。
Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed
initial heap size [268435456] not equal to maximum heap size [2147483648]; this can cause resize pauses and prevents mlockall from locking the entire heap
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
memory locking requested for elasticsearch process but memory is not locked
at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:125)
at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:85)
at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:65)
at org.elasticsearch.bootstrap.Bootstrap$5.validateNodeBeforeAcceptingRequests(Bootstrap.java:183)
at org.elasticsearch.node.Node.start(Node.java:337)
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:198)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:257)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:96)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:91)
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
at org.elasticsearch.cli.Command.main(Command.java:53)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:70)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:63)
Refer to the log for complete error details.
[2016-06-28 14:55:49,770][INFO ][node ] [Goldbug] stopping ...
[2016-06-28 14:55:49,875][INFO ][node ] [Goldbug] stopped
[2016-06-28 14:55:49,875][INFO ][node ] [Goldbug] closing ...
[2016-06-28 14:55:49,887][INFO ][node ] [Goldbug] closed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
这个问题折腾了我一下午,最后还是找到了解决方案,同样回到config/elasticsearch.yml文件,找到如下配置,开放discovery.zen.ping.unicast.hosts及discovery.zen.minimum_master_nodes
# --------------------------------- 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]"]
#
discovery.zen.ping.unicast.hosts: ["192.168.0.155"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
1
2
3
4
5
6
7
8
9
10
11
12
13
然后修改max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]这个错误(切换到root操作)
[root@localhost ~]# cp /etc/security/limits.conf /etc/security/limits.conf.bak
[root@localhost ~]# cat /etc/security/limits.conf | grep -v "seven" > /tmp/system_limits.conf
[root@localhost ~]# echo "seven hard nofile 65536" >> /tmp/system_limits.conf
[root@localhost ~]# echo "seven soft nofile 65536" >> /tmp/system_limits.conf
[root@localhost ~]# mv /tmp/system_limits.conf /etc/security/limits.conf
1
2
3
4
5
修改后重新登录seven用户,使用如下命令查看是否修改成功
[seven@localhost ~]$ ulimit -Hn
65536
1
2
接下来就可以启动elasticsearch了,启动完成使用浏览器访问http://192.168.0.155:9200
{
"name" : "Vampire by Night",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "5.0.0-alpha3",
"build_hash" : "cad959b",
"build_date" : "2016-05-26T08:25:57.564Z",
"build_snapshot" : false,
"lucene_version" : "6.0.0"
},
"tagline" : "You Know, for Search"
}
1
2
3
4
5
6
7
8
9
10
11
12
终于成功了,目前只遇到过这些问题,有其他问题欢迎交流。
---------------------
作者:王坊兴
来源:CSDN
原文:https://blog.csdn.net/u012371450/article/details/51776505
版权声明:本文为博主原创文章,转载请附上博文链接!
centos7虚拟机安装elasticsearch5.0.x-安装篇的更多相关文章
- centos7 安装zabbix3.0 安装zabbix4.0 yum安装zabbix 国内源安装zabbix 阿里云服务器安装zabbix
首先,此篇文章是有原因的. 刚开始也和大家一样来学习安装zabbix 奈何网上的教程和现实出现不一样的情况 在安装zabbix过程中,因为zabbix下载源是在国外,下载途中会出现终止下载的情况 tr ...
- elasticsearch5.0.1安装 marvel 插件
elasticsearch5.0.1安装 marvel 插件 1.在elasticsearch上安装x-pach插件 在elasticsearch的根目录(每个节点),运行 bin/elasticse ...
- centos7.2环境elasticsearch-5.0.1+kibana-5.0.1+zookeeper3.4.6+kafka_2.9.2-0.8.2.1部署详解
centos7.2环境elasticsearch-5.0.1+kibana-5.0.1+zookeeper3.4.6+kafka_2.9.2-0.8.2.1部署详解 环境准备: 操作系统:centos ...
- ubuntu 安装Elasticsearch5.0(Debian包)
通过Debian包安装Elasticsearch Elasticsearch的Debian包可以从downloaded from our website或APT repository 它可以用于在任何 ...
- 【入门】安装Elasticsearch5.0 部署Head插件
部署5.0版本的ES 5.0版本的ES跟之前的版本最大的不同之处就是多了很多环境的校验,比如jdk,max-files等等. 设置内核参数 vi /etc/sysctl.conf # 增加下面的内容 ...
- Elasticsearch5.0.1安装
最新研究了下ES5.0,ES就是为高可用和可扩展而生的,你可以很方便的增加也减少一个节点.顺便记录下安装过程,也方便以后查看. 1 安装部骤 1.1 安装JDK ES依赖于 ...
- Linux(CentOS)下安装Elasticsearch5.0.0
一.ES5.0解压安装到Windows之后(可能)需要进行的设置: 1.如果不设置,直接运行elasticsearch.bat 文件 ,会报错: 2.解决方式 调节 conf/jvm.options ...
- 安装Elasticsearch5.0 部署Head插件
部署5.0版本的ES 5.0版本的ES跟之前的版本最大的不同之处就是多了很多环境的校验,比如jdk,max-files等等. 设置内核参数 vi /etc/sysctl.conf # 增加下面的内容 ...
- centos中安装elasticsearch5.0
1.安装jdk 可以直接安装自带的openjdk,安装完成之后修改一下java的环境变量.另一种方式是就是安装oracle的jdk,从官网上下载http://www.oracle.com/techne ...
随机推荐
- UVa LA 3213 - Ancient Cipher 水题 难度: 0
题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...
- day039 数据库索引
今日内容: 1.为什么要有索引 简而言之,索引出现的意义是为了更方便,更快速的查询数据. 什么是索引 索引在mysql中也叫''键''或'key'(primary key unique key,ind ...
- Qt简单项目--加法计算器(详细代码注释)
Qt的简单案例--加法计算器(详细代码注释) 一.项目结构 二.项目代码 widget.h #ifndef WIDGET_H #define WIDGET_H //预编译指令, 为了避免头文件被重复包 ...
- linux centos7 安装mono
1.看官方的命令: 另外一种是下载压缩包解压之后安装: https://apps.fedoraproject.org/packages/mono/ 三.安装Mono需要的GDI+兼容API的库Libg ...
- C++中数组定义及初始化
一.一维数组 静态 int array[100]; 定义了数组array,并未对数组进行初始化 静态 int array[100] = {1,2}: 定义并初始化了数组array 动态 int* ar ...
- 关于 数据库 my_slq的 安装及其卸载
安装的时候 注意事项 自定后 根据电脑的系统版本 选择32 或者64 然后选择→方向键 密码默认是123456 或者 123123 查看装的数据库是否安装好了 如何完全卸载 mysql 数据库 ...
- day 32 子进程的开启 及其用法
开启两种子进程的两种方式# # # 1 传统方式# from multiprocessing import Process# import time# def task(name):# print ( ...
- REST easy with kbmMW #17 – Database 6 – Existing databases
kbmMW已经包含了非常精细的功能来确定和解释数据库中表的元数据. 在下一版本中,这个功能将得到进一步加强,可以导入现有数据库中的表,自动创建与表相匹配的ORM实体类. 这意味着你能够使用kbmMW的 ...
- FCC JS基础算法题(8):Slasher Flick(截断数组)
题目描述: 返回一个数组被截断n个元素后还剩余的元素,截断从索引0开始. 这个题目有两个方法,都比较简单,用slice方法: function slasher(arr, howMany) { // 请 ...
- Linux运维命令总结(-)
Linux运维命令总结(-) 此次整理linux运维常用命令13个,常用linux运维命令大概有150个,约占百分之十,大牛见笑,本人菜鸟一枚不才整理如下,如有不正确之处,请多多指正. 1.创建目录 ...