ElasticSearch——2.X总结

1. ES2.X  plugin

1、rivers

所有的rivers都在2.x版本总不再支持,所以mongoDB的数据同步无法再通过rivers进行同步。

https://www.elastic.co/blog/deprecating-rivers

根据官方的文档显示,解决的办法一是通过已有的各客户端软件(如elasticsearc-net)进行迁移。【当然这里肯定速度肯定会比较慢,可以考虑多线程分开写入多个节点以提高效率】。

二是通过logstash的已有river插件获取数据后ship到es中去。【logstash中现在没有mongoDB的river插件】

2、marvel

监控。

其中在es中安装的marvel-agent是es的客户端,在kibana安装的marvel是kibana专门从agent获取数据提供给kibana使用的数据监听器。

3、kibana

通过marvel监控传输的数据对数据进行可视化展示。

4、logstash

日志分析、数据传输。

5、sense

google商店里专门为es提供的可视化查询插件。

6、shield

收费的es安全与权限控制插件。

2. ES2.X Problem

1 . es以localhost可以访问,但是以本地ip却无法访问

百度各种有关ip访问localhost可以访问,或者connection refused的关键词。

1、刚开始以为是host设置的原因,找到了host,修改后无效。

2、网上有人说可能是防火墙的原因,本机访问本机管防火墙什么事?但是还是关了,但是无效。

而kibana是安装了的,无论是以localhost或者本机ip都是可以访问到kibana的,所以这绝不是什么系统设置的原因,应该还是es里的设置的问题。

通过这两天的分析查找终于找到了原因。

在官方网站上给出了明确的答复,es2.x升级了,默认是关闭了连接的。具体链接如下:

Elasticsearch 2.xwill only bind to localhost by default. It will try to bind to both 127.0.0.1(IPv4) and [::1] (IPv6), but will work happily in environments where only IPv4or IPv6 is available. This change prevents Elasticsearch from trying to connectto other nodes on your network unless you specifically tell it to do so. Whenmoving to production you should configure the network.host parameter,either in the elasticsearch.yml config file oron the command line:

https://www.elastic.co/guide/en/elasticsearch/reference/2.1/breaking_20_network_changes.html

2. 每次es启动的时候都会报下图这个警告

 

https://discuss.elastic.co/t/elasticsearch-2-1-network-settings/35633/2

通过上面的链接讨论的问题可知,这个警告信息可以忽略。

当然这个警告信息的作用主要是用来略过系统内核的一起启动项用来对es启动进行加速。

3.安装Marvel插件出错


https://www.elastic.co/guide/en/marvel/current/getting-started.html

查看安装命令

bin/plugin install license

bin/plugin install marvel-agent

下载kibana 安装包 ,注意不要放在Plugin下面,否则ES无法启动,总是报错无法找到文件

plugin-descriptor.properties


在安装包路径 执行下面的命令,安装mavel

bin/kibanaplugin --installelasticsearch/marvel/latest

 

4.安装sense插件

Sense:A JSON aware developer's interface to Elasticsearch. Comes withhandy machinery such as syntax highlighting, API suggestions, formatting andcode folding.


2.x之后mavel中去除谷歌插件sense,现在sense成为kibana app。因此需要首先安装kibana,然后在安装sense,install Sense running the followingcommand from your Kibana folder:

命令如下: $ ./bin/kibana plugin --installelastic/sense

启动kibana:$./bin/kibana

访问地址:localhost:5601/app/sense

5ES启动出错

[2016-01-25 13:33:05,483][WARN ][bootstrap                ] unable to install syscallfilter: syscall filtering not supported for OS: 'Windows 7'

[2016-01-25 13:33:05,826][INFO ][node] [shi2.1.1_node-1]version[2.1.1], pid[10140], build[40e2c53/2015-12-15T13:05:55Z]

[2016-01-25 13:33:05,826][INFO ][node] [shi2.1.1_node-1]initializing ...

[2016-01-25 13:33:05,838][ERROR][bootstrap] Exception

java.lang.IllegalStateException: Unable to initializeplugins

         at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:111)

         atorg.elasticsearch.node.Node.<init>(Node.java:146)

         atorg.elasticsearch.node.Node.<init>(Node.java:128)

         atorg.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)

         atorg.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)

         atorg.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)

         atorg.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

Caused by:java.nio.file.NoSuchFileException: F:\个人学习东西\ElasticsSearch\elasticsearch-2.1.1\elasticsearch-2.1.1\plugins\kibana-4.3.1-windows\plugin-descriptor.properties

         atsun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)

         atsun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)

         atsun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)

         atsun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)

         atjava.nio.file.Files.newByteChannel(Files.java:317)

         atjava.nio.file.Files.newByteChannel(Files.java:363)

         atjava.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)

         atjava.nio.file.Files.newInputStream(Files.java:108)

         atorg.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:86)

         atorg.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:302)

         atorg.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:108)

         ... 6 more

网上查找资料的:

All plugins are now required to have a https://github.com/elastic/elasticsearch/blob/2.0/dev-tools/src/main/resources/plugin-metadata/plugin-descriptor.properties[plugin-descriptor.properties]  file. If a node has a plugin installed which lacks this file, it will beunable to start.

于是在指定位置添加了[plugin-descriptor.properties]文件,但是还是有问题

[2016-01-25 14:05:37,990][WARN ][bootstrap                ] unable to install syscallfilter: syscall filtering not supported for OS: 'Windows 7'

[2016-01-25 14:05:38,313][INFO ][node                     ] [shi2.1.1_node-1]version[2.1.1], pid[240], build[40e2c53/2015-12-15T13:05:55Z]

[2016-01-25 14:05:38,313][INFO ][node                     ] [shi2.1.1_node-1]initializing ...

[2016-01-25 14:05:38,325][ERROR][bootstrap                ] Exception

java.lang.IllegalArgumentException:Plugin [kibana] is a site plugin but has no '_site/' directory

              atorg.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:135)

              atorg.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:302)

              atorg.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:108)

              atorg.elasticsearch.node.Node.<init>(Node.java:146)

              atorg.elasticsearch.node.Node.<init>(Node.java:128)

              atorg.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)

              atorg.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)

              atorg.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)

              atorg.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

3.支持的浏览器类型


4.集群冲突

在局域网内,出现两个有相同集群名称的时候,有一个会出现冲突

查询访问出错


分词出错


5. 日志管理方案

Elasticsearch + Logstash + Kibana(ELK)是一套开源的日志管理方案,分析网站的访问情况时我们一般会借助Google/百度/CNZZ等方式嵌入JS做数据统计,但是当网站访问异常或者被攻击时我们需要在后台分析如Nginx的具体日志,而Nginx日志分割/GoAccess/Awstats都是相对简单的单节点解决方案,针对分布式集群或者数据量级较大时会显得心有余而力不足,而ELK的出现可以使我们从容面对新的挑战。

 

Logstash:负责日志的收集,处理和储存

Elasticsearch:负责日志检索和分析

Kibana:负责日志的可视化


6.分词插件IK

插件安装

   1.下载https://github.com/medcl/elasticsearch-analysis-ik

 

   2.解压进入目录执行"mvn clean package",生成target目录。

 

   3.解压后将config/ik目录复制到你的elasticsearch主目录的config目录下

 

   4.编辑config/elasticsearch.yml,在文件末尾添加下面内容(不能有tab键,只许空格)

 

 

[html] view plain copy

index: 

 analysis:                    

   analyzer:       

     ik: 

         alias: [ik_analyzer] 

         type: org.elasticsearch.index.analysis.IkAnalyzerProvider 

     ik_max_word: 

         type: ik 

         use_smart: false 

     ik_smart: 

         type: ik 

         use_smart: true 

index.analysis.analyzer.default.type:ik 

 


   5.在elasticsearch主目录plugins目录(没有就自己新建这个目录)下新建analysis-ik目录,复制解压打包生成的文件elasticsearch-analysis-ik-1.7.jar(位于target目录下)到新建的analysis-ik目录下。

 

   6.将target/releases下的所有jar包复制到elasticsearch主目录下的lib目录下。


测试发现出错:


 

 格式错误,但是之前1.6版本是完全可以使用的,后来尝试最标准的写法,在待分词的词前面加上“text”标注,于是分词成功。但是在1.6版本中text也会在分词结果中,所以一直习惯直接写待分词语句。可能是新版本完善的地方吧。



例如,1.6版本这样写就可以



因此如果我们升级到新的版本,需要在前面添加“text”,才可以使用已存在的和自定义的分词器。


 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值