elasticsearch安裝之各類坑

我用的是centos6.5,安裝elasticsearch5.2.0java

首先不說了,安裝JDK1.8,下載elasticsearch5.2.0node

https://www.elastic.co/downloads/past-releaseslinux

 

 上傳到linux下,解壓tar -zxvf ...bootstrap

ela2.0以後不能用root啓動了vim

#adduser tommy
#passwd tommy   //修改密碼centos

#vim /etc/sudoersmarkdown

方法一:修改 /etc/sudoers 文件,找到下面一行,把前面的註釋(#)去掉curl

## Allows people in group wheel to run all commands
%wheel    ALL=(ALL)    ALLjvm

而後修改用戶,使其屬於root組(wheel),命令以下:elasticsearch

#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"
}

最後出現這個說明暫時安裝成功了。

相關文章
相關標籤/搜索