我用的是centos6.5,安装elasticsearch5.2
首先不说了,安装JDK1.8,下载elasticsearch5.2
https://www.elastic.co/downloads/past-releases --> 这里面提供了ElasticSearch各种版本的下载,选择 5.2 系列中的一个
1. 添加用户
adduser tommy --添加用户
passwd tommy --设置密码
2. 将tommy添加到root组
修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
然后修改用户,使其属于root组(wheel),命令如下:
usermod -g root tommy
3. 切换用户到tommy
使用tommy将 elasticsearch5.2 上传到linuxk
elastic 5 不能用root启动,一定要将用户切换到tommy
tar xzvf elasticsearch-5.2.tar.gz 请根据自己实际版本号
4. 修改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
5. 进入elasticsearch-5.2.2\bin目录下,启动 ./elasticsearch
错误1: 最大map数量需要设置为262144
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 # 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 6 [root@localhost ~]# sysctl -p 7 vm.max_map_count = 262144
错误2: 线程数至少2048个
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"}
最后出现这个说明暂时安装成功了。