最新消息:

CentOS7 yum install ElasticSearch

Linux yvsm 196浏览 0评论

首先安装 JDK 环境

# 本机是否已经安装,ElasticSearch 最低支持 jdk 1.7
yum list installed | grep java

# 查看 yum 库中的 java 安装包
yum list java*

# 安装 java-1.8.0
yum install -y java-1.8.0-openjdk

# 安装完成后查看 java 版本
java -version

openjdk version “1.8.0_212”
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
复制代码

安装 elasticsearch(当前为 7.2)

# 下载并安装公共签名密钥
rpm –import https://artifacts.elastic.co/GPG-KEY-elasticsearch

# 创建 yum 源文件
vim /etc/yum.repos.d/elasticsearch.repo

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

# 安装
yum install -y elasticsearch

配置 elasticsearch

# 配置文件都在 /etc/elasticsearch/ 目录下
vim /etc/elasticsearch/elasticsearch.yml

# 集群名称
cluster.name: jhxxb
# 节点名称
node.name: node-1
# 数据文件与日志文件存放目录
path.data: /home/esData/es
path.logs: /home/esData/log
# 网络设置
network.host: 0.0.0.0
http.port: 9200
# 集群设置
cluster.initial_master_nodes: [“node-1”]

# 修改配置中目录的用户与用户组,不然无法启动
chown -R elasticsearch:elasticsearch /home/esData/log/
chown -R elasticsearch:elasticsearch /home/esData/es/

启动 elasticsearch

# 启动
systemctl start elasticsearch.service

# 开机自启
systemctl enable elasticsearch.service

# 查看状态
systemctl status elasticsearch.service

浏览器访问 ip + 9200/?pretty 查看状态

安装 kibana(当前为 7.2),elasticsearch 的可视化界面(类似的还有 es-head 插件)
复制代码
# 下载并安装公共签名密钥
rpm –import https://artifacts.elastic.co/GPG-KEY-elasticsearch

# 添加源
vim /etc/yum.repos.d/kibana.repo

[kibana-7.x]
name=Kibana repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

# 安装
yum install -y kibana

# 配置
vim /etc/kibana/kibana.yml

server.host: “0.0.0.0”
# 不要用 127.0.0.1,可能会提示 Kibana server is not ready yet
elasticsearch.hosts: [“http://192.168.8.41:9200”]
i18n.locale: “zh-CN”

# 刷新服务配置
systemctl daemon-reload
# 开机自启
systemctl enable kibana.service
# 启动
systemctl start kibana.service
# 查看状态
systemctl status kibana.service

默认端口为 5601

https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html

https://www.elastic.co/guide/en/kibana/current/rpm.html

http://www.eryajf.net/2351.html

转载请注明:缘境的博客 » CentOS7 yum install ElasticSearch

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址