ES升级--04--SpringBoot整合Elasticsearch

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • SpringBoot整合Elasticsearch
    • 1.建立项目
    • 2.Maven 依赖
        • [ES 官方网站:https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.8/index.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.8/index.html)
    • 3. pom配置
    • 4.证书文件elastic-certificates.p12 拷贝
        • 证书文件elastic-certificates.p12需拷贝到所有ES节点对应的目录下
    • 5.配置类 ElasticsearchConfig
      • SecureRestClientConfig
    • 6.nacos配置参数
    • 7.测试
      • 1.TransportClient
      • 2.ElasticsearchTemplate
      • 3.RestHighLevelClient
      • 4.ElasticsearchRestTemplate


SpringBoot整合Elasticsearch

1.建立项目

在这里插入图片描述
在这里插入图片描述

2.Maven 依赖

进入到 ES 官方网站

ES 官方网站:https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.8/index.html

在这里插入图片描述

  • 可以看到有低级和 高级的 Rest Client

在这里插入图片描述

3. pom配置

基于 springboot 2.1.7.RELEASE

<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope><exclusions><exclusion><groupId>org.junit.vintage</groupId><artifactId>junit-vintage-engine</artifactId></exclusion></exclusions></dependency><!-- ES --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-elasticsearch</artifactId></dependency><dependency><groupId>org.springframework.data</groupId><artifactId>spring-data-elasticsearch</artifactId><version>3.2.9.RELEASE</version></dependency><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>6.8.23</version><exclusions><exclusion><groupId>org.elasticsearch.client</groupId><artifactId>transport</artifactId></exclusion><exclusion><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-client</artifactId></exclusion><exclusion><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.elasticsearch.client</groupId><artifactId>transport</artifactId><version>6.8.23</version></dependency><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-client</artifactId><version>6.8.23</version></dependency><dependency><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId><version>6.8.23</version></dependency><dependency><groupId>org.elasticsearch.plugin</groupId><artifactId>transport-netty4-client</artifactId><version>6.8.23</version></dependency><!-- Elasticsearch客户端依赖版本升级到6.8.32 新增x-pack依赖--><dependency><groupId>org.elasticsearch.client</groupId><artifactId>x-pack-transport</artifactId><version>6.8.23</version></dependency>

4.证书文件elastic-certificates.p12 拷贝

证书文件elastic-certificates.p12需拷贝到所有ES节点对应的目录下
  • 注意:只需创建一次证书并将其复制到所有节点。

在这里插入图片描述

5.配置类 ElasticsearchConfig

支持x-pack 密码验证

/*** ES 配置 -----Elasticsearch 6.8.23* 通过实现配置配,初始化安全Elasticsearch客户端对象,包括ElasticsearchTemplate和RestHighLevelClient两者客户端类* 支持x-pack 密码验证*/@Slf4j
@Configuration
public class SecureElasticsearchConfig {//用户名 elastic@Value("${elasticsearch.xpack.username}")private String xpackUsername = "elastic";//用户密码@Value("${elasticsearch.xpack.password}")private String xpackrPassword;//证书路径  "/home/data/es"@Value("${elasticsearch.xpack.kspath}")private String certPath;//证书密码  ""@Value("${elasticsearch.xpack.kspwd}")private String certPassword;//集群名@Value("${elasticsearch.master.cluster-name}")private String masterClusterName;//节点名@Value("${elasticsearch.master.clusterNodes}")private String clusterNodes;//ip@Value("${elasticsearch.master.address}")private String masterAddress;//端口@Value("${elasticsearch.master.port}")private Integer masterPort;//    // es 连接超时时间
//    private int connectTimeOut;
//    // es socket 连接超时时间
//    private int socketTimeOut;
//    // es 请求超时时间
//    private int connectionRequestTimeOut;
//    // es 最大连接数
//    private int maxConnectNum;
//    // es 每个路由的最大连接数
//    private int maxConnectNumPerRoute;/***集群配置*/private Settings settings() {Settings.Builder builder = Settings.builder();//基础配置builder.put("cluster.name", masterClusterName);builder.put("xpack.security.user", xpackUsername+ ":" + xpackrPassword);// Keystore 配置builder.put("xpack.security.transport.ssl.keystore.path", certPath);builder.put("xpack.security.transport.ssl.keystore.password", certPassword);// Truststore 配置builder.put("xpack.security.transport.ssl.truststore.path", certPath);builder.put("xpack.security.transport.ssl.truststore.password", certPassword);// 验证模式配置builder.put("xpack.security.transport.ssl.verification_mode", "certificate");// 启用 X-Pack 安全功能builder.put("xpack.security.enabled", true);builder.put("xpack.security.transport.ssl.enabled", true);return builder.build();}/*** 初始化安全TransportClient类*/@Beanpublic TransportClient transportClient() throws Exception {//本地测试用// certPath="D:\\cdms\\es\\elastic-certificates.p12";log.info(">>>>>>>>>>> SecureElasticsearchConfig TransportClient 开始初始化");Settings settings = settings();PreBuiltXPackTransportClient client = new PreBuiltXPackTransportClient(settings);client.addTransportAddress(new TransportAddress(InetAddress.getByName(masterAddress), masterPort));return client;}/***初始化安全ElasticsearchTemplate类* 基于 spring-boot-starter-data*/@Beanpublic ElasticsearchTemplate elasticsearchTemplate(@Autowired TransportClient transportClient) throws Exception {log.info(">>>>>>>>>>> SecureElasticsearchConfig ElasticsearchTemplate 开始初始化");ElasticsearchTemplate secureElasticsearchTemplate;try {secureElasticsearchTemplate = new ElasticsearchTemplate(transportClient);return secureElasticsearchTemplate;} catch (Exception e) {log.error("SecureElasticsearchConfig  初始化ElasticsearchTemplate报错: ", e.getMessage());throw e;}}/*** 初始化安全RestHighLevelClient类* 只支持http  端口: 9200*/@Beanpublic RestHighLevelClient restHighLevelClient() {log.info(">>>>>>>>>>> SecureElasticsearchConfig RestHighLevelClient 开始初始化");final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();credentialsProvider.setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(xpackUsername, xpackrPassword));RestClientBuilder builder = RestClient.builder(new HttpHost(masterAddress,9200)).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {@Overridepublic HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder) {return httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider);}});RestHighLevelClient client = new RestHighLevelClient(builder);//        // 连接延时配置
//        builder.setRequestConfigCallback(requestConfigBuilder -> {
//            requestConfigBuilder.setConnectTimeout(connectTimeOut);
//            requestConfigBuilder.setSocketTimeout(socketTimeOut);
//            requestConfigBuilder.setConnectionRequestTimeout(connectionRequestTimeOut);
//            return requestConfigBuilder;
//        });
//        // 连接数配置
//        builder.setHttpClientConfigCallback(httpClientBuilder -> {
//                    httpClientBuilder.setMaxConnTotal(maxConnectNum);
//                    httpClientBuilder.setMaxConnPerRoute(maxConnectNumPerRoute);
//                    httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
//                    return httpClientBuilder;
//        });return client;}/***初始化安全ElasticsearchRestTemplate类* 基于 spring-boot-starter-data*/@BeanElasticsearchRestTemplate elasticsearchRestTemplate(@Autowired RestHighLevelClient restHighLevelClient) {log.info(">>>>>>>>>>> SecureElasticsearchConfig ElasticsearchRestTemplate 开始初始化");return new ElasticsearchRestTemplate(restHighLevelClient);}}

SecureRestClientConfig

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;import java.util.Arrays;/*** ES 配置 -----Elasticsearch 6.8.23* 通过实现配置配,初始化安全 RestHighLevelClient,ElasticsearchRestTemplate客户端类* 支持x-pack 密码验证*/
@Slf4j
@Configuration
@ConfigurationProperties(prefix = "spring.elasticsearch.rest")
public class SecureRestClientConfig {//端口 ip@Setterprivate String[] hosts = new String[]{};//用户名 elastic@Setterprivate String xpackusername;//用户密码@Setterprivate String xpackpassword;//    // es 连接超时时间
//    private int connectTimeOut;
//    // es socket 连接超时时间
//    private int socketTimeOut;
//    // es 请求超时时间
//    private int connectionRequestTimeOut;
//    // es 最大连接数
//    private int maxConnectNum;
//    // es 每个路由的最大连接数
//    private int maxConnectNumPerRoute;/*** 初始化安全RestHighLevelClient类* 只支持http  端口: 9200*/@Beanpublic RestHighLevelClient restHighLevelClient() {log.info(">>>>>>>>>>> RestClientConfig RestHighLevelClient 开始初始化");HttpHost[] httpHosts = Arrays.stream(hosts).map(x -> {String[] hostInfo = x.split(":");return new HttpHost(hostInfo[0], Integer.parseInt(hostInfo[1]));}).toArray(HttpHost[]::new);log.info("elasticsearch hosts: ", Arrays.toString(httpHosts));final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(xpackusername, xpackpassword));RestClientBuilder builder = null;try {builder = RestClient.builder(httpHosts).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {@Overridepublic HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder) {return httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider);}});} catch (Exception e) {log.error("RestClientConfig  初始化RestHighLevelClient报错: ", e.getMessage());throw new RuntimeException(e);}//        // 连接延时配置
//        builder.setRequestConfigCallback(requestConfigBuilder -> {
//            requestConfigBuilder.setConnectTimeout(connectTimeOut);
//            requestConfigBuilder.setSocketTimeout(socketTimeOut);
//            requestConfigBuilder.setConnectionRequestTimeout(connectionRequestTimeOut);
//            return requestConfigBuilder;
//        });
//        // 连接数配置
//        builder.setHttpClientConfigCallback(httpClientBuilder -> {
//                    httpClientBuilder.setMaxConnTotal(maxConnectNum);
//                    httpClientBuilder.setMaxConnPerRoute(maxConnectNumPerRoute);
//                    httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
//                    return httpClientBuilder;
//        });RestHighLevelClient client = new RestHighLevelClient(builder);return client;}@Bean(name = {"elasticsearchOperations", "elasticsearchTemplate"})ElasticsearchRestTemplate elasticsearchRestTemplate(@Autowired RestHighLevelClient restHighLevelClient) {return new ElasticsearchRestTemplate(restHighLevelClient);}
}

6.nacos配置参数

elasticsearch:xpack:username: elasticpassword: escdmskspath: /home/data/eskspwd: master:cluster-name: gz-java-test-laasclusterNodes: master-test-laasaddress: 192.168.2.89port: 9300

7.测试

1.TransportClient

 @Autowiredprivate  TransportClient transportClient;@Testpublic void createIndex_transportClient() {String indexName="lass_test_transportclient";try {CreateIndexRequest request = new CreateIndexRequest(indexName);// 可以在此处添加更多设置,例如映射 (mapping) 和设置 (settings)CreateIndexResponse response = transportClient.admin().indices().create(request).actionGet();if (response.isAcknowledged()) {System.out.println("Index created successfully: " + indexName);} else {System.out.println("Index creation failed: " + indexName);}} catch (Exception e) {System.err.println("Error creating index: " + e.getMessage());}}@Testpublic void addDocuments_transportClient() {String indexName = "lass_test_transportclient";try {String json1 = "{" +"\"user\":\"kimchy\"," +"\"postDate\":\"2013-01-30\"," +"\"message\":\"trying out Elasticsearch\"" +"}";IndexResponse response1 = transportClient.prepareIndex(indexName, "_doc").setSource(json1, XContentType.JSON).get();//            if (response1.status() == RestStatus.CREATED) {
//                System.out.println("Document 1 indexed successfully.");
//            } else {
//                System.out.println("Failed to index Document 1.");
//            }String json2 = "{" +"\"user\":\"Tom\"," +"\"postDate\":\"2024-01-30\"," +"\"message\":\"lass升级 transportClient \"" +"}";transportClient.prepareIndex(indexName, "_doc").setSource(json2, XContentType.JSON).get();} catch (Exception e) {System.err.println("Error adding documents: " + e.getMessage());}}@Testpublic void deleteIndex_transportClient() {String indexName = "lass_test_transportclient";try {DeleteIndexRequest request = new DeleteIndexRequest(indexName);AcknowledgedResponse response = transportClient.admin().indices().delete(request).actionGet();if (response.isAcknowledged()) {System.out.println("Index deleted successfully: " + indexName);} else {System.out.println("Failed to delete index: " + indexName);}} catch (Exception e) {System.err.println("Error deleting index: " + e.getMessage());}}
GET lass_test_transportclient/_search
{"query":{"match_all" : {}}
}

在这里插入图片描述

2.ElasticsearchTemplate

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Document(indexName = "lass_test_people",type = "_doc",shards = 1,replicas = 1)
public class People {@Idprivate String id;// 整个name不被分词,切不创建索引// Keyword表示不被分词@Field(type= FieldType.Keyword,index = false)private String name;// address被ik分词// Text类型的属性才能被分词@Field(type = FieldType.Text)private String address;@Field(type = FieldType.Long,index = false)private int age;}
 @Autowiredprivate ElasticsearchTemplate elasticsearchTemplate;@Testpublic void createIndex_elasticsearchTemplate() {//根据实体类创建索引,boolean result1 = elasticsearchTemplate.createIndex(People.class);System.out.println(result1);//将索引放到软件里面boolean results = elasticsearchTemplate.putMapping(People.class);}@Testpublic void addDocuments_elasticsearchTemplate() {People peo = new People();peo.setId("123");peo.setName("张三");peo.setAddress("北京市海淀区回龙观东大街");peo.setAge(18);IndexQuery query = new IndexQuery();query.setObject(peo);String result = elasticsearchTemplate.index(query);System.out.println(result);}@Testpublic void bulk(){List<IndexQuery> list = new ArrayList<>();// IndexQuery多行写法IndexQuery indexQuery = new IndexQuery();indexQuery.setObject(new People("1", "王五", "北京东城", 12));list.add(indexQuery);// IndexQuery 连缀写法list.add(new IndexQueryBuilder().withObject(new People("2", "赵六", "北京西城", 13)).build());list.add(new IndexQueryBuilder().withObject(new People("3", "吴七", "北京昌平", 14)).build());elasticsearchTemplate.bulkIndex(list);}@Testpublic void deletee_elasticsearchTemplate() {boolean result = elasticsearchTemplate.deleteIndex(People.class);System.out.println(result);}

在这里插入图片描述

3.RestHighLevelClient

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Document(indexName = "lass_test_student",type = AudienceEsConst.DOC, createIndex = false, useServerConfiguration = true)
public class Student {@Idprivate String id;// 整个name不被分词,切不创建索引// Keyword表示不被分词@Field(type= FieldType.Keyword,index = false)private String name;// address被ik分词// Text类型的属性才能被分词@Field(type = FieldType.Text)private String address;@Field(type = FieldType.Long,index = false)private int age;}
 @Autowiredprivate RestHighLevelClient restHighLevelClient;@Testpublic void createIndex_restHighLevelClient() throws IOException {String indexName = "lass_test_resthighlevelclient";XContentBuilder builder = XContentFactory.jsonBuilder();builder.startObject();{builder.field("user", "zhangSan");builder.timeField("postDate", new Date());builder.field("message", "laas 升级 RestHighLevelClient ");}builder.endObject();IndexRequest request = new IndexRequest(indexName, "doc").source(builder);IndexResponse indexResponse = restHighLevelClient.index(request, RequestOptions.DEFAULT);if (indexResponse.status() == RestStatus.CREATED) {System.out.println("Document 1 indexed successfully.");} else {System.out.println("Failed to index Document 1.");}}@Testpublic void addDocuments_restHighLevelClient() {String indexName = "lass_test_resthighlevelclient";try {Map<String, Object> jsonMap = new HashMap<>();jsonMap.put("user", "李四");jsonMap.put("postDate", new Date());jsonMap.put("message", "laas 升级 RestHighLevelClient ");IndexRequest indexRequest = new IndexRequest(indexName,"doc").source(jsonMap);IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);if (indexResponse.status() == RestStatus.CREATED) {System.out.println("Document 1 indexed successfully.");} else {System.out.println("Failed to index Document 1.");}} catch (Exception e) {System.err.println("Error adding documents: " + e.getMessage());}}@Testpublic void deletee_restHighLevelClient() {String indexName = "lass_test_resthighlevelclient";boolean result = elasticsearchTemplate.deleteIndex(indexName);System.out.println(result);}

4.ElasticsearchRestTemplate

 @Autowiredprivate  ElasticsearchRestTemplate  restTemplate;@Testpublic void createIndex_restTemplate() {//根据实体类创建索引,boolean result1 = restTemplate.createIndex(Student.class);System.out.println(result1);//将索引放到软件里面boolean results = restTemplate.putMapping(Student.class);}@Testpublic void addDocuments_restTemplate() {Student student = new Student();student.setId("123");student.setName("张三");student.setAddress("北京市海淀区回龙观东大街");student.setAge(18);IndexQuery query = new IndexQuery();query.setObject(student);String result = restTemplate.index(query);System.out.println(result);}@Testpublic void bulk_restTemplate(){List<IndexQuery> list = new ArrayList<>();// IndexQuery多行写法IndexQuery indexQuery = new IndexQuery();indexQuery.setObject(new Student("1", "王五", "北京东城", 12));list.add(indexQuery);// IndexQuery 连缀写法list.add(new IndexQueryBuilder().withObject(new Student("2", "赵六", "北京西城", 13)).build());list.add(new IndexQueryBuilder().withObject(new Student("3", "吴七", "北京昌平", 14)).build());restTemplate.bulkIndex(list);}@Testpublic void deletee_restTemplate() {boolean result = restTemplate.deleteIndex(Student.class);System.out.println(result);}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/20703.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Wireshark Lua插件入门

摘要 开发中经常通过抓包分析协议&#xff0c;对于常见的协议如 DNS wireshark 支持自动解析&#xff0c;便于人类的理解&#xff0c;对于一些私有协议&#xff0c;wireshark 提供了插件的方式自定义解析逻辑。 1 动手 废话少说&#xff0c;直接上手。 第一步当然是装上wiresh…

人工智能学习笔记(2):认识和安装Stable Diffusion

人工智能学习笔记&#xff08;2&#xff09;&#xff1a;认识和安装Stable Diffusion 文章目录 人工智能学习笔记&#xff08;2&#xff09;&#xff1a;认识和安装Stable DiffusionStable Diffusion的起源和发展历程Stable Diffusion的应用场景基本原理文本到图像的转换过程潜…

KIBANA的安装教程(超详细)

前言 Kibana 是一个开源的基于浏览器的可视化工具&#xff0c;主要用于分析和展示存储在 Elasticsearch 索引中的数据。它允许用户通过各种图表、地图和其他可视化形式来探索和理解大量数据。Kibana 与 Elasticsearch 和 Logstash 紧密集成&#xff0c;共同构成了所谓的 ELK 堆…

【Linux】 深入讲解自动化构建工具

各位大佬好 &#xff0c;这里是阿川的博客&#xff0c;祝您变得更强 个人主页&#xff1a;在线OJ的阿川 大佬的支持和鼓励&#xff0c;将是我成长路上最大的动力 阿川水平有限&#xff0c;如有错误&#xff0c;欢迎大佬指正 Linux一系列的文章&#xff08;质量分均在93分 以…

【计算机毕设】基于SpringBoot的教师工作量管理系统设计与实现 - 源码免费(私信领取)

免费领取源码 &#xff5c; 项目完整可运行 &#xff5c; v&#xff1a;chengn7890 诚招源码校园代理&#xff01; 1. 研究目的 随着高校规模的扩大和教学任务的增加&#xff0c;教师的工作量管理变得越来越复杂和重要。传统的教师工作量管理方式效率低下&#xff0c;容易出错&…

【Unity知识点详解】Addressables的资源加载

今天来简单介绍一下Addressables&#xff0c;并介绍一下如何通过AssetName加载单个资源、如何通过Label加载多个资源、以及如何通过List<string>加载多个资源。由于Addressables的资源加载均为异步加载&#xff0c;所以今天给大家介绍如何使用StartCoroutine、如何使用As…

安装pytorch深度学习模型时要知道自己的电脑显卡是否支持CUDA

安装pytorch深度学习模型时要知道自己的电脑显卡是否支持CUDA&#xff0c;如何知道自己的显卡是否支持呢&#xff1f;可以去下面的网站&#xff0c;打开后就可以见到如下图所示&#xff1a; CUDA | 支持的GPU | GeForce (nvidia.cn)

[数据集][目标检测]脑溢血检测数据集VOC+YOLO格式767张2类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;767 标注数量(xml文件个数)&#xff1a;767 标注数量(txt文件个数)&#xff1a;767 标注类别…

【传知代码】基于知识引导提示的因果概念提取(论文复现)

前言&#xff1a;在当今信息爆炸的时代&#xff0c;我们被海量的数据所包围&#xff0c;然而&#xff0c;这些数据中的真正价值往往隐藏在深层的因果关系之中。无论是科学研究、商业决策&#xff0c;还是日常生活中的选择&#xff0c;理解并准确把握事物之间的因果关系&#xf…

Navicat Premium 16.01 下载、安装教程

Navicat Premium 16下载与安装教程 目录 Navicat Premium 16下载与安装教程前言安装步骤同意协议选择安装目录桌面快捷方式安装正在安装安装完成 步骤下载方式 前言 数据库管理用Navicat更加方便&#xff0c;可视化效果更好&#xff0c;今天给大家带来2022 Navicat Premium 16…

【thinkphp问题栏】tp5.1重写URL,取消路径上的index.php

在Apache运行thinkphp5.1时&#xff0c;发现系统默认生成的.htaccess不生效。 首先先查看怎么修改伪静态 1、修改Apache的配置文件 在Apache的安装目录下&#xff0c;打开config/httpd.conf。 搜索rewrite.so&#xff0c;将前面的#删掉&#xff0c;表示开启URL重写功能 2、…

Java | Leetcode Java题解之第120题三角形最小路径和

题目&#xff1a; 题解&#xff1a; class Solution {public int minimumTotal(List<List<Integer>> triangle) {int n triangle.size();int[] f new int[n];f[0] triangle.get(0).get(0);for (int i 1; i < n; i) {f[i] f[i - 1] triangle.get(i).get(i…

知名专业定制线缆知名智造品牌推荐-精工电联:解决水下机器人线缆行业痛点的领航者

在科技日新月异的今天&#xff0c;精工电联作为高科技智能化产品及自动化设备专用连接线束和连接器配套服务商&#xff0c;致力于为高科技行业提供高品质、高性能的集成线缆和连接器定制服务。我们不仅是高品质定制线缆供应商&#xff0c;更是水下机器人线缆行业痛点的有效解决…

win系统游戏提示找不到d3dx9_37.dll丢失的解决方法-最简单的解决方法

d3dx9_37.dll 是一个动态链接库文件&#xff0c;属于 Microsoft DirectX 9 的一部分。DirectX 9 是一个用于多媒体应用&#xff0c;特别是游戏和视频的 API&#xff0c;它提供了一套丰富的功能&#xff0c;用于处理图形、声音和输入设备等。d3dx9_37.dll 文件包含了 Direct3D 9…

【30天精通Prometheus:一站式监控实战指南】第12天:windows_exporter从入门到实战:安装、配置详解与生产环境搭建指南,超详细

亲爱的读者们&#x1f44b;   欢迎加入【30天精通Prometheus】专栏&#xff01;&#x1f4da; 在这里&#xff0c;我们将探索Prometheus的强大功能&#xff0c;并将其应用于实际监控中。这个专栏都将为你提供宝贵的实战经验。&#x1f680;   Prometheus是云原生和DevOps的…

容器化部署gitlab、jenkins,jenkins应用示例

一、容器化部署docker和docker conpose安装 Docker&Docker-compose的安装及部署_docker 20 使用什么版本docker-compose-CSDN博客 1.docker 安装脚本 cat >01_docker.sh<<EOF #!/bin/bash yum remove docker \docker-client \docker-client-latest \docker-co…

用开源模型MusicGen制作六一儿童节专属音乐

使用的是开源模型MusicGen&#xff0c;它可以根据文字描述或者已有旋律生成高质量的音乐(32kHz)&#xff0c;其原理是通过生成Encodec token然后再解码为音频&#xff0c;模型利用EnCodec神经音频编解码器来从原始波形中学习离散音频token。EnCodec将音频信号映射到一个或多个并…

携程梁建章:持续投资创新与AI,开启旅游行业未来增长

5月30至31日&#xff0c;携程集团在上海和张家界举办Envision 2024全球合作伙伴大会&#xff0c;邀请超50个国家和地区的1600余名外籍旅游业嘉宾与会&#xff0c;共同探讨中国跨境旅游市场发展机遇&#xff0c;讲好中国故事。 携程国际业务增速迅猛&#xff0c;创新与AI解锁未…

Unity 自定义房间布局系统 设计与实现一个灵活的房间放置系统 ——自定义房间区域功能

自定义房间区域功能 效果&#xff1a; 功能&#xff1a; 能够自定义房间的大小一键生成放置区域可控的放置网格点当物体放置到区域内可自动吸附物体是否可放置&#xff0c;放置时如果与其他物体交叉则不可放置&#xff08;纯算法计算&#xff09;管理房间内的物体&#xff0c…

云原生架构模式

本文主要介绍了云原生架构的主要设计模式&#xff0c;讨论了这些模式的优缺点及其适用场景&#xff0c;并探讨了在云计算环境中的应用和挑战。原文: Cloud-Native Architecture Patterns (Part 1)&#xff0c;Cloud-Native Architecture Patterns (Part 2) Bernard Hermant Uns…