windows 安装 Elasticsearch

一.官网下载安装包

  • Elasticsearch高版本内置jdk,无需使用系统安装的java,本文以 8.3.3 版本为例,无需修改配置文件

1. 下载安装包

https://www.elastic.co/cn/downloads/elasticsearch

在这里插入图片描述

2.下载后解压

  • 双击 elasticsearch.bat 启动 elasticsearch 服务

  • 注:第一次启动时, 要注意此时的 ip 地址(注意下自己的虚拟机或者vpn, 它们的ip可能会产生干扰), 该 ip 地址会被绑定到 enrollment token 中, 在安装 Kibana 时有用
    在这里插入图片描述

  • 启动后第一次会显示一些配置信息,包括默认的用户密码 elastic 和 2xcXm+1k+km7nk6flNRN

在这里插入图片描述

  • 第一次启动会打印一下内容, 要好好记录下来
-> Elasticsearch security features have been automatically configured!
-> Authentication is enabled and cluster connections are encrypted.

->  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  +FOyD9Ihzn*6SHmv9Son

->  HTTP CA certificate SHA-256 fingerprint:
  61e0476f0849bb2293d6f83152dea0d94985568f6cadaae80f3eef2c621e5629

->  Configure Kibana to use this cluster:
* Run Kibana and click the configuration link in the terminal when Kibana starts.
* Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  eyJ2ZXIiOiI4LjMuMyIsImFkciI6WyIxOTIuMTY4LjEuNzo5MjAwIl0sImZnciI6IjYxZTA0NzZmMDg0OWJiMjI5M2Q2ZjgzMTUyZGVhMGQ5NDk4NTU2OGY2Y2FkYWFlODBmM2VlZjJjNjIxZTU2MjkiLCJrZXkiOiJwMWZhUDRNQjBWUGo5SW16NElOQzpoczZoU083LVJnbUh1QUZOc0FCUjVBIn0=

->  Configure other nodes to join this cluster:
* On this node:
  - Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
  - Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  - Restart Elasticsearch.
* On other nodes:
  - Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.

3.验证安装结果

  • 在浏览器中输入如下链接和用户名密码
https://localhost:9200/
  • 出现以下内容, 则代表启动成功

在这里插入图片描述

{
  "name" : "DESKTOP-CJ5CSRU",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Jcp_3e7xRI6edD_yHgKpJA",
  "version" : {
    "number" : "8.3.3",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "801fed82df74dbe537f89b71b098ccaff88d2c56",
    "build_date" : "2022-07-23T19:30:09.227964828Z",
    "build_snapshot" : false,
    "lucene_version" : "9.2.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

4.将 elasticsearch 以服务的方式安装

4.1 添加系统环境变量 Elasticsearch_Server

在这里插入图片描述

4.2 在系统环境变量 Path 中添加如下路径
%Elasticsearch_Server%\bin

在这里插入图片描述

4.3 安装 Elasticsearch 服务
  • cmd中执行
elasticsearch-service.bat install

在这里插入图片描述

4.4 服务操作命令
  • 启动Elasticsearch服务:
elasticsearch-service.bat start
  • 停止Elasticsearch服务:
elasticsearch-service.bat stop
  • 安装Elasticsearch服务:
elasticsearch-service.bat install
  • 卸载Elasticsearch服务:
elasticsearch-service.bat remove
  • 启动 Elasticsearch 属性gui:
elasticsearch-service.bat manager
4.5 可能遇到的问题
4.5.1 如果报 org.elasticsearch.ElasticsearchException: not all primary shards of [.geoip_databases] index are active

是因为 es 启动时会去更新地图的一些数据库, 则在 elasticsearch-8.3.3/config/elasticsearch.yml 总添加配置禁止下载:

ingest.geoip.downloader.enabled: false
4.5.2 在将服务启动或者注册为windows服务启动后, 莫名其妙的报了如下错误:
org.elasticsearch.bootstrap.StartupException: org.elasticsearch.bootstrap.BootstrapException: java.nio.file.NoSuchFileException: D:\Procedure\apache-jmeter-5.5\lib\ext\ApacheJMeter_core.jar

出现这种问题, 可能是因为环境变量中设置过 JMeter 的东西, 如果冲突了, 重新修改下 CLASSPATH 中的配置

二.安装 ElasticSearch-head 插件

1.安装 node.js 环境

  • 官网下载 msi版本的 windows安装包:
https://nodejs.org/

我所下载的版本为 v14.0.0,下载过程中记得添加入环境变量, 安装成功后进行验证

在这里插入图片描述

2.安装 Grunt 工具

  • cmd中执行
npm install -g grunt-cli

在这里插入图片描述

3.安装 ElasticSearch-head 插件

  • 下载压缩包 elasticsearch-head-master.zip:
https://github.com/mobz/elasticsearch-head

3. 下载后解压启动

  • 在该文件夹内启动cmd, 执行安装命令:
npm install

在这里插入图片描述

  • 执行启动命令:
npm run start

在这里插入图片描述

4.访问 elasticsearch-head

  • 我们首先需要解决下跨域问题:
    在 elasticsearch-8.3.3/config/elasticsearch.yml 添加如下配置:
http.cors.enabled: true 
http.cors.allow-origin: "*"
http.cors.allow-headers: "*"
  • 重启 elasticsearch 和 elasticsearch-head

  • 由于本次安装有默认的用户密码, 则我们请求

http://localhost:9100/?auth_user=elastic&auth_password=+FOyD9Ihzn*6SHmv9Son

在这里插入图片描述

三.安装 kibana

1.下载与Elasticsearch 相同版本的 kibana

https://www.elastic.co/cn/downloads/past-releases#kibana

2.启动 Kibana服务

  • bin目录下双击执行 kibana.bat 文件, 启动 kibana
    在这里插入图片描述
    浏览器访问该地址, 出现如下界面
    在这里插入图片描述
    将上文所说, 保存下来的 enrollment token 输入到方框中

在这里插入图片描述
点击 Configure Elastic

3.输入用户密码

在这里插入图片描述

在这里插入图片描述

4.中文版界面

  • 修改 config\kibana.yml 文件

    将 i18n.locale: “en”, 改为 i18n.locale: “zh-CN”
    在这里插入图片描述

  • 39
    点赞
  • 199
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 14
    评论
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

纯洁的小魔鬼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值