下载elasticsearch最新版本(当前最新版本6.4.1):https://www.elastic.co/cn/downloads/elasticsearch
解压压缩包至指定路径,程序启动入口 elasticsearch-6.4.0\bin\elasticsearch.bat
elasticsearch 启动闪退解决:elasticsearch 依赖JDK,必须是1.8以上版本JDK
安装配置1.8版本以上JDK,为 elasticsearch 指定JDK 路径。
配置JDK1.8环境变量 ES_JDK : C:\Program Files\Java\jdk1.8.0_181
打开 elasticsearch-6.4.0\bin\elasticsearch-env
# now set the path to java
if [ -x "$ES_JDK/bin/java" ]; then
JAVA="$ES_JDK/bin/java"
else
set +e
JAVA=`which java`
set -e
fi
大概在39 - 40 行 将JAVA_HOME换成刚刚配置的ES_JDK。
打开 elasticsearch-6.4.0\bin\elasticsearch-env.bat
rem now set the path to java
if defined JAVA_HOME (
set JAVA="%ES_JDK%\bin\java.exe"
) else (
for %%I in (java.exe) do set JAVA="%%~$PATH:I"
)
在19 - 20 行 将set JAVA="%JAVA_HOME%\bin\java.exe" 改成 set JAVA="%ES_JDK%\bin\java.exe"
elasticsearch 程序启动成功。
elasticsearch 基本配置,打开 elasticsearch-6.4.0\config\elasticsearch.yml
# ---------------------------------- Cluster -----------------------------------
# Use a descriptive name for your cluster:集群名称
cluster.name: xxx
# ------------------------------------ Node ------------------------------------
# Use a descriptive name for the node:节点名称
node.name: xxx
# Add custom attributes to the node:
#node.attr.rack: r1
# ----------------------------------- 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.0.1
network.host: 127.0.0.1
# Set a custom port for HTTP:
http.port: 9200
#transport.tcp.port: 9300
# For more information, consult the network module documentation.