Linux 安装 Elasticsearch 并配置

这是我参与8月更文挑战的第5天,活动详情查看:8月更文挑战node

若是❤️个人文章有帮助,欢迎点赞、关注。这是对我继续技术创做最大的鼓励。更多往期文章在个人我的专栏linux

Linux 安装 Elasticsearch 并配置

下载 Elasticsearch

Elasticsearch 下载地址www.elastic.co/downloads/e…git

因为国外通常下载比较慢, 可使用国内镜像:www.newbe.pro/tags/Mirror…github

一样还有其余开源软件可供下载:vim

Elasticsearch Linux 安装

环境 Centos 7浏览器

首先须要到[国内镜像网站](https://mirrors.huaweicloud.com/home) 查找本身须要的 Elasticsearch 版本, 下载其压缩包, 我这边选择 elasticsearch-7.8.0-linux-x86_64.tar.gzbash

# 下载 Elasticsearch 压缩包
wget https://mirrors.huaweicloud.com/elasticsearch/7.8.0/elasticsearch-7.8.0-linux-x86_64.tar.gz

# 解压 并 进入 es 文件夹
tar -zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz && cd elasticsearch-7.8.0
复制代码

配置文件

解压成功事后, 须要配置 elasticsearch.yml 文件, 才能正常对外提供服务markdown

# 配置文件 如下内容
vim config/elasticsearch.yml

# -----------------
node.name: node-1

# 必定要对应上面 node.name 设置
cluster.initial_master_nodes: ["node-1"] 

# network.host 设置为本身的ip地址 也能够设置成0.0.0.0(表明全部ip能够访问)
network.host: 127.0.0.1
http.port: 9200

# 在最后加上这两句,要否则,外面浏览器就访问不了哈
http.cors.enabled: true
http.cors.allow-origin: "*"
# -----------------
复制代码

启动 elasticsearch

elasticsearch.yml 文件配置完成事后, 就可使用命令 ./bin/elasticsearch 尝试启动app

打印信息结果出来 publish_address, bound_addresses 提供服务 ip 与 端口, started 以启动字样, 意味着启动成功cors

[2021-08-05T22:24:12,149][INFO ][o.e.h.AbstractHttpServerTransport] [node-1] publish_address {192.168.20.182:9200}, bound_addresses {0.0.0.0:9200}
[2021-08-05T22:24:12,150][INFO ][o.e.n.Node               ] [node-1] started
[2021-08-05T22:24:12,936][INFO ][o.e.l.LicenseService     ] [node-1] license [2425391e-58ad-4212-8216-556f416a3a8a] mode [basic] - valid
[2021-08-05T22:24:12,939][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [node-1] Active license is now [BASIC]; Security is disabled
[2021-08-05T22:24:12,962][INFO ][o.e.g.GatewayService     ] [node-1] recovered [3] indices into cluster_state
[2021-08-05T22:24:15,378][INFO ][o.e.c.r.a.AllocationService] [node-1] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[material_pass_category][1]]]).
复制代码

若是启动过程当中遇到问题请查看

# Elasticsearch 安装过程当中问题小记

相关文章
相关标签/搜索