elasticsearch安装之各种坑
Posted 孤独时光
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch安装之各种坑相关的知识,希望对你有一定的参考价值。
我用的是centos6.5,安装elasticsearch5.2.0
首先不说了,安装JDK1.8,下载elasticsearch5.2.0
https://www.elastic.co/downloads/past-releases
上传到linux下,解压tar -zxvf ...
ela2.0之后不能用root启动了
#adduser tommy
#passwd tommy //修改密码
#vim /etc/sudoers
方法一:修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
然后修改用户,使其属于root组(wheel),命令如下:
#usermod -g root tommy
切换到tommy账户
修改elasticsearch/config/elasticsearch.yml文件
path.data: /data/shuju/
path.logs: /data/logs/
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 172.16.255.231
#
# Set a custom port for HTTP:
#
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]"]
#
discovery.zen.ping.unicast.hosts: ["172.16.255.231", "[::1]"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 3
bootstrap.memory_lock: false //这个解决centos6.5下出现的问题
bootstrap.system_call_filter: false
错误1
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
1 [root@localhost ~]# cat /etc/sysctl.conf | grep -v "vm.max_map_count" > /tmp/system_sysctl.conf 2 [root@localhost ~]# echo "vm.max_map_count=262144" >> /tmp/system_sysctl.conf 3 [root@localhost ~]# mv /tmp/system_sysctl.conf /etc/sysctl.conf 4 mv:是否覆盖"/etc/sysctl.conf"? y 5 [root@localhost ~]# cat /etc/sysctl.conf 6 # System default settings live in /usr/lib/sysctl.d/00-system.conf. 7 # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file 8 # 9 # For more information, see sysctl.conf(5) and sysctl.d(5). 10 vm.max_map_count=262144 11 [root@localhost ~]# sysctl -p 12 vm.max_map_count = 262144
错误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
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=\'Cannot allocate memory\' (errno=12)
由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配
# vim config/jvm.options
-Xms2g --》修改为512m
-Xmx2g --》修改为512m
错误4
自己创建文件目录,不然会报找不到目录然后不能创建文件的错误
剩下的我也不记得了,遇到问题就解决问题吧
[root@lijia231 ~]# curl 172.16.255.231:9200 { "name" : "xPqxh4x", "cluster_name" : "elasticsearch", "cluster_uuid" : "_na_", "version" : { "number" : "5.2.0", "build_hash" : "24e05b9", "build_date" : "2017-01-24T19:52:35.800Z", "build_snapshot" : false, "lucene_version" : "6.4.0" }, "tagline" : "You Know, for Search" }
最后出现这个说明暂时安装成功了。
以上是关于elasticsearch安装之各种坑的主要内容,如果未能解决你的问题,请参考以下文章