ElasticSearch 安装和 IK分词器的安装


下载最新稳定版本的 elasticsearch:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.zip

解压 unzip elasticsearch-6.0.0.zip

修改配置文件: /usr/elasticsearch-6.0.0/config


# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:

cluster.name: motor-application

#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: motor-es-node1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#

#
# ----------------------------------- Paths ------------------------------------
#
path.data: /opt/es/data
#
# Path to log files:
#
path.logs: /opt/es/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):
#
network.host: 192.168.136.128
#
# Set a custom port for HTTP:
#
http.port: 9200
transport.tcp.port: 9300
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["192.168.136.128", "192.168.136.145"]
discovery.zen.ping.unicast.hosts: ["192.168.136.128"]


#
# 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
http.cors.allow-origin: "*"



主要配置 日志路径 和 数据路径 和 集群 名称 节点 名称等 ES会将同网络下集群名称相同的节点加入集群中,所以注意修改个节点的节点名称


ES 启动 是不能使用 root 用户启用的 

解决办法有两个:

 1 新建一个新的用户  使用新的用户 启动,比如我新建了es 用户组  和 es 用户 这样的话 要吧 es文件夹下的 所有文件,所有日志 和 数据文件都要 让新用户有权限

首先 ll 会发现 所有的 文件所有都是属于 root 用户组的root用户

新建 es 用户组的es用户后执行

   chown -R es:es elasticsearch6.0.6

之后再 ll 用户的所有的文件夹是es组和es 用户,es 日志 和 数据路劲文件做相同的操作

之后 su es

切换 es用户 在bin/elasticsearch  启动 elasticsearch 就可以  启动完成之后 

访问  http://IP:9200/ 出现页面说明安装成功



IK Analysis for Elasticsearch

安装的两种方式:

方式1: - download pre-build package from here: https://github.com/medcl/elasticsearch-analysis-ik/releases

unzip plugin to folder your-es-root/plugins/


方式2 : use elasticsearch-plugin to install ( version > v5.5.1 )

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.0.0/elasticsearch-analysis-ik-6.0.0.zip

  注意ik 和 elasticsearch的版本匹配问题


2 .restart elasticsearch  一定要重启 elasticsearch


移除名为 ik 的analyzer和tokenizer,请分别使用 ik_smartik_max_word


ik_max_word 和 ik_smart 什么区别?

ik_max_word: 会将文本做最细粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,中华人民,中华,华人,人民共和国,人民,人,民,共和国,共和,和,国国,国歌”,会穷尽各种可能的组合;
ik_smart: 会做最粗粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,国歌”。


IK的安装 完成参考的是官网 :https://github.com/medcl/elasticsearch-analysis-ik

关于使用IK和创建 mapping 会用另外的一篇记录下


 











 



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值