Centos7通过rpm安装Elasticsearch 7.x

依赖安装:java

Elasticsearch基于java开发,先要安装java环境,推荐yum命令安装

  1. 查看java可下载列表(官网推荐使用jdk 1.8.0安装)
yum -y list java*

Elasticsearch requires at least Java 8. Specifically as of this writing, it is recommended that you use the Oracle JDK version 1.8.0_131

  1. 我们安装-devel版本,时间不同,版本号有区别
yum install -y java-1.8.0-openjdk-devel.x86_64
  1. 输入java -version查看是否安装成功
  2. 默认安装在/usr/lib/jvm目录,通过echo $JAVA_HOME可以查看
  3. 将java添加到环境变量vi /etc/profile,在尾部添加如下配置:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el6_10.x86_64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
  1. 按Esc按键,然后输入:wq命令保存文件,输入以下命令使配置生效
source /etc/profile

安装Elasticsearch

  1. 下载Elasticsearch的rpm安装包(一包解万坑),可以在https://www.elastic.co/cn/downloads/elasticsearch 查看,下载最新的rmp包
wget -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0-x86_64.rpm
  1. 执行安装
rpm -ivh elasticsearch-7.2.0-x86_64.rpm
  1. 运行,这里不需要切换用户运行,因为elasticsearch的服务命令会完成这一切
sudo systemctl daemon-reload
sudo systemctl start elasticsearch.service
  1. 查看是否成功
curl -XGET 'http://localhost:9200/'
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "izX7KuQATc2ghCjDbEYwYg",
  "version" : {
    "number" : "7.2.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "508c38a",
    "build_date" : "2019-06-20T15:54:18.811730Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
  1. 设置开机启动
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
  1. 停止开机启动
sudo systemctl disable elasticsearch.service

转载于:https://my.oschina.net/longxuu/blog/3077553

发布了0 篇原创文章 · 获赞 0 · 访问量 188
展开阅读全文
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览