当前位置: 首页 > news >正文

辛集市网站建设_网站建设公司_百度智能云_seo优化

常州高端网站建设,广州做网站建设的公司排名,东莞免费网站制作,做网站多少钱一个Easysearch 一直致力于提高易用性#xff0c;这也是我们的核心宗旨#xff0c;然而之前一直没有官方的 Java 客户端#xff0c;也对用户使用造成了一些困扰#xff0c;现在#xff0c;我们正式发布了第一个 Java 客户端 Easysearch-client:1.0.1。 这一里程碑式的更新为开…Easysearch 一直致力于提高易用性这也是我们的核心宗旨然而之前一直没有官方的 Java 客户端也对用户使用造成了一些困扰现在我们正式发布了第一个 Java 客户端 Easysearch-client:1.0.1。 这一里程碑式的更新为开发人员带来了前所未有的便利性使得与 Easysearch 集群的交互变得更加简洁和直观。通过 Easysearch-client开发者可以直接使用 Java 方法和数据结构来进行交互而不再需要依赖于传统的 HTTP 方法和 JSON。 这一变化大大简化了操作流程使得数据管理和索引更加高效。Java 客户端的功能范围包括处理数据操作管理集群包括查看和维护集群的健康状态并对 Security 模块全面兼容。它提供了一系列 API用于管理角色、用户、权限、角色映射和账户。 这意味着安全性和访问控制现在可以更加细粒度地管理确保了数据的安全性和合规性。 在这篇博客中你将学习如何配置 Easysearch-client 客户端以通过 HTTPS 连接到 Easysearch。为了演示目的我将首先设置一个带有 SSL 证书的 Easysearch 服务器。如果你已经有一个在运行你可以跳过这一步。 接下来我将引导你完成在 Java 应用程序中配置和使用 Java 客户端的步骤。 设置 Easysearch 服务器 首先从极限科技官网下载最新的 Mac 版本。我使用的是 1.6.1 版本这是我写这篇文章时的最新版本。 wget https://dl-global.infinilabs.com/easysearch/stable/easysearch-1.6.1-214-mac-amd64.zip确保您的系统已经安装并设置了 java 环境变量版本在 11 以上。 解压下载文件。 unzip easysearch-1.6.1-214-mac-amd64.zip -d easysearch-1.6.1cd 到 easysearch-1.6.1 执行初始化脚本来生成证书并自动下载插件。 bin/initialize.sh脚本执行后会自动输出随机生成的 admin 用户密码。 启动 Easysearch bin/easysearch此时您的服务器已经准备就绪。您可以查看 logs/initialize.log 里显示的 curl 命令来进行验证。 curl -ku admin:xxxxxxxxx https://localhost:9200显示类似的输出响应 {name : MacBook-Pro.local,cluster_name : easysearch,cluster_uuid : 1gRYQ6ssTiKGqcyuEN0Dbg,version : {distribution : easysearch,number : 1.6.1,distributor : INFINI Labs,build_hash : 14846e460e9976ba6d68c80bb9eca52af1179dcf,build_date : 2023-10-19T14:43:02.636639Z,build_snapshot : false,lucene_version : 8.11.2,minimum_wire_lucene_version : 7.7.0,minimum_lucene_index_compatibility_version : 7.7.0},tagline : You Know, For Easy Search! }下面我们来看如何设置和使用客户端。 设置 Java 客户端 Easysearch 的 Java 客户端可在 中央仓库https://repo1.maven.org/maven2/ 上获得。将其作为依赖项添加到你的 Java 应用程序中。 对于 Gradle 构建系统在项目的 build.gradle 文件中包含以下依赖项 dependencies {implementation com.infinilabs:easysearch-client:1.0.1implementation org.apache.logging.log4j:log4j-api:2.19.0implementation org.apache.logging.log4j:log4j-core:2.19.0implementation org.apache.httpcomponents:httpclient:4.5.10implementation org.apache.httpcomponents:httpcore-nio:4.4.12implementation org.apache.httpcomponents:httpasyncclient:4.1.4implementation joda-time:joda-time:2.10.4implementation (org.apache.lucene:lucene-core:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-analyzers-common:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-backward-codecs:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-grouping:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-highlighter:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-join:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-memory:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-misc:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-queries:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-queryparser:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-sandbox:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-spatial3d:8.11.2) {exclude group: *, module: *}implementation (org.apache.lucene:lucene-suggest:8.11.2) {exclude group: *, module: *}...... }对于 Maven 构建系统在项目的 pom.xml 文件中包含以下依赖项 dependenciesdependencygroupIdcom.infinilabs/groupIdartifactIdeasysearch-client/artifactIdversion1.0.1/version/dependencydependencygroupIdorg.apache.httpcomponents/groupIdartifactIdhttpclient/artifactIdversion4.5.10/version/dependencydependencygroupIdorg.apache.httpcomponents/groupIdartifactIdhttpcore-nio/artifactIdversion4.4.12/version/dependencydependencygroupIdorg.apache.httpcomponents/groupIdartifactIdhttpasyncclient/artifactIdversion4.1.4/version/dependencydependencygroupIdjoda-time/groupIdartifactIdjoda-time/artifactIdversion2.10.4/version/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-core/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-analyzers-common/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-backward-codecs/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-grouping/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-highlighter/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-join/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-memory/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-misc/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-queries/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-queryparser/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-sandbox/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-spatial3d/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependencydependencygroupIdorg.apache.lucene/groupIdartifactIdlucene-suggest/artifactIdversion8.11.2/versionscopecompile/scopeexclusionsexclusionartifactId*/artifactIdgroupId*/groupId/exclusion/exclusions/dependency /dependencies接下来在你的 Java 应用程序中创建一个 client 实例并使用它在 Easysearch 中创建索引并插入一些数据。但在此之前为了使其工作你需要将签署服务器证书的根机构证书添加到你的应用程序信任库中。让我们看看如何配置 Java 应用程序的信任库。 为了使用 java client你需要将根 CA 证书 ca.crt 添加到应用程序信任库中。这告诉你的 Java 应用程序信任由此根机构签署的任何证书。easysearch-1.6.1/config/ 目录下已经生成了 ca.crt 文件。你可以将其添加到自定义信任库中并在 Java 应用程序中使用该自定义信任库。 使用 Java keytool 创建一个自定义信任库并导入证书。keytool 不理解 .pem 格式所以你需要首先使用 openssl 加密库将证书转换为 .der 格式然后使用 Java keytool 将其添加到自定义信任库中。假设您的操作系统已经预装了 openssl。 第 1 步将 CA 证书从 .pem 格式转换为 .der 格式。 openssl x509 -in easysearch-1.6.1/config/ca.crt -inform pem -out ca.der --outform der第 2 步创建自定义信任库并添加 ca.der 证书。 将 ca 证书添加到应用程序信任库中表示应用程序信任由此 CA 签署的任何证书。 keytool -import -file ca.der -alias easysearch -keystore myTrustStore过程中会提示您输入密钥库口令: 我为了测试用输入的 123456。 通过列出信任库中的证书来确认操作成功这里的 123456 是我上面设置的密码会显示出 easysearch 证书。 keytool -keystore myTrustStore -storepass 123456 -list第 3 步在 Java 应用程序代码中设置指向自定义信任库的系统属性并连接集群创建索引插入数据。 可以通过设置系统属性以指定 SSL/TLS 通信时使用的信任库 System.setProperty(javax.net.ssl.trustStore, /full/path/to/myTrustStore); System.setProperty(javax.net.ssl.trustStorePassword, 123456);HttpHost[] httpHostArray new HttpHost[1]; // infini.cloud 和 CNinfini.cloud 保持一致 httpHostArray[0] new HttpHost(infini.cloud, 9200, https); final CredentialsProvider credentialsProvider new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(admin, 1933791fb2b9f6c6146d));RestHighLevelClient client new RestHighLevelClient(RestClient.builder(httpHostArray).setHttpClientConfigCallback((HttpAsyncClientBuilder httpAsyncClientBuilder) - {httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider);return httpAsyncClientBuilder;}));CreateIndexRequest createIndexRequest new CreateIndexRequest(test-index); createIndexRequest.settings(Settings.builder().put(index.number_of_shards, 1).put(index.number_of_replicas, 1) );//Create index client.indices().create(createIndexRequest, RequestOptions.DEFAULT);// Bulk BulkRequest bulkRequest new BulkRequest(); for (int i 0; i 10; i) {IndexRequest indexRequest new IndexRequest(test-index).id(Integer.toString(i)).source({\field1\:\value i \}, XContentType.JSON);bulkRequest.add(indexRequest); }BulkResponse bulkResponse client.bulk(bulkRequest, RequestOptions.DEFAULT); System.out.println(Strings.toString(bulkResponse));信任已签署 Easysearch 正在使用的证书的 CA 的示例当 CA 证书以 PEM 编码文件的形式可用时 Path caCertificatePath Paths.get(/easysearch-test/easysearch-1.6.1/config/ca.crt); CertificateFactory factory CertificateFactory.getInstance(X.509); Certificate trustedCa; try (InputStream is Files.newInputStream(caCertificatePath)) {trustedCa factory.generateCertificate(is); } KeyStore trustStore KeyStore.getInstance(pkcs12); trustStore.load(null, null); trustStore.setCertificateEntry(ca, trustedCa); SSLContextBuilder sslContextBuilder SSLContexts.custom().loadTrustMaterial(trustStore, null); final SSLContext sslContext sslContextBuilder.build();HttpHost[] httpHostArray new HttpHost[1]; httpHostArray[0] new HttpHost(infini.cloud, 9200, https); final CredentialsProvider credentialsProvider new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(admin, 1933791fb2b9f6c6146d));RestHighLevelClient client new RestHighLevelClient(RestClient.builder(httpHostArray).setHttpClientConfigCallback((HttpAsyncClientBuilder httpAsyncClientBuilder) - {httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider);httpAsyncClientBuilder.setSSLContext(sslContext);return httpAsyncClientBuilder;}));现在您已经成功设置了 Java 客户端并以安全的 HTTPS 通道连接到了 Easysearch 集群。除此之外Java 客户端还具备强大的权限控制管理 API具体请参考我们的官网文档https://www.infinilabs.com/docs/latest/easysearch/references/client/security/ 关于 Easysearch INFINI Easysearch 是一个分布式的近实时搜索与分析引擎核心引擎基于开源的 Apache Lucene。Easysearch 的目标是提供一个轻量级的 Elasticsearch 可替代版本并继续完善和支持更多的企业级功能。 与 Elasticsearch 相比Easysearch 更关注在搜索业务场景的优化和继续保持其产品的简洁与易用性。 官网文档https://www.infinilabs.com/docs/latest/easysearch 下载地址https://www.infinilabs.com/download
http://www.lebaoying.cn/news/10056.html

相关文章:

  • 双语网站怎么做宁波营销网站建设
  • 网站开发设计与实现怎么样做网站才能适应手机屏幕
  • 网站建设要具备那些深圳地产网站制作公司
  • 免费推广网站注册入口杨凌做网站的
  • 新加坡网站大全上海城隍庙简介
  • 大公司网站开发如何利用wordpress编辑网站
  • 公司网站建设济南兴田德润地址电话做网站的推广
  • 高水平网站运营托管wordpress实现聊天功能
  • 网站建设公司哪家最好网站开发文档上传服务器
  • 网站建设iis配置中国工厂网网址
  • 上海人才网站建设中小企业网站建设策划
  • 做网站是用源码还是模版江山网站设计
  • 江西建设安全网站个人网站建设作用
  • 为中国移动做网站的公司叫什么seo建站营销
  • 免费建网站赚钱网站全局变量
  • 中国职业培训在线官方网站百度商城官网首页
  • 高安网站建设公司wordpress wow.js
  • 旅游网站建设ppt网站素材模板
  • 培训制作网站源码聊城做网站的公司流程
  • 基于php mysql的网站开发苏州网站推广服务
  • 免费申请com网站希爱力双效片用后感受
  • 网站服务器错误怎么办莱芜 做网站 公司
  • 口碑营销的概念专业做汽车网站优化排名
  • 做网站策划容易遇到哪些问题建设银行网站修改手机号
  • 个人网站是商业的吗临沂制作网站软件
  • 小程序开发 网站建设谷歌seo实战教程
  • 网站策划做营销推广好项目网
  • 宁波龙山建设有限公司网站怎么建设一个购买卡密的网站
  • 手机网站开发哪家好网站 后台 数据 下载
  • 浅谈京东企业的电子商务网站建设免费发布广告信息平台