Linux安装elasticsearch6.0.1及head插件,ik分词器

一、安装elasticserch

1.elasticsearch的安装直接下载解压,elasticsearch-6.0.1,该版本及以上需要在jdk1.8以上运行

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

你可以选择在线安装,我是下载解压后上传进行的安装

2.进入elasticsearch-6.0.1/config/ 目录下,编辑elasticsearch.yml(es的核心配置文件)

# vi  elasticsearch.yml

开启network.host: 你的ip     http.port: 9200 注意冒号后要有空格,编辑后ctrl+c   :wq 保存退出即可

进去elasticsearch-6.0.1的bin目录启动es,  #  ./elasticsearch -d

提示没有权限,此处没有给用户操作权限,赋权限后也会是查看日志也会是 can not run elasticsearch as root

es高版本,root用户不能直接启动,创建新用户启动es服务,root用户下执行以下操作:

# adduser esuser                                    //创建esuser 
# chown -R esuser /opt/apps/elasticsearch-6.0.1/    //将文件夹权限赋给esuser
# chmod 777 /opt/apps/elasticsearch-6.0.1/          //在esuser用户下执行该操作,对该路径下文件权限做变更

如果你的服务器默认时jdk8,请忽略以下步骤,直接访问即可

提示:因为服务器上项目较多,有些项目依赖于jdk7,所以我采用的是指定jdk8方式,当然你也可以采用设置环境变量的方式

# cd elasticsearch-6.0.1/config

# vi  elasticsearch-env

 

添加jdk8的环境,在调用JAVA_HOME之前添加

 

现在启动es,浏览器访问!查看进程已经存在

访问成功

部署可能遇到的问题参见 https://blog.csdn.net/zhaojiweiwin/article/details/80262935 快速查看

二、安装head插件

1.下载head插件,我采用的是解压上传的方式,当然你可以选择在线安装,以下我将head和ik一并下载上传到es目录下

https://github.com/mobz/elasticsearch-head 

(在线下载方式:wget https://github.com/mobz/elasticsearch-head/archive/1.x.zip )

2.因为head插件是用node.js开发的所以需要此环境,官网下载

https://nodejs.org/en/download/

 

# tar -Jvxf  node-v8.11.1-linux-x64.tar.xz        es目录下执行解压缩,本人下载的是xz格式的

(在线下载方式: wget https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz)

(进入解压后的node-v8.11.1-linux-x64目录下,pwd查看当前目录,拷贝,方便配置环境变量)

vi /etc/profile 配置环境变量(以下操作在root用户下执行,因为没有给esuser赋其它文件夹操作

权限)

配置环境变量
# vi /etc/profile
添加如下配置 node安装时可不放在目录es下
# export NODE_HOME=/opt/apps/elasticsearch-6.0.1/node
# export PATH=$PATH:$NODE_HOME/bin
# export NODE_PATH=$NODE_HOME/lib/node_modules 
执行一下命令
# source /etc/profile

3.执行 npm install -g grunt-cli

4.进入head目录下,执行 npm install 此过程会下载phantomjs (运行npm install时,可能PhantomJS not found on PATH ...可执行 npm install latest)

5.修改head插件配置

修改服务器监听地址:Gruntfile.js (注意true后不要少写“,”)

可在_site/app.js 中配置默认连接ip

6.elasticsearch.yml中增加如下配置:

http.cors.enabled: true

http.cors.allow-origin: "*"

7.grunt server &  后台启动head插件 (加&设置为后台启动,不加ctrl+c退出时则关闭)

因为没有设置head插件的默认连接ip,所以为localhost,可以手动修改,也可以修改head插件添加

 

 

 

三、安装ik分词器

 

https://github.com/medcl/elasticsearch-analysis-ik.git

https://github.com/medcl/elasticsearch-analysis-ik/releases ES对应的各个版本的ik

方式一:在线安装,复制文件路径,执行elasticsearch-plugin install  路径

V5.5.1以上在线安装方式(在线安装ik配置在config目录下)

在es目录下执行:bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.0.1/elasticsearch-analysis-ik-6.0.1.zip

方式二:下载后安装

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值