elasticsearch-6.2.3安装

系统环境:CentOS release 6.6

安装文件及版本:

elasticsearch-6.2.3

jdk:jdk1.8.0_66

分词器插件:analysis-ik

1.安装jdk1,8

2.将elasticsearch-6.2.3.zip上传到目标路径,解压。

3.修改配置文件bin/elasticsearch

添加配置

# 我添加的 start
export JAVA_HOME=/opt/soft/jdk/jdk1.8.0_66/
export PATH=$JAVA_HOME/bin:$PATH
# 我添加的 end

# 我添加的 start
if [ -x "$JAVA_HOME/bin/java" ]; then
        JAVA="/opt/soft/jdk/jdk1.8.0_66/bin/java"
else
        JAVA=`which java`
fi
# 我添加的 end

修改配置文件config/elasticsearch.yml

修改配置

# ---------------------------------- Cluster -----------------------------------
#集群名称,所有节点必须相同
cluster.name: ****
#
# ------------------------------------ Node ------------------------------------
#节点名称,为了区分不同节点名字,所以不同节点不能相同
node.name: node-1
#
# ----------------------------------- Paths ------------------------------------
#数据文件存放路径
path.data: /opt/es/data
#日志文件存放路径
path.logs: /opt/es/logs
#
# ----------------------------------- Memory -----------------------------------
#启动时是否锁定内存
#设置为true时会锁定内存介绍系统swaping,同时需要修改系统的参数,在下面系统参数修改会提到
bootstrap.memory_lock: true
#增加这个配置是应为Centos6不支持SecComp,而此版本默认bootstrap.system_call_filter为true进行检测,所以导致检测#失败,失败后直接导致ES不能启动。
bootstrap.system_call_filter: false
#
# ---------------------------------- Network -----------------------------------
#本地地址
network.host: *.*.*.*
#端口号
http.port: 9200
#
# --------------------------------- Discovery ----------------------------------
#节点发现集群的节点数组
discovery.zen.ping.unicast.hosts: ["10.132.92.29", "10.132.92.30"]
#一般设置为master节点数/2+1
discovery.zen.minimum_master_nodes: 2
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

修改配置文件config/jvm.options

这个参数一般设置为系统内存的一半,但不超过32G。

-Xms4g
-Xmx4g

修改系统配置

文件/etc/security/limits.conf

work根据你启动elasticsearch的用户名来决定

# allow user 'XXX' mlockall
work soft memlock unlimited
work hard memlock unlimited


文件/etc/sysctl.conf
添加 一行

 vm.max_map_count=655360

4.如果需要用到中文分词,安装ik分词插件

将ik安装包解压到elsatic的plugins文件夹下文件夹重命名为analysis-ik,配置文件的文件夹config直接放在analysis-ik文件夹下就可以了。

5.最后增加elasticsearch文件夹的执行权限chmod -R 777 elasticsearch-6.2.3然后使用非root权限执行/bin/elasticsearch -d

查看日志启动情况。

猜你喜欢

转载自my.oschina.net/u/1760932/blog/1809166