centos7虚拟机安装elasticsearch5.0.x-安装篇
2019独角兽企业重金招聘Python工程师标准>>>
请预先安装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 lockedat 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"
}
转载于:https://my.oschina.net/xiaominmin/blog/2050004
centos7虚拟机安装elasticsearch5.0.x-安装篇相关推荐
- 详解centos7虚拟机安装elasticsearch5.0.x-安装篇(自己做测试了,es启动有错误可以在这上面找)
本篇文章主要介绍了centos7虚拟机安装elasticsearch5.0.x-安装篇,具有一定的参考价值,感兴趣的小伙伴们可以参考一下. centos7虚拟机安装elasticsearch5.0.x ...
- Centos7 Yum安装MYSQL8.0详细安装步骤
Centos7 Yum安装MYSQL8.0详细安装步骤 0.更换yum源 1.打开 mirrors.aliyun.com,选择centos的系统,点击帮助 2.执行命令:yum install wge ...
- 凝思mysql服务器搭建_凝思8安装mysql8.0.21安装记录 及问题处理
凝思8安装mysql8.0.21安装记录 及问题处理 https://www.cndba.cn/cndba/q8624806/article/4349https://www.cndba.cn/cndb ...
- Linux(CentOS)下安装Elasticsearch5.0.0
一.ES5.0解压安装到Windows之后(可能)需要进行的设置: 1.如果不设置,直接运行elasticsearch.bat 文件 ,会报错: 2.解决方式 调节 conf/jvm.options ...
- mysql安装教程8.0.21安装_mysql8.0.21安装教程图文详解
1.下载 下载链接 点击download,这里可能需要登录甲骨文的账号,登录一下即可 2.解压 下载好会得到一个安装包 把它解压到一个能找到的目录下即可,我的是这样(my.ini文件你们应该没有) 3 ...
- linux安装mysql8.0.18_Linux安装MySQL8.0
Linux安装MySQL8.0 rpm -qa|grep mysql rpm -qa|grep mariadb mariadb-libs-5.5.60-1.el7_5.x86_64 rpm -e -- ...
- mysql-8.0.14图文安装_mysql8.0.14安装配置方法图文教程(通用)
mysql服务8.0.14安装(通用),供大家参考,具体内容如下 安装环境:windows 安装步骤: 1.下载zip安装包 2.解压zip安装包 3.配置环境变量 4.添加配置文件 5.cmd安装m ...
- ubuntu 16.0安装mysql8_ubuntu16.0.4 安装 mysql8.0.18的
1.下载mysql.tar.xz 文件 image.png image.png 2.解压到/usr/local/目录,并将文件夹重命名为mysql #解压 sudo tar xvf mysql-8.0 ...
- mysql8.0.16安装_mysql8.0.16安装(补) September 24,2019
1. 下载MySQL 8.0.16 官方可以直接下载 zip 压缩包,我的解压位置是D:\Program Files (x86)\mysql-8.0.16-winx64 2. 修改环境变量. 在系统变 ...
最新文章
- Sitecake – 可视化编辑,所见即所得的 CMS
- 51nod 1172 Partial Sums V2 卡精度的任意模数FFT
- 【性能优化】 之10046 事件
- TFS与Eclipse、Microsoft Visual Studio等客户端以webservice进行交换。
- 使用睡袋_睡袋能用几十年?!只要你照着做(一)
- 4、Orcal数据库dmp文件导入
- 测试私有方法 重构_一个全栈工程师重构之路:中小公司 DevOps 落地实践
- 大众流行编程语言有哪些 该选择哪一个来入门
- Jquery学习总结(4)——高效Web开发的10个jQuery代码片段
- Android onSaveInstanceState onRestoreInstanceState
- 如何获取华为网络安全考试题库?
- mysql创建学生表命令_用sql语句创建学生表如何做
- 大数据时代下的办公自动化系统
- 《第一行代码》完结篇
- 十大思维导图软件推荐
- c语言中fprintf的作用,c语言中fprintf的用法
- 知到python课程答案-知到智慧树_Python数据分析与数据可视化_结课测验答案
- 侯捷c++课程学习一
- 联想微型计算机m910q6,一台比较完美的黑苹果小主机 联想M910Q折腾记 opencore EFI分享...
- CISCO banner MOTD, Login的区别
热门文章
- 人工智能开发语言排行榜: 不死Java, 不朽C/C++, 新贵Python
- 计算机的正确配置文件,Windows10电脑系统如何正确配置显示器颜色配置文件
- autocad型源代码_VB与AUTOCAD二次开发源代码包
- 自定义View中,四个参数的构造函数,其最后两个参数的含义
- 使用注解失败的原因及解决方法
- 世界各地的游戏都是如何分级的?哪个最严格?
- 打印表格用什么软件好?
- 文本串加密和解密程序。一个文本串可用事先给定的字母映射表进行加密
- jQuery获取或设置元素的属性值
- BP神经网络的数学表达式