ES5.6.9在windows下安装小记

elasticsearch

检测:

GET _analyze
{
  "analyzer":"ik_smart",
  "text":"长春市市长"
}

转自:https://www.jianshu.com/p/4945be98fe0c

1、前言

一直都在linux下跑es,测试需要启动虚拟机,不是很方便,所以觉得还是在windows下搭建个环境吧,这样用起来会更爽点。安装按照最省资源的模式安装,不用的认证和监控也没有装,这个安装只适合自己学习es做测试,不适合生产环境。

2、安装ES

2.1 Java安装

在安装ES之前,先确认JAVA环境是好的,对于ES5.6.9这个版本来说,JAVA需要在1.8以上版本。

2.2 ES配置

由于是windows的试验环境,也没这么多讲究,只要是可以正常用就行,数据量也不多,节点就一个,所以配置很简单。
编辑config下面的elasticsearch.yml 文件,更改内容如下:

# 集群名称:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# 节点名称,每个节点不同
#
node.name: node-1
# ----------------------------------- Paths ------------------------------------
#
#es数据存放路径
path.data: G:\opensoftrun\esdata
#
# Path to log files:
#es日志路径
path.logs: G:\opensoftrun\elasticsearch-5.6.9\logs
 
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#绑定的ip,0.0.0.0表示绑定本机的所有ip地址
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#http请求访问端口
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#集群发现相关配置,此处不需要配置
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#防止脑裂配置,目前就一个节点
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#开启跨域访问
http.cors.enabled: true 
#allow-origin设置应该是一个正则表达式,它与托管站点插件的Web服务器的地址相匹配。
http.cors.allow-origin: "*"
#master角色和数据角色设置
node.master: true
node.data: true

2.3 启动测试

elasticsearch.bat -d
后台方式启动,然后访问下

es正常显示

3、安装插件

准备安装两个插件Kibana 和IK分词插件。

  • Kibana:为操作ES的工具类插件,非常方便进行各种监控(结合xpack)和操作命令;如果需要进行集群监控和认证的话,可以安装kibana的xpack插件,这个插件需要购买或破解,网上很多,暂时不需要我就不安装了。
  • IK:为优秀的中文分词插件。

3.1 安装kibana

1)kibana下载地址,选择es的对应版本,同时要区分windows还是linux环境等。

2)更改配置和启动
在kibana的config目录下的kibana.yml

server.host:"0.0.0.0"
http://localhost:5601

启动后界面:


image.png

3.2 安装IK分词

1、到此处下载IK分词版本,注意和ES的版本一致。
2、解压缩,然后在es的plugin目录新建ik目录,将IK解压后的内容复制到ik目录,重启es即可。
测试下IK分词:

智能分词

最大分词
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值