windows 安装 Elasticsearch

一.官网下载安装包

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

1. 下载安装包

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

在这里插入图片描述

2.下载后解压

  • 双击 elasticsearch.bat 启动 elasticsearch 服务

  • 注:第一次启动时,要注意此时的 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

二.安装 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

  • 我们首先需要解决下跨域问题:
    在 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 文件

    在这里插入图片描述

3.输入用户密码

在这里插入图片描述

在这里插入图片描述

4.中文版界面

  • 修改 config\kibana.yml 文件

    将 i18n.locale: “en”,改为 i18n.locale: “zh-CN”

    在这里插入图片描述

相关文章

TCP/IP套接字登录方法是MySQL在一切服务平台都提供的一种登录...
easy-rule规则引擎最佳落地
Elasticsearch 是一个分布式、高扩展、高实时的搜索与数据分...
最近壹哥的一个学生,在利用spring-data-elasticsearch访问E...
java 操作elasticsearch详细总结
原文链接:http://www.ruanyifeng.com/blog/2017/08/elastic...