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

centos7 安装 elasticsearch

程序员文章站 2022-07-04 23:47:49
...

安装java环境

这里使用yum方式安装,前提是必须有网络

yum install java-1.8.0-openjdk

安装完成,查看java版本

[[email protected] ~]# java -version 
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

安装 Elasticsearch

Elasticsearch的安装很简单,下载下来解压即可,这里使用wget下载,当然也可通过网页下载 https://www.elastic.co/downloads/elasticsearch ,再拷贝。

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

解压到/usr/local/

tar -zxvf elasticsearch-5.6.3.tar.gz -C /usr/local/

运行Elasticsearch

Elasticsearch 要求不能使用超级用户root运行,所以我们建立一个testuser账号

# 创建testuser账户
adduser testuser
# 修改密码
passwd testuser

然后,给testuser用户elasticsearch目录的授权。

chown -R testuser /usr/local/elasticsearch-5.6.3/

切换至elasticsearch目录,并以testuser用户运行

cd /usr/local/elasticsearch-5.6.3/
su testuser

运行elasticsearch,如果想后台运行后面加 -d

[[email protected] elasticsearch-5.6.3]$ ./bin/elasticsearch
[2017-10-31T16:07:09,445][INFO ][o.e.n.Node               ] [] initializing ...
[2017-10-31T16:07:09,662][INFO ][o.e.e.NodeEnvironment    ] [oDFU6c3] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [45.4gb], net total_space [49.9gb], spins? [unknown], types [rootfs]
[2017-10-31T16:07:09,662][INFO ][o.e.e.NodeEnvironment    ] [oDFU6c3] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-10-31T16:07:09,663][INFO ][o.e.n.Node               ] node name [oDFU6c3] derived from node ID [oDFU6c3UT6ORC2p0CKBeLA]; set [node.name] to override
[2017-10-31T16:07:09,663][INFO ][o.e.n.Node               ] version[5.6.3], pid[11484], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_151/25.151-b12]
[2017-10-31T16:07:09,664][INFO ][o.e.n.Node               ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX: