欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

elasticsearch安装

程序员文章站 2022-07-05 10:59:18
...

预先需要安装java8

1. 源码包准备:

首先到官网下载jdk,http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2、解压源码包

sudo mkdir /usr/local/java
cp jdk-8u25-linux-x64.tar.gz /usr/local/java
cd /usr/local/java
sudo tar xvf jdk-8u25-linux-x64.tar.gz
sudo rm jdk-8u25-linux-x64.tar.gz

3、设置jdk环境变量

sudo vim ~/.bashrc

打开之后在末尾添加:

export JAVA_HOME=/usr/local/java/jdk1.8.0_25  
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH

4、检验是否安装成功

在终端输入如下命令

java -version

以上java安装参考来源:https://www.linuxidc.com/Linux/2015-01/112030.htm

安装elasticsearch:

https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-targz.html

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz 
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz.sha512 
shasum -a 512 -c elasticsearch-6.2.4.tar.gz.sha512 
tar -xzf elasticsearch-6.2.4.tar.gz 
cd elasticsearch-6.2.4/

启动:

./bin/elasticsearch

到此安装完成。

可能出现的问题:

There is insufficient memory for the Java Runtime Environment to continue.

解决方法:
打开vim config/jvm.options 找到-Xms2g -Xmx2g(有的时-Xms1g -Xmx1g),改成如下:

#Xms represents the initial size of total heap space
#Xmx represents the maximum size of total heap space 
-Xms512m
-Xmx512m