elasticsearch5.0安装

1.elasticsearch5.0安装

 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz 
 tar -zxvf elasticsearch-5.0.0.tar.gz
 groupadd elsearch
 useradd elsearch -g elsearch -p elsearch
 chown -R elsearch:elsearch elasticsearch-5.0.0
 su elsearch
 cd elasticsearch-5.0.0/
 bin/elasticsearch

说明:安装elasticsearch的时候必须创建一个用户,elasticsearch禁止在root用户下启动

2.安装x-pack
说明:
x-pack下包括了一下插件
1:Security(formerly Shield)
2:Alerting(via Watcher)
3:Monitoring(formerly Marvel)
4:Reporting
5:Graph
安装:
1.使用命令
./elasticsearch-plugin install x-pack
说明:这种安装方式下载x-pack包会很慢,可以试试离线安装
2.离线安装:

./elasticsearch-plugin install file:///home/elsearch/ifttt/x-pack-5.0.2.zip 

说明:这种方式安装,文件路径一点要带file:///且是绝对路径
安装完x-pack之后由于有Security,所以访问的时候需要认证
可以用如下方式访问:

curl –header “Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==” http://192.168.38.59:9200
安装完成之后默认用户名和密码为:elastic和changeme
ZWxhc3RpYzpjaGFuZ2VtZQ== 是对elastic:changeme的base64编码

3.elasticsearch-head
下载最新版的es-head,挂载到nginx下面去即可。
sysctl.conf 加上 : vm.max_map_count=655300
elasticsearch.yml 里面加上:
network.host: 0.0.0.0
http.cors.enabled: true #开启跨域访问支持,默认为false
http.cors.allow-origin:/.+/ #跨域访问允许,使用正则
配置好之后启动elasticsearch,可能会报process is low,increase to at least [2048] 或者 increase to at least [65536]的错,按如下方式修改:

vi /etc/security/limits.conf

末尾加上:
* soft nofile 2048
* hard nofile 65536
* soft nproc 2048
* hard nproc 65536

vi /etc/security/limits.d/90-nproc.conf 

修改90-nproc.conf的内容为:
* soft nproc 2048

说明:
对于安装了x-pack的elasticsearch5.0在使用elasticsearch-head的时候需要加上用户名和密码

例如:
http://192.168.38.59/es-head/?auth_user=elastic&auth_password=changeme

同时在elasticsearch.yml 里面需要加上以下配置:
http.cors.allow-headers: “Authorization”

不然elasticsearch-head连接elasticsearch的会报错:

Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response

4.中文分词插件ik安装

  wget https://codeload.github.com/medcl/elasticsearch-analysis-ik/zip/v5.0.0
  unzip elasticsearch-analysis-ik-5.0.0.zip
  cd elasticsearch-analysis-ik-5.0.0
  mvn package
  cp target/releases/elasticsearch-analysis-ik-5.0.0.zip /opt/elasticsearch-  5.0.0/plugins/ik
  cd /opt/elasticsearch-5.0.0/plugins/ik
  unzip elasticsearch-analysis-ik-5.0.0.zip

解压之后重启elasticsearch
测试分词器:
curl -XPOST http://localhost:9200/_analyze?analyzer=ik_smart -d ‘中韩渔警冲突调查:韩警平均每天扣1艘中国渔船’

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值