标签:style -o lease index oca crud security soft system
Linux用户登录(bae),我们用的是5.3版本的包。从官网下载:
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.tar.gz
解压后,进入到bin目录下,使用 ./elasticsearch 命令启动,看到如下的提示,即为启动成功。端口号9200.
1.记住不要在root下启动,否则会报错:can not run elasticsearch as root
2.如果是在root下下载的elasticsearch,可能会报下面的错误:
main ERROR Could not register mbeans Java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
【解决】:改变elasticsearch文件夹所有者到当前用户
sudo chown -R bae:bae elasticsearch
3. jdk的版本要在1.8以上
4.错误:
ERROR: bootstrap checks failed max file descriptors [10240] for elasticsearch process is too low, increase to at least [65536] system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk [2017-05-09T21:34:03,914][INFO ][o.e.n.Node ] [m1-hic-ssd-bae03] stopping ... [2017-05-09T21:34:03,946][INFO ][o.e.n.Node ] [m1-hic-ssd-bae03] stopped [2017-05-09T21:34:03,946][INFO ][o.e.n.Node ] [m1-hic-ssd-bae03] closing ... [2017-05-09T21:34:03,960][INFO ][o.e.n.Node ] [m1-hic-ssd-bae03] closed
【解决方法】:
切换到root用户, vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
vi /etc/security/limits.d/90-nproc.conf
修改如下内容: * soft nproc 1024
#修改为 * soft nproc 2048
vi /etc/sysctl.conf
添加下面配置:vm.max_map_count=
655360
并执行命令: sysctl -p
重启elasticsearch
5. 报错:
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
【解决】:
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false bootstrap.system_call_filter: false
【错误原因】:
这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
多机集群中的节点可以分为master nodes和data nodes,在配置文件中使用Zen发现(Zen discovery)机制来管理不同节点。Zen发现是ES自带的默认发现机制,使用多播发现其它节点。只要启动一个新的ES节点并设置和集群相同的名称这个节点就会被加入到集群中。
Elasticsearch集群中有的节点一般有三种角色:master node、data node和client node。
我们选m1这台机器作为client node,elasticsearch.yml中的配置如下:
cluster.name: mkt-es-cluster node.name: ${HOSTNAME} network.host: 0.0.0.0 discovery.zen.ping.unicast.hosts: ["10.**.**.**"]
在m2上配置elasticsearch.yml:
cluster.name: mkt-es-cluster node.name: ${HOSTNAME} network.host: 0.0.0.0 discovery.zen.ping.unicast.hosts: ["10.**.**.**"]
我们在任意一台机器上请求:curl ‘localhost:9200/_cat/health?v‘
我们可以看到,标志着集群状态的status显示为green,节点个数为2个。
1.下载安装包https://github.com/medcl/elasticsearch-analysis-ik/releases
有针对不同es版本的安装包,需要下载与所安装的es版本匹配的安装包。我们还是用5.3.0版本.zip格式的好了。
2.在elasticsearch/plugins目录下新建ik目录,将zip包拷贝到ik目录下,解压。
3.重启elasticsearch
4.注意事项:如果是搭建的集群,需要在每个节点下都安装ik
5.调用下面的url
GET _analyze { "analyzer":"ik_max_word", "text":"中华人民共和国国歌" }
会得到下面结果:
{ "tokens": [ { "token": "中华人民共和国", "start_offset": 0, "end_offset": 7, "type": "CN_WORD", "position": 0 }, { "token": "中华人民", "start_offset": 0, "end_offset": 4, "type": "CN_WORD", "position": 1 }, { "token": "中华", "start_offset": 0, "end_offset": 2, "type": "CN_WORD", "position": 2 }, { "token": "华人", "start_offset": 1, "end_offset": 3, "type": "CN_WORD", "position": 3 }, { "token": "人民共和国", "start_offset": 2, "end_offset": 7, "type": "CN_WORD", "position": 4 }, { "token": "人民", "start_offset": 2, "end_offset": 4, "type": "CN_WORD", "position": 5 }, { "token": "共和国", "start_offset": 4, "end_offset": 7, "type": "CN_WORD", "position": 6 }, { "token": "共和", "start_offset": 4, "end_offset": 6, "type": "CN_WORD", "position": 7 }, { "token": "国", "start_offset": 6, "end_offset": 7, "type": "CN_CHAR", "position": 8 }, { "token": "国歌", "start_offset": 7, "end_offset": 9, "type": "CN_WORD", "position": 9 } ] }
或者通过postman采用这种方式:hz01-bae3-rdtest00.hz01.baidu.com:8920/_analyze?analyzer=ik_max_word&text= 我是好人
问题表现:请求es机器集群信息:http://*******.com:8920/_cluster/health?pretty
但是kibana上面status确实red,重启都不行。显示如下:
先恢复一下数据吧,参照下面链接:
https://stackoverflow.com/questions/42376101/getting-plugin-is-red-error-when-launching-kibana
删掉es的每个节点下data/es/ 里面的所有数据,重启每个节点。就ok了。
具体原因参考下面链接:(其实就是我不知道怎么的吧.kibana这个索引删掉了)
https://stackoverflow.com/questions/31201051/elasticsearch-is-still-initializing-the-kibana-index
标签:style -o lease index oca crud security soft system
原文地址:http://www.cnblogs.com/sonofelice/p/6937061.html