elasticsearch5.2安装

1、下载elasticsearch-5.2.0.rpm

rpm -i  安装

安装后各个目录说明

#/usr/share/elasticsearch/               主目录
#/var/log/elasticsearch                   log日志

#/etc/sysconfig/elasticsearch          配置elasticsearch环境变量 
#/etc/elasticsearch/elasticsearch.yml  配置elasticsearch集群
#/etc/elasticsearch/jvm.options        配置elasticsearch的jvm参数
#/etc/elasticsearch/log4j2.properties  配置elasticsearch日志参数

elasticsearch启动命令
sudo -i service elasticsearch start
sudo -i service elasticsearch stop

启动报错1

es5.2无法启动bug
报错:
ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

原因:
这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

解决:
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

可以查看issues
https://github.com/elastic/elasticsearch/issues/22899

启动报错2

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
max number of threads [1024] for user [Hadoop] is too low, increase to at least [2048]
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

编辑limits.conf 文件

vim /etc/security/limits.conf 

* soft nofile 65536
* hard nofile 65536

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

找到如下内容:

soft nproc 1024

修改为

soft nproc 2048

vi /etc/sysctl.conf

添加下面配置:vm.max_map_count=655360

并执行命令:sysctl -p

启动报错3

报找不到JAVA_HOME

找到#/etc/sysconfig/elasticsearch文件   配置elasticsearch环境变量 ,增加# Elasticsearch Java path
JAVA_HOME

# Elasticsearch Java path
JAVA_HOME=/usr/local/java/

2、安装ik

Git网址

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

1)下载

checkout ik version respective to your elasticsearch version

git checkout tags/{version}

2)编译,需要maven

mvn package

3)

copy and unzip target/releases/elasticsearch-analysis-ik-{version}.zip to your-es-root/plugins/ik

4)restart elasticsearch

5)测试分词例子
curl -XPUT http://101.201.115.106:9201/index

curl -XPOST http://101.201.115.106:9201/index/fulltext/_mapping -d'
{
    "fulltext": {
             "_all": {
            "analyzer": "ik_max_word",
            "search_analyzer": "ik_max_word",
            "term_vector": "no",
            "store": "false"
        },
        "properties": {
            "content": {
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_max_word",
                "include_in_all": "true",
                "boost": 8
            }
        }
    }
}'
curl -XPOST http://101.201.115.106:9201/index/fulltext/1 -d'
{"content":"美国留给伊拉克的是个烂摊子吗"}
'
curl -XPOST http://101.201.115.106:9201/index/fulltext/2 -d'
{"content":"公安部:各地校车将享最高路权"}
'
curl -XPOST http://101.201.115.106:9201/index/fulltext/3 -d'
{"content":"中韩渔警冲突调查:韩警平均每天扣1艘中国渔船"}
'
curl -XPOST http://101.201.115.106:9201/index/fulltext/4 -d'
{"content":"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首"}'
curl -XPOST http://101.201.115.106:9201/index/fulltext/_search  -d'
{
    "query" : { "match" : { "content" : "中国" }},
    "highlight" : {
        "pre_tags" : ["<tag1>", "<tag2>"],
        "post_tags" : ["</tag1>", "</tag2>"],
        "fields" : {
            "content" : {}
        }
    }
}
'3、安装head,这个比较麻烦,需要安装nodejs,npm,不像之前2.1版本,直接copy到plugin。

请参考http://hnr520.blog.51cto.com/4484939/1867033

转载于:https://my.oschina.net/u/3346994/blog/860287

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值