從零開發短視頻電商 AWS OpenSearch Service開發環境申請以及Java客戶端介紹

文章目錄

    • 創建域
      • 1.創建域
      • 2.輸入配置
        • 部署選項
        • 數據節點
        • 網絡
        • 精細訪問控制
        • 訪問策略
    • 獲取域端點
    • 數據如何插入到OpenSearch Service
    • Java連接OpenSearch Service
      • spring-data-opensearch
      • elasticsearch-rest-high-level-client
      • opensearch-rest-client
      • opensearch-java

因為是開發測試使用,所以選的都是低配,單機,便宜的配置。

地址:https://aws.amazon.com/cn/opensearch-service/

價格:https://aws.amazon.com/cn/opensearch-service/pricing/

  • 實例小時數 +
  • 所需的存儲量 +
  • 傳入和傳出 Amazon OpenSearch Service 的數據

文檔:https://docs.aws.amazon.com/zh_cn/opensearch-service/

創建域

一般在15-30分鐘內創建一個OpenSearch集群,所以請尿完尿再來搞,別憋壞了。

1.創建域

2.輸入配置

  • 域名:后面用java等客戶端連接時會在URL中顯示。

  • 域創建方法:請選擇標準創建

    • 輕松創建:快速創建 OpenSearch 域以實現高可用性 含備用節點的多可用區,我們要自定義標準創建便宜點。可以理解為一個產線的標準套餐。
    • 標準創建:就是自選套餐。
  • 模板:選擇開發/測試

  • 部署選項:選擇不含備用節點的域,主打的就是便宜能用就行。
  • 可用區:選擇一個可用區。
  • 版本:請選擇最新版本。
部署選項

數據節點
  • 實例類型:默認是內存優化 - r6g.large.search,2C16G 價格為USD 0.167/H,下面列幾個便宜的。
    • t3.small.search 2C2G USD 0.036 ,自己用來個最便宜的,又不是不能用。
    • t3.medium.search 2C4G USD 0.073
  • 節點數:1個就行。
  • 存儲大小:40G就行。

忽略其他冷熱數據存儲專用主節點快照配置,以及自定義終端節點部分。

網絡
  • 網絡:選擇 Public access(公有訪問權限)
    • 開發測試環境,選擇公共訪問權限,生成用VPC訪問

精細訪問控制

啟用細粒度訪問控制復選框。選擇創建主用戶輸入用戶名和密碼,用戶名和密碼很關鍵,后面訪問dashboard和遠程客戶端連接都要。

忽略 SAML 身份驗證Amazon Cognito 身份驗證

訪問策略

選擇 Only use fine-grained access control(僅使用精細訪問控制)

忽略其余設置,然后選擇 Create(創建)。新域初始化過程通常需要 15-30 分鐘,但可能需要更長的時間,具體取決于配置。

獲取域端點

點擊創建后,通常需要 15-30 分鐘,然后從控制臺 -> 域 -> 一般信息 獲取域端點。

這里給了IPV6和IPV4的dashboard地址和域端點地址。

數據如何插入到OpenSearch Service

  • 對于大規模數據,我們建議使用 Amazon Kinesis Data Firehose,這是一項完全托管的服務,可以自動擴展以匹配您的數據吞吐量,并且不需要進行持續的管理。它還可以在加載數據前對其進行轉換、批處理和壓縮。
  • Amazon OpenSearch Service 支持與 Logstash 的集成。您可以將 Amazon OpenSearch Service 域配置為數據存儲,用于存儲所有來自 Logstash 的日志。
  • 可以使用索引 API 和批量 API 等原生 Elasticsearch(7.10 及更低版本)或 OpenSearch API 將數據加載到域中。

Java連接OpenSearch Service

當使用 Java 連接 OpenSearch 時,有幾個選擇,包括 Spring Data Elasticsearch/opensearch、原生 Elasticsearch 和 OpenSearch 客戶端。下面是每種方式的簡要介紹:

  • spring-data-xxx
  • 原生Elasticsearch
  • OpenSearch

建議基本的CRUD用 spring-data-xxx

復雜的查詢用低級client,如opensearch-java
RestClient lowLevelClient = highLevelClient.getLowLevelClient();
lowLevelClient . lowLevelClient.performRequest()

驗證分為用戶名和密碼進行身份驗證AWS訪問密鑰(Access Key和Secret Key)
我們當前選的精細控制用的是用戶名密碼驗證,后面生產建議改為IAM驗證。

spring-data-opensearch

  • Github:https://github.com/opensearch-project/spring-data-opensearch

  • 官方示例:https://github.com/opensearch-project/spring-data-opensearch/tree/main/spring-data-opensearch-examples

Spring Boot 3.x

1.添加依賴。

<dependency><groupId>org.opensearch.client</groupId><artifactId>spring-data-opensearch-starter</artifactId><version>1.3.0</version>
</dependency>

2.啟動類去除ElasticsearchDataAutoConfiguration自動配置。

@SpringBootApplication(exclude = {ElasticsearchDataAutoConfiguration.class})
public class OpenSearchDemoApplication {public static void main(String[] args) {SpringApplication.run(OpenSearchDemoApplication.class, args);}
}

3.application.yml增加配置

opensearch:uris: https://localhost:9200username: adminpassword: adminspring:jackson:serialization:INDENT_OUTPUT: true

4.新增model

import java.math.BigDecimal;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;@Document(indexName = "marketplace")
public class Product {@Idprivate String id;@Field(type = FieldType.Text, name = "name")private String name;@Field(type = FieldType.Double, name = "price")private BigDecimal price;@Field(type = FieldType.Integer, name = "quantity")private Integer quantity;@Field(type = FieldType.Text, name = "description")private String description;@Field(type = FieldType.Keyword, name = "vendor")private String vendor;

5.新增Repository

import java.math.BigDecimal;
import java.util.List;
import org.opensearch.data.example.model.Product;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;@Repository
public interface MarketplaceRepository extends ElasticsearchRepository<Product, String> {List<Product> findByNameLikeAndPriceGreaterThan(String name, BigDecimal price);
}

6.新增service

@Service
public class  MarketplaceService {private final MarketplaceRepository repository;public MyService(MarketplaceRepository repository) {this.repository = repository;}public void doWork() {repository.deleteAll();Product product = new Product();product.setName("xxx");product.setxxx("xxx");repository.save(product);List<Product> results = repository.findByNameLikeAndPriceGreaterThan("Gierke",xx);}
}

我們還可以通過RestHighLevelClient獲得lowLevelRest()客戶端。

  @AutowiredRestHighLevelClient highLevelClient;RestClient lowLevelClient = highLevelClient.getLowLevelClient();IndexRequest request = new IndexRequest("spring-data").id(randomID()).source(singletonMap("feature", "high-level-rest-client")).setRefreshPolicy(IMMEDIATE);
IndexResponse response = highLevelClient.index(request,RequestOptions.DEFAULT);// 構建請求Request request = new Request("GET", "/your-index-name/_search");// 添加請求參數,如果需要的話request.addParameter("q", "field:value");// 執行請求Response response = lowLevelClient.performRequest(request);// 處理響應int statusCode = response.getStatusLine().getStatusCode();String responseBody = EntityUtils.toString(response.getEntity());System.out.println("Status Code: " + statusCode);System.out.println("Response Body: " + responseBody);

elasticsearch-rest-high-level-client

1.添加依賴

<dependencies><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.10.2</version> <!-- 替換為你使用的OpenSearch版本 --></dependency>
</dependencies>

2.示例代碼

import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;import java.io.IOException;
import java.util.HashMap;
import java.util.Map;public class OpenSearchExample {public static void main(String[] args) {// OpenSearch連接配置String hostname = "your_opensearch_host"; // 替換為你的OpenSearch服務器主機名或IP地址int port = 9200; // 替換為你的OpenSearch服務器端口String scheme = "https"; // 如果使用HTTPS,否則使用"http"String username = "laker";String password = "lakerpwd";try (RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(hostname).setPort(port).setScheme(scheme).setHttpClientConfigCallback(httpClientBuilder ->httpClientBuilder.setDefaultCredentialsProvider(() ->new org.apache.http.auth.UsernamePasswordCredentials(username, password))))) {// 上傳數據Map<String, Object> jsonMap = new HashMap<>();jsonMap.put("field1", "value1");jsonMap.put("field2", "value2");IndexRequest indexRequest = new IndexRequest("your_index").id("your_document_id") // 替換為文檔的ID.source(jsonMap, XContentType.JSON);IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);System.out.println("Index created with ID: " + indexResponse.getId());// 查詢數據SearchRequest searchRequest = new SearchRequest("your_index");SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();searchSourceBuilder.query(QueryBuilders.matchAllQuery());searchRequest.source(searchSourceBuilder);SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);// 處理查詢結果System.out.println("Search hits: " + searchResponse.getHits().getTotalHits());} catch (IOException e) {e.printStackTrace();}}
}

opensearch-rest-client

  • 文檔:https://opensearch.org/docs/latest/clients/java-rest-high-level/

1.添加依賴

        <dependency><groupId>org.opensearch.client</groupId><artifactId>opensearch-rest-high-level-client</artifactId><version>2.11.1</version></dependency>

2.示例代碼

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.opensearch.action.admin.indices.delete.DeleteIndexRequest;
import org.opensearch.action.delete.DeleteRequest;
import org.opensearch.action.delete.DeleteResponse;
import org.opensearch.action.get.GetRequest;
import org.opensearch.action.get.GetResponse;
import org.opensearch.action.index.IndexRequest;
import org.opensearch.action.index.IndexResponse;
import org.opensearch.action.support.master.AcknowledgedResponse;
import org.opensearch.client.RequestOptions;
import org.opensearch.client.RestClient;
import org.opensearch.client.RestClientBuilder;
import org.opensearch.client.RestHighLevelClient;
import org.opensearch.client.indices.CreateIndexRequest;
import org.opensearch.client.indices.CreateIndexResponse;
import org.opensearch.common.settings.Settings;import java.io.IOException;
import java.util.HashMap;public class RESTClientSample {public static void main(String[] args) throws IOException {final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();credentialsProvider.setCredentials(AuthScope.ANY,new UsernamePasswordCredentials("lakertest", "xxxx"));//Create a client.RestClientBuilder builder = RestClient.builder(new HttpHost("search-laker-search-xxxx.us-east-2.es.amazonaws.com", 443, "https")).setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));RestHighLevelClient client = new RestHighLevelClient(builder);//Create a non-default index with custom settings and mappings.CreateIndexRequest createIndexRequest = new CreateIndexRequest("custom-index");createIndexRequest.settings(Settings.builder() //Specify in the settings how many shards you want in the index..put("index.number_of_shards", 4).put("index.number_of_replicas", 3));//Create a set of maps for the index's mappings.HashMap<String, String> typeMapping = new HashMap<String,String>();typeMapping.put("type", "integer");HashMap<String, Object> ageMapping = new HashMap<String, Object>();ageMapping.put("age", typeMapping);HashMap<String, Object> mapping = new HashMap<String, Object>();mapping.put("properties", ageMapping);createIndexRequest.mapping(mapping);CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);//Adding data to the index.IndexRequest request = new IndexRequest("custom-index"); //Add a document to the custom-index we created.request.id("1"); //Assign an ID to the document.HashMap<String, String> stringMapping = new HashMap<String, String>();stringMapping.put("message:", "Testing Java REST client");request.source(stringMapping); //Place your content into the index's source.IndexResponse indexResponse = client.index(request, RequestOptions.DEFAULT);// 查詢GetRequest getRequest = new GetRequest("custom-index", "1");GetResponse response = client.get(getRequest, RequestOptions.DEFAULT);System.out.println(response.getSourceAsString());// 刪除文檔DeleteRequest deleteDocumentRequest = new DeleteRequest("custom-index", "1"); //Index name followed by the ID.DeleteResponse deleteResponse = client.delete(deleteDocumentRequest, RequestOptions.DEFAULT);// 刪除索引DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest("custom-index"); //Index name.AcknowledgedResponse deleteIndexResponse = client.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);client.close();}
}

opensearch-java

  • 文檔:https://opensearch.org/docs/latest/clients/java/
  • 示例代碼:https://github.com/opensearch-project/opensearch-java/tree/main/samples
    • 里面很詳細,包含knn部分。
<dependency><groupId>org.opensearch.client</groupId><artifactId>opensearch-java</artifactId><version>2.8.1</version>
</dependency>
@Data
public class IndexData {private String title;private String text;public IndexData() {}public IndexData(String title, String text) {this.title = title;this.text = text;}
}
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.opensearch.client.RestClient;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch._types.mapping.IntegerNumberProperty;
import org.opensearch.client.opensearch._types.mapping.Property;
import org.opensearch.client.opensearch._types.mapping.TypeMapping;
import org.opensearch.client.opensearch.core.IndexRequest;
import org.opensearch.client.opensearch.core.SearchResponse;
import org.opensearch.client.opensearch.indices.CreateIndexRequest;
import org.opensearch.client.opensearch.indices.DeleteIndexRequest;
import org.opensearch.client.opensearch.indices.IndexSettings;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.rest_client.RestClientTransport;import java.io.IOException;public class OpenSearchClientExample {public static void main(String[] args) throws IOException {final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();credentialsProvider.setCredentials(AuthScope.ANY,new UsernamePasswordCredentials("admin", "admin"));// 私有 opensearchRestClient restClient = RestClient.builder(new HttpHost("localhost", 9200, "https")).setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)).build();OpenSearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());OpenSearchClient client = new OpenSearchClient(transport);//Create the indexString indexName = "sample-index";//Add some settings to the indexIndexSettings settings = new IndexSettings.Builder().numberOfShards("2").numberOfReplicas("1").build();TypeMapping mapping = new TypeMapping.Builder().properties("age",new Property.Builder().integer(new IntegerNumberProperty.Builder().build()).build()).build();CreateIndexRequest createIndexRequest = new CreateIndexRequest.Builder().index(indexName).settings(settings).mappings(mapping).build();client.indices().create(createIndexRequest);//Index some dataIndexData indexData = new IndexData("Document 1", "Text for document 1");IndexRequest<IndexData> indexRequest = new IndexRequest.Builder<IndexData>().index(indexName).id("1").document(indexData).build();client.index(indexRequest);//Search for the documentSearchResponse<IndexData> searchResponse = client.search(s -> s.index(indexName), IndexData.class);for (int i = 0; i < searchResponse.hits().hits().size(); i++) {System.out.println(searchResponse.hits().hits().get(i).source());}//Delete the documentclient.delete(b -> b.index(indexName).id("1"));// Delete the indexDeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest.Builder().index(indexName).build();client.indices().delete(deleteIndexRequest);try {if (restClient != null) {restClient.close();}} catch (IOException e) {System.out.println(e.toString());}}
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/214189.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/214189.shtml
英文地址,請注明出處:http://en.pswp.cn/news/214189.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

[Linux] nginx的location和rewrite

一、Nginx常用的正則表達式 符號作用^匹配輸入字符串的起始位置$ 匹配輸入字符串的結束位置*匹配前面的字符零次或多次。如“ol*”能匹配“o”及“ol”、“oll” 匹配前面的字符一次或多次。如“ol”能匹配“ol”及“oll”、“olll”&#xff0c;但不能匹配“o”?匹配前面的字…

Vue3 setup 頁面跳轉監聽路由變化調整頁面訪問位置

頁面跳轉后頁面還是停留在上一個頁面的位置&#xff0c;沒有回到頂部 解決 1、router中路由守衛中統一添加 router.beforeEach(async (to, from, next) > {window.scrollTo(0, 0);next(); }); 2、頁面中監聽頁面變化 <script setup> import { ref, onMounted, wat…

@Autowired 找不到Bean的問題

排查思路 檢查包掃描&#xff1a;查詢的Bean是否被spring掃描裝配到檢查該Bean上是否配上注解&#xff08;Service/Component/Repository…&#xff09;如果使用第三方&#xff0c;檢查相關依賴是否已經安裝到當前項目 Autowired和Resource的區別 Autowired 是spring提供的注…

圖像清晰度 和像素、分辨率、鏡頭的關系

關于圖像清晰度的幾個知識點分享。 知識點 清晰度 清晰度指影像上各細部影紋及其邊界的清晰程度。清晰度&#xff0c;一般是從錄像機角度出發&#xff0c;通過看重放圖像的清晰程度來比較圖像質量&#xff0c;所以常用清晰度一詞。 而攝像機一般使用分解力一詞來衡量它“分解被…

linux通過命令切換用戶

在Linux中&#xff0c;你可以使用su&#xff08;substitute user或switch user&#xff09;命令來切換用戶。這個命令允許你臨時或永久地以另一個用戶的身份運行命令。以下是基本的用法&#xff1a; 基本切換到另一個用戶&#xff08;需要密碼&#xff09;&#xff1a;su [用戶…

APIFox:打造高效便捷的API管理工具

隨著互聯網技術的不斷發展&#xff0c;API&#xff08;應用程序接口&#xff09;已經成為了企業間數據交互的重要方式。然而&#xff0c;API的管理和維護卻成為了開發者們面臨的一大挑戰。為了解決這一問題&#xff0c;APIFox應運而生&#xff0c;它是一款專為API管理而生的工具…

【力扣100】189.輪轉數組

添加鏈接描述 class Solution:def rotate(self, nums: List[int], k: int) -> None:"""Do not return anything, modify nums in-place instead."""# 思路&#xff1a;三次數組翻轉nlen(nums)kk%nnums[:] nums[-k:] nums[:-k]思路就是&…

數據科學實踐:探索數據驅動的決策

寫在前面 你是否曾經困擾于如何從海量的數據中提取有價值的信息?你是否想過如何利用數據來指導你的決策,讓你的決策更加科學和精確?如果你有這樣的困擾和疑問,那么你來對了地方。這篇文章將引導你走進數據科學的世界,探索數據驅動的決策。 1.數據科學的基本原則 在我們…

第四屆傳智杯初賽(蓮子的機械動力學)

題目描述 題目背景的問題可以轉化為如下描述&#xff1a; 給定兩個長度分別為 n,m 的整數 a,b&#xff0c;計算它們的和。 但是要注意的是&#xff0c;這里的 a,b 采用了某種特殊的進制表示法。最終的結果也會采用該種表示法。具體而言&#xff0c;從低位往高位數起&#xf…

【linux】yum安裝時: Couldn‘t resolve host name for XXXXX

yum 安裝 sysstat 報錯了&#xff1a; Kylin Linux Advanced Server 10 - Os 0.0 B/s | 0 B 00:00 Errors during downloading metadata for repository ks10-adv-os:- Curl error (6): Couldnt resolve host nam…

在非Spring環境下Main方法中,怎么使用spring的ThreadPoolTaskScheduler啟動Scheduler?

作為Java開發人員&#xff0c;在使用spring框架的時候&#xff0c;如果想要獲取到線程池對象&#xff0c;可以直接使用spring框架提供的ThreadPoolxxx來獲取。那么在非spring環境下&#xff0c;main函數怎么使用ThreadPoolTaskScheduler呢&#xff1f;下面凱哥(凱哥Java:kaigej…

10.vue3項目(十):spu管理頁面的sku的新增和修改

目錄 一、sku靜態頁面的搭建 1.思路分析 2.代碼實現 3.效果展示

微信小程序 長按錄音+錄制視頻

<view class"bigCircle" bindtouchstart"start" bindtouchend"stop"><view class"smallCircle {{startVedio?onVedio:}}"><text>{{startVedio?正在錄音:長按錄音}}</text></view> </view> <…

排序算法:【選擇排序]

一、選擇排序——時間復雜度 定義&#xff1a;第一趟排序&#xff0c;從整個序列中找到最小的數&#xff0c;把它放到序列的第一個位置上&#xff0c;第二趟排序&#xff0c;再從無序區找到最小的數&#xff0c;把它放到序列的第二個位置上&#xff0c;以此類推。 也就是說&am…

軟件項目管理---胡亂復習版

范圍控制的一個重點是避免需求的不合理擴張。(√)一個任務原計劃2個人全職工作2周完成,而實際上只有一個人參與這個任務,到第二周末這個人完成了任務的75%,那么:BCWS = 4人周,ACWP = 2人周,BCWP = 3人周。CV = 1,SV = -1。 【在項目管理中,BCWS、ACWP和BCWP是用來衡量…

微服務測試是什么?

微服務測試是一種特殊的測試類型&#xff0c;因為它涉及到多個獨立的服務。以下是進行微服務測試的一般性步驟&#xff1a; 1. 確定系統架構 了解微服務架構對成功測試至關重要。確定每個微服務的職責、接口、依賴項和通信方式。了解這些信息可以幫助您更好地規劃測試用例和測…

ip ssl證書怎么更換ip地址

ip ssl證書是一種數字證書&#xff0c;為只有公網ip地址的站點建立安全、加密的通信通道。它通常由權威的證書頒發機構&#xff08;CA&#xff09;頒發&#xff0c;并用于驗證網站的身份和安全性。ip ssl證書的主要目的是保護敏感信息&#xff0c;如信用卡號、用戶名和密碼等&a…

IO部分筆記

IO 概述 IO: 存儲和讀取數據的解決方案 作用: 用于讀寫文件中的數據(可以讀寫文件, 或網絡中的數據) IO流的分類 按流的方向: 輸入流, 輸出流 按操作文件類型: 字節流: 可以操作所有類型的文件 字符流: 只能操作純文本文件 純文本文件: windows自帶的記事本打開能讀懂…

react Hooks(useRef、useMemo、useCallback)實現原理

Fiber 上篇文章fiber簡單理解記錄了react fiber架構&#xff0c;Hooks是基于fiber鏈表來實現的。閱讀以下內容時建議先了解react fiber。 jsx -> render function -> vdom -> fiber樹 -> dom vdom 轉 fiber 的過程稱為 recocile。diff算法就是在recocile這個過程…

認識lambda架構(架構師考試復習)

Lambda架構主要分為三層&#xff0c;批處理層、加速層和服務層。 如下圖所示&#xff1a; &#xff08;1&#xff09;批處理層&#xff08;Batch Layer&#xff09;&#xff1a;存儲數據集&#xff0c;在數據集上預先計算查詢函數&#xff0c;并構建查詢對應的view。Batch Lay…