1、下载Elasticsearch
下载地址: https://www.elastic.co/cn/downloads/past-releases/elasticsearch-8-2-3
2、下载elasticsearch-analysis-ik
1、版本号需要和ElasticSearch一致:8.2.3:
2、下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
3、在elasticsearch目录底下的plugins文件里新建一个文件夹ik,将elasticsearch-analysis-ik提取到ik文件夹里
3、修改配置
修改配置,在 /path_elastic_search/config/elasticsearch.yml :
cluster.name:集群名称:
# Use a descriptive name for your cluster:
#
cluster.name: my-app
#
node.name:节点名称:
# Use a descriptive name for the node:
#
node.name: master
path.data: data文件夹路径:
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: D:\dev\elasticsearch-8.2.3\data
path.logs: log文件夹路径:
#
# Path to log files:
#
path.logs: D:\dev\elasticsearch-8.2.3\logs
network.host: host地址,Elasticsearch 默认只能通过localhost访问,在这里设置一个不同的地址从而在网络中暴漏这个节点,单机模式直接填 0.0.0.0
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
http.port,设置HTTP端口:
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
discovery.seed_hosts: 集群主机列表
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: 启动时初始化的参与选主的node,生产环境必填
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
cluster.initial_master_nodes: ["master"]
禁用ssl:
xpack.security.enabled: false
xpack.security.http.ssl:
enabled: false
4、启动Elasticsearch
双击 /path_elasticsearch/bin 目录下的 elasticsearch.bat
cmd命令行执行: curl -X GET “localhost:9200/_cat/nodes?v”
5、下载 elasticsearch-head
elasticsearch-head 是一个es的web可视化管理工具,安装elasticsearch-head前必须先安装npm
安装步骤:
- git clone git://github.com/mobz/elasticsearch-head.git
- cd elasticsearch-head
- npm install
- npm run start
- 打开 http://localhost:9100/ 浏览
图1:首页及配置es的位置
图2:查看索引
图3:查看索引数据