ElasticSearch5.0的安装
我在安装5.0版本的时候 和1.4版本不一样
出现了特别多的问题 下面总结一下:
注意 jdk 必须1.8,centos6以上 linux系统低会报错但不影响使用
1.启动必须是新建的用户 不能是root用户,这是安全机制引起的
groupadd -g 600 es
useradd -u 600 -g 600 es
passwd es 设置密码
2.将elasticSearch设置用户用户组
sudo -R chown es:es elasticSearch
3.修改config中的yml文件
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: hr_es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: es_1
node.master: true
node.data: false
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/software/esdata
#
# Path to log files:
#
path.logs: /home/software/eslogs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
# ---------------------------------- Network -----------------------------------
network.host: 0.0.0.0
http.port: 9200
//注意 es data目录和log目录 必须改成es用户的 否则没有权限
chown -R es:es
4.系统中的设置
1. vi /etc/security/limits.conf 添加内容
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
2. vi /etc/security/limits.d/90-nproc.conf 修改内容
* soft nproc 1024-》改成2048
3. vi /etc/sysctl.conf 添加内容
vm.max_map_count=655360
并执行 :sysctl -p
5.最后在es用户下执行启动,启动前先创建yml中配置的目录
以上是单节点的
集群的配置:
1.在yml中添加如下的字段:
discovery.zen.ping.unicast.hosts: ["192.168.80.11:9300","192.168.80.12:9300"]
指定集群节点
discovery.zen.minimum_master_nodes: 1
有几个主节点(老大)