看到一篇elasticssearch+kibanna的文章,觉得很好,不过例子是python的,所以使用java自己安装一下:
安装包:
可以到以下两个网站去下载对应的安装包:
https://www.elastic.co/products/elasticsearch elasticsearch官网
https://www.elastic.co/products/kibana kibana 官网
elasticsearch启动:
解压elasticsearch-5.5.0.zip,进入bin目录,运行elasticsearch.bat
访问http://localhost:9200/
kibana启动:
解压kibana-5.5.0-windows-x86.zip,进入config目录,修改kibana.yml文件,配置elasticsearch.url地址,就是刚才的elasticsearch的web地址
运行bin目录下的kibana.bat文件
访问http://localhost:5601/
目前里边还没有任何数据。
使用java进行数据操作:
数据参考了这篇文档 http://blog.csdn.net/ming_311/article/details/50619859
创建一个maven工程,引入客户端
maven依赖的地址:http://mvnrepository.com/artifact/org.elasticsearch.client/transport
<dependencies> <!-- https://mvnrepository.com/artifact/org.elasticsearch.client/transport --> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> <version>5.5.1</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>2.7</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.7</version> </dependency> <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> </dependency> </dependencies>
在src/main/resources创建一个log4j2的配置文件
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
创建
http://blog.csdn.net/ming_311/article/details/50619859