elasticsearch插件 x-pack.security组件的使用
2017-12-25 15:00
405 查看
离线安装x-pack:
下载es对应的相应版本的x-pack,修改版本号即可通过官方链接下载:
安装后使用head修改yml文件:
head需要:
http.cors.enabled: true
http.cors.allow-origin:’*’
安装x-pack后需要:
http.cors.allow-headers: “Authorization”
访问head格式更改为:
http://localhost:9100/?auth_user=elastic&auth_password=changeme
破解x-pack参考:
http://blog.csdn.net/mvpboss1004/article/details/65445023
http://blog.csdn.net/qq_20641565/article/details/78286894
java客户端api
maven pom.xml导入(maven库里没有xpack包则需要用es官网的maven库):
<repositories>
<repository>
<id>elasticsearch-releases</id>
<url>https://artifacts.elastic.co/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>
连接es集群:
Settings settings = Settings.builder()
.put("cluster.name", "my-application")
.put("xpack.security.transport.ssl.enabled", false)
.put("xpack.security.user", "elastic:changeme")
.put("client.transport.sniff", true)
.build();
client = new PreBuiltXPackTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
XPackClient xClient = new XPackClient(client);
下载es对应的相应版本的x-pack,修改版本号即可通过官方链接下载:
https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-6.1.1.zip
下载后放到指定位置如/usr/x-pack-6.1.1.zip并到es安装目录下运行:
./bin/elasticsearch-plugin install file:///usr/x-pack-6.1.1.zip
安装完重启即可,默认用户 elasitc:changeme
[/code]restful访问方式改为 curl -u elastic:changeme -XGET .......
[/code]安装后使用head修改yml文件:
head需要:
http.cors.enabled: true
http.cors.allow-origin:’*’
安装x-pack后需要:
http.cors.allow-headers: “Authorization”
访问head格式更改为:
http://localhost:9100/?auth_user=elastic&auth_password=changeme
破解x-pack参考:
http://blog.csdn.net/mvpboss1004/article/details/65445023
http://blog.csdn.net/qq_20641565/article/details/78286894
java客户端api
maven pom.xml导入(maven库里没有xpack包则需要用es官网的maven库):
<repositories>
<repository>
<id>elasticsearch-releases</id>
<url>https://artifacts.elastic.co/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>
连接es集群:
Settings settings = Settings.builder()
.put("cluster.name", "my-application")
.put("xpack.security.transport.ssl.enabled", false)
.put("xpack.security.user", "elastic:changeme")
.put("client.transport.sniff", true)
.build();
client = new PreBuiltXPackTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
XPackClient xClient = new XPackClient(client);
相关文章推荐
- ElasticSearch + xpack 使用.md
- [svc]elk5.x x-pack插件使用(elasticsearch5)
- ElasticSearch5.4.3 环境搭建 2017 (4-安全插件-监控工具x-pack)
- ElasticSearch + xpack 使用
- ElasticSearch插件-elasticsearch-jdbc
- 使用logstash+elasticsearch+kibana快速搭建日志平台
- Spring-Security-core插件使用教程
- ubuntu安装elasticsearch&简单使用
- 【参考】cents ElasticSearch 5.0及head插件安装 参考配置
- elasticsearch ik pingyin 分词器的安装和使用
- 搜索学习--Elasticsearch全文搜索服务器的基本使用
- Elasticsearch Rest Client pinpoint插件运行效果图
- 使用logstash+elasticsearch+kibana快速搭建日志平台
- elasticsearch5.4.2安装以及插件head的安装过程
- vue项目优化之按需加载组件-使用webpack require.ensure
- ElasticsearchCRUD使用(十四)【ElasticsearchCRUD搜索查询和过滤】
- 使用ELK(Elasticsearch + Logstash + Kibana) 搭建日志集中分析平台实践--转载
- Elasticsearch.Net使用教程 MVC4图书管理系统(2)
- CentOS7使用Elasticsearch+ Logstash+kibana快速搭建日志分析平台
- hanlp for elasticsearch(基于hanlp的es分词插件)