ElasticSearch安装

1.下载6.5.1版本的ElasticSearch

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.1.tar.gz

2.确保当前用户是非root用户,因为root用户无法启动ElasticSearch。

3.解压,目录如下

4.配置cofig目录下的elasticsearch.yml文件

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.159.200
#
# 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: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- 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
discovery.zen.ping.unicast.hosts: ["192.168.159.200","192.168.159.201", "192.168.159.201"]

5.复制到其他两台机器

scp -r /opt/cdh5.15.0/elasticsearch-6.5.1/ slave1.cn:/opt/cdh5.15.0/
scp -r /opt/cdh5.15.0/elasticsearch-6.5.1/ slave2.cn:/opt/cdh5.15.0/

6.修改另外两台机器的 node.name和network.host

7.启动命令:bin/elasticsearch -d,却提示要用JDK8.

[zuowei.zhang@slave1 elasticsearch-6.5.1]$ bin/elasticsearch -d
the minimum required Java version is 8; your Java version from [/opt/java/jdk1.7.0_67/jre] does not meet this requirement

 

8.由于之前安装Hadoop时候使用的JDK7,为了不需要关闭Hadoop。下载JDK8,并配置环境变量,不要配置PATH。

#ES_JAVA_HOME
export ES_JAVA_HOME=/opt/java/jdk1.8.0_191

9.修改bin目录下的elasticsearch-env,将JAVA_HOME改为ES_JAVA_HOME

10.再次启动,又启动不了,提示如下:

[zuowei.zhang@master elasticsearch-6.5.1]$ bin/elasticsearch -d
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N

参考https://blog.csdn.net/xin93/article/details/80753677的方法, 修改如下:

11.为了能够查看错误日志,执行bin/elasticsearch来启动,再次发现错误:

ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

参考https://www.cnblogs.com/zhi-leaf/p/8484337.html提供的方法解决

12. 再次启动,并访问http://master.cn:9200/,三台都启动了:

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值