【Sharding-JDBC】?Spring/Spring Boot 集成 Sharding-JDBC,分表策略與 API、YAML 配置實踐?

在這里插入圖片描述

文章目錄

  • 環境準備
  • Spring框架
    • Sharding-JDBC 4.x版本api實現
    • Sharding-JDBC 5.4.x版本yaml實現
  • Springboot框架
    • Sharding-JDBC 5.4.x版本yaml實現
  • 分庫、加密、讀寫分離基于yaml的配置示例

更多相關內容可查看

需求:按月分區,按年分表,找不到對應年份表走備份表,動態從linux獲取賬戶密碼用于創建數據庫鏈接

備份表:table
已經提前建表語句創建好未來年份的表:table_2026,table_2027

環境準備

maven
此依賴會引入很多有漏洞的包,如果有漏洞掃描的情況下,請替換相關包的其他版本或加白名單

 <dependency><groupId>org.apache.shardingsphere</groupId><artifactId>shardingsphere-jdbc-core</artifactId><version>${sharding-jdbc.version}</version></dependency>

Spring框架

Sharding-JDBC 4.x版本api實現

注意:4.x版本,在用api實現,如果想要非分片表走相同的數據源的情況下
需要用setDefaultdatasource賦默認數據源,在5.x版本已經移除了該方法,所以僅支持低版本實現,如果不加的話shading會無法路由其他表,會報表不存在的情況

datasource

    @Bean(name = "dataSource")public DataSource shardingDataSource() throws SQLException, HKEException {DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource();// 1. 配置數據源Map<String, DataSource> dataSourceMap = new HashMap<>();dataSourceMap.put("ds", dataSource());// 2. 配置分片規則ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();//        shardingRuleConfig.setDefaultDatabaseShardingStrategy(new NoneShardingStrategyConfiguration());// 配置table表的分片規則ShardingTableRuleConfiguration signInfoRule = new ShardingTableRuleConfiguration("table","ds.table_2025"  // 包含備份表和未來幾年的表);signInfoRule.setTableShardingStrategy(new StandardShardingStrategyConfiguration("operate_time",  // 分片字段"year-sharding-algorithm"  // 自定義分片算法));
//        signInfoRule.setKeyGenerateStrategy(
//                new KeyGenerateStrategyConfiguration("row_id", "snowflake")
//        );// 添加其他表的規則(tablexxx)// 添加表規則到分片配置shardingRuleConfig.getTables().add(signInfoRule);// 3. 配置分片算法shardingRuleConfig.getShardingAlgorithms().put("year-sharding-algorithm",new AlgorithmConfiguration("CLASS_BASED", new Properties() {{setProperty("strategy", "STANDARD");setProperty("algorithmClassName", "com.package.YearShardingAlgorithm");}}));// 4. 配置主鍵生成器shardingRuleConfig.getKeyGenerators().put("snowflake",new AlgorithmConfiguration("SNOWFLAKE", new Properties()));// 5. 創建ShardingSphere數據源Properties props = new Properties();props.setProperty("sql-show", "true");  // 顯示SQL日志return ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,Collections.singleton(shardingRuleConfig),props);}

分表算法實現

注意:implements 哪個類取決于你需要用那個對應的算法,有stand,complex等

package cfca.hke.privatization.sharding;import cfca.hke.privatization.common.logging.LoggerManager;
import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;public class YearShardingAlgorithm implements StandardShardingAlgorithm<LocalDateTime> {@Overridepublic String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<LocalDateTime> shardingValue) {// 獲取邏輯表名String logicTableName = shardingValue.getLogicTableName();Object value = shardingValue.getValue();String year = value.toString();//年份格式會有多種 所以直接截取這里if (year.length() > 4) {year = year.substring(0, 4);}//25年的存到備份表logicTableNameif (!"2025".equals(year)){logicTableName = logicTableName + "_" + year;}// 檢查表是否存在if (availableTargetNames.contains(logicTableName)) {return logicTableName;} else {LoggerManager.exceptionLogger.error("The table does not exist,please check HKEPrivateConfig/sharding.yaml, tableName: {}", logicTableName);return logicTableName;}}@Overridepublic Collection<String> doSharding(Collection<String> collection, RangeShardingValue<LocalDateTime> rangeShardingValue) {return Collections.emptyList();}
}

Sharding-JDBC 5.4.x版本yaml實現

此版本有漏洞,當你配置不分表的表時候,配置的表明會區分大小寫,此漏洞在5.4.1版本已經兼容了,所以可以盡量用最新版

注意:ds.*不會影響你加分片規則的表,優先級是如果有分片規則則認為是需分片的表,這里配單表不配ds.*的時候,必須升級到5.4.1版本,或未來出現新版之后,盡量使用高版本

mode:
#設置為??單機模式??。此模式下,配置信息存儲在本地,適用于開發測試或小型應用,無需額外的協調服務(如 ZooKeeper)type: Standalonerepository:#指定使用內嵌的 JDBC 數據庫來存儲 ShardingSphere 的元數據(如邏輯庫、表結構等)type: JDBC
# 數據庫標識 隨便寫
databaseName: zhongxin
# 數據庫配置,連接池配置
dataSources:ds:dataSourceClassName: com.zaxxer.hikari.HikariDataSourcedriverClassName: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://192.168.xx.xx:3306/zhongxin_new?rewriteBatchedStatements=true&allowMultiQueries=true&useLocalSessionState=true&useUnicode=true&characterEncoding=utf-8&socketTimeout=3000000&connectTimeout=60000username: rootpassword:connectionTimeout: 50000minimumIdle: 5maximumPoolSize: 10idleTimeout: 600000maxLifetime: 1800000connectionTestQuery: SELECT 1
# 5.x版本的配法
rules:
#分片規則標簽
- !SHARDING
#需要進行分片的??邏輯表??及其規則tables:table:#分片的表名actualDataNodes: ds.table,ds.table_$->{2026..2028}tableStrategy:standard:#分片字段shardingColumn: operate_time#分片算法shardingAlgorithmName: infoAlgorithmtable1:actualDataNodes: ds.table1,ds.table1_$->{2026..2028}tableStrategy:standard:shardingColumn: operate_timeshardingAlgorithmName: infoAlgorithmtable2:actualDataNodes: ds.table2,ds.table2_$->{2026..2028}tableStrategy:standard:shardingColumn: operate_timeshardingAlgorithmName: infoAlgorithmshardingAlgorithms:infoAlgorithm:#分片算法類型為??基于自定義類type: CLASS_BASEDprops:#指定自定義算法實現的??策略類型??為 STANDARD(標準)strategy: STANDARD#自定義分片算法的完整類名algorithmClassName: com.package.YearShardingAlgorithmkeyGenerators:snowflake:type: SNOWFLAKE
# 不分區的表
- !SINGLEtables:- ds.*props:
#??是否在日志中打印 SQL??sql-show: true

動態修改賬號密碼
注意:這里要用sharding提供的解析yaml的方法去解析,如果你是低版本可以自己去寫流讀取,高版本在讀取sharding特殊的配置會報錯,在解析完后也要用sharding提供的方法轉回string或者bytes

    @Bean(name = "dataSource")public DataSource shardingDataSource() throws Exception {//獲取用戶名密碼String username = credentials[0];String password = credentials[1];File yamlFile = new File("./xxx/sharding.yaml");YamlJDBCConfiguration rootConfig = YamlEngine.unmarshal(yamlFile, YamlJDBCConfiguration.class);Map<String, Object> dsMap = rootConfig.getDataSources().get("ds");dsMap.put("username",username);dsMap.put("password",password);String marshal = YamlEngine.marshal(rootConfig);DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(marshal.getBytes());printDBInfo(username,password);return dataSource;}

分表算法實現

注意:implements 哪個類取決于你需要用那個對應的算法,有stand,complex等

package cfca.hke.privatization.sharding;import cfca.hke.privatization.common.logging.LoggerManager;
import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;public class YearShardingAlgorithm implements StandardShardingAlgorithm<LocalDateTime> {@Overridepublic String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<LocalDateTime> shardingValue) {// 獲取邏輯表名String logicTableName = shardingValue.getLogicTableName();Object value = shardingValue.getValue();String year = value.toString();//年份格式會有多種 所以直接截取這里if (year.length() > 4) {year = year.substring(0, 4);}//25年的存到備份表logicTableNameif (!"2025".equals(year)){logicTableName = logicTableName + "_" + year;}// 檢查表是否存在if (availableTargetNames.contains(logicTableName)) {return logicTableName;} else {LoggerManager.exceptionLogger.error("The table does not exist,please check HKEPrivateConfig/sharding.yaml, tableName: {}", logicTableName);return logicTableName;}}@Overridepublic Collection<String> doSharding(Collection<String> collection, RangeShardingValue<LocalDateTime> rangeShardingValue) {return Collections.emptyList();}
}

Springboot框架

Sharding-JDBC 5.4.x版本yaml實現

在springboot的application.yml文件里面,直接加入分片的配置即可,springboot會自動解析該yaml文件不需要手動讀取

mode:type: Standalonerepository:type: JDBC
# 數據庫標識 隨便寫
databaseName: zhongxin
# 數據庫配置,連接池配置
dataSources:ds:dataSourceClassName: com.zaxxer.hikari.HikariDataSourcedriverClassName: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://192.168.xx.xx:3306/zhongxin_new?rewriteBatchedStatements=true&allowMultiQueries=true&useLocalSessionState=true&useUnicode=true&characterEncoding=utf-8&socketTimeout=3000000&connectTimeout=60000username: rootpassword:connectionTimeout: 50000minimumIdle: 5maximumPoolSize: 10idleTimeout: 600000maxLifetime: 1800000connectionTestQuery: SELECT 1
# 5.x版本的配法
rules:
- !SHARDINGtables:table:actualDataNodes: ds.table,ds.table_$->{2026..2028}tableStrategy:standard:shardingColumn: operate_timeshardingAlgorithmName: infoAlgorithmtable1:actualDataNodes: ds.table1,ds.table1_$->{2026..2028}tableStrategy:standard:shardingColumn: operate_timeshardingAlgorithmName: infoAlgorithmtable2:actualDataNodes: ds.table2,ds.table2_$->{2026..2028}tableStrategy:standard:shardingColumn: operate_timeshardingAlgorithmName: infoAlgorithmshardingAlgorithms:infoAlgorithm:type: CLASS_BASEDprops:strategy: STANDARDalgorithmClassName: com.package.YearShardingAlgorithmkeyGenerators:snowflake:type: SNOWFLAKE
# 不分區的表
- !SINGLEtables:- ds.*props:sql-show: true

分庫、加密、讀寫分離基于yaml的配置示例

mode:type: Standalonerepository:type: JDBC
databaseName: demo_db
dataSources:ds_basic:dataSourceClassName: com.alibaba.druid.pool.DruidDataSourcedriverClassName: com.mysql.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/demo_basic?characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=falseusername: rootpassword: Ph9ep971fm14nYaZsLl9LY+MCqX9uJSozYRNgP2VVSj/hbmokn5OC6kpiAA1I0okA9GiDHEo7qHUvRQYYUNZvQ==initialSize: 1minIdle: 1maxActive: 64maxWait: 20000validationQuery: SELECT 1 FROM DUALvalidationQueryTimeout: 30000minEvictableIdleTimeMillis: 300000maxEvictableIdleTimeMillis: 600000timeBetweenEvictionRunsMillis: 300000testOnBorrow: truetestWhileIdle: truefilters: config, stat, wallconnectProperties:connectTimeout: 5000socketTimeout: '20000'config.decrypt: 'true'config.decrypt.key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZRYgsnvVKPqZTfMOWmmj6OuupFRSk7+Vtqv70cG3y6T3bm+DcQU3zOC993ozbHpmqeODtuLzURhIuXDMyTKW8CAwEAAQ==ds0000:dataSourceClassName: com.alibaba.druid.pool.DruidDataSourcedriverClassName: com.mysql.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/demo_0000?characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=falseusername: rootpassword: Ph9ep971fm14nYaZsLl9LY+MCqX9uJSozYRNgP2VVSj/hbmokn5OC6kpiAA1I0okA9GiDHEo7qHUvRQYYUNZvQ==initialSize: 1minIdle: 1maxActive: 64maxWait: 20000validationQuery: SELECT 1 FROM DUALvalidationQueryTimeout: 30000minEvictableIdleTimeMillis: 300000maxEvictableIdleTimeMillis: 600000timeBetweenEvictionRunsMillis: 300000testOnBorrow: truetestWhileIdle: truefilters: config, stat, wallconnectProperties:connectTimeout: 5000socketTimeout: '20000'config.decrypt: 'true'config.decrypt.key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZRYgsnvVKPqZTfMOWmmj6OuupFRSk7+Vtqv70cG3y6T3bm+DcQU3zOC993ozbHpmqeODtuLzURhIuXDMyTKW8CAwEAAQ==ds0001:dataSourceClassName: com.alibaba.druid.pool.DruidDataSourcedriverClassName: com.mysql.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/demo_0001?characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=falseusername: rootpassword: Ph9ep971fm14nYaZsLl9LY+MCqX9uJSozYRNgP2VVSj/hbmokn5OC6kpiAA1I0okA9GiDHEo7qHUvRQYYUNZvQ==initialSize: 1minIdle: 1maxActive: 64maxWait: 20000validationQuery: SELECT 1 FROM DUALvalidationQueryTimeout: 30000minEvictableIdleTimeMillis: 300000maxEvictableIdleTimeMillis: 600000timeBetweenEvictionRunsMillis: 300000testOnBorrow: truetestWhileIdle: truefilters: config, stat, wallconnectProperties:connectTimeout: 5000socketTimeout: '20000'config.decrypt: 'true'config.decrypt.key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZRYgsnvVKPqZTfMOWmmj6OuupFRSk7+Vtqv70cG3y6T3bm+DcQU3zOC993ozbHpmqeODtuLzURhIuXDMyTKW8CAwEAAQ==ds0000_slave:dataSourceClassName: com.alibaba.druid.pool.DruidDataSourcedriverClassName: com.mysql.jdbc.Driverurl: jdbc:mysql://192.168.1.88:3306/demo_0000?characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=falseusername: rootpassword: Ph9ep971fm14nYaZsLl9LY+MCqX9uJSozYRNgP2VVSj/hbmokn5OC6kpiAA1I0okA9GiDHEo7qHUvRQYYUNZvQ==initialSize: 1minIdle: 1maxActive: 64maxWait: 20000validationQuery: SELECT 1 FROM DUALvalidationQueryTimeout: 30000minEvictableIdleTimeMillis: 300000maxEvictableIdleTimeMillis: 600000timeBetweenEvictionRunsMillis: 300000testOnBorrow: truetestWhileIdle: truefilters: config, stat, wallconnectProperties:connectTimeout: 5000socketTimeout: '20000'config.decrypt: 'true'config.decrypt.key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZRYgsnvVKPqZTfMOWmmj6OuupFRSk7+Vtqv70cG3y6T3bm+DcQU3zOC993ozbHpmqeODtuLzURhIuXDMyTKW8CAwEAAQ==ds0001_slave:dataSourceClassName: com.alibaba.druid.pool.DruidDataSourcedriverClassName: com.mysql.jdbc.Driverurl: jdbc:mysql://192.168.1.88:3306/demo_0001?characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=falseusername: rootpassword: Ph9ep971fm14nYaZsLl9LY+MCqX9uJSozYRNgP2VVSj/hbmokn5OC6kpiAA1I0okA9GiDHEo7qHUvRQYYUNZvQ==initialSize: 1minIdle: 1maxActive: 64maxWait: 20000validationQuery: SELECT 1 FROM DUALvalidationQueryTimeout: 30000minEvictableIdleTimeMillis: 300000maxEvictableIdleTimeMillis: 600000timeBetweenEvictionRunsMillis: 300000testOnBorrow: truetestWhileIdle: truefilters: config, stat, wallconnectProperties:connectTimeout: 5000socketTimeout: '20000'config.decrypt: 'true'config.decrypt.key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALZRYgsnvVKPqZTfMOWmmj6OuupFRSk7+Vtqv70cG3y6T3bm+DcQU3zOC993ozbHpmqeODtuLzURhIuXDMyTKW8CAwEAAQ==rules:
# 數據分片
- !SHARDINGtables:t_claim_case_mdtrt:actualDataNodes: ds$->{['0000','0001']}.t_claim_case_mdtrt_000$->{0..9}tableStrategy:standard:shardingColumn: transaction_noshardingAlgorithmName: t_claim_case_mdtrt_inlinekeyGenerateStrategy:column: idkeyGeneratorName: snowflaket_claim_case_info:actualDataNodes: ds$->{['0000','0001']}.t_claim_case_info_000$->{0..9}tableStrategy:standard:shardingColumn: transaction_noshardingAlgorithmName: t_claim_case_info_inlinekeyGenerateStrategy:column: idkeyGeneratorName: snowflakedefaultShardingColumn: transaction_nobindingTables:- t_claim_case_mdtrt, t_claim_case_infodefaultDatabaseStrategy:standard:shardingColumn: transaction_noshardingAlgorithmName: database_inlinedefaultTableStrategy:none:shardingAlgorithms:database_inline:type: INLINEprops:algorithm-expression: ds$->{transaction_no[-8..-5]}t_claim_case_mdtrt_inline:type: INLINEprops:algorithm-expression: t_claim_case_mdtrt_$->{transaction_no[-4..-1]}t_claim_case_info_inline:type: INLINEprops:algorithm-expression: t_claim_case_info_$->{transaction_no[-4..-1]}keyGenerators:snowflake:type: SNOWFLAKE#數據加密
- !ENCRYPTtables:t_claim_case_info:columns:appl_mobile:cipher:name: appl_mobileencryptorName: sm4_encryptoropsnId_no:cipher:name: opsnId_noencryptorName: sm4_encryptorrpter_id_no:cipher:name: rpter_id_noencryptorName: sm4_encryptorrpter_mobile:cipher:name: rpter_mobileencryptorName: sm4_encryptorencryptors:sm4_encryptor:type: SM4props:sm4-key: 86C63180C2806ED1F43A859DE501215Csm4-mode: ECBsm4-padding: PKCS5Padding
# 單表
- !SINGLEtables:- ds_basic.*# 讀寫分離
- !READWRITE_SPLITTINGdataSources:ds0000:writeDataSourceName: ds0000readDataSourceNames:- ds0000_slavetransactionalReadQueryStrategy: PRIMARYloadBalancerName: randomds0001:writeDataSourceName: ds0001readDataSourceNames:- ds0001_slavetransactionalReadQueryStrategy: PRIMARYloadBalancerName: randomloadBalancers:random:type: RANDOMprops:sql-show: truemax-connections-size-per-query: 5

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

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

相關文章

單片機和PLC有哪些區別?揭秘單片機MCU的常見應用

單片機&#xff08;MCU&#xff09;和可編程邏輯控制器&#xff08;PLC&#xff09;作為電子控制系統中的兩大核心組件&#xff0c;分別在不同的領域發揮著重要作用。然而&#xff0c;盡管它們都屬于自動化控制領域的關鍵設備&#xff0c;但它們的設計理念、應用場景和性能特點…

ElementUI之Upload 上傳的使用

文章目錄說明SSM使用引入依賴在spring-mvc.xml中加入配置創建上傳工具類AliOssUtil響應工具類ResultJSON編寫controller自動上傳代碼編寫結果如下演示手動上傳前端代碼編寫后端代碼編寫結果演示如下說明 為了方便演示&#xff0c;前后端代碼一起寫了 關于對象存儲請看我另一篇博…

Langchain4j 整合MongoDB 實現會話持久化存儲詳解

目錄 一、前言 二、大模型會話記憶介紹 2.1 AI 大模型會話記憶是什么 2.2 大模型會話記憶常用實現方案 2.3 LangChain4j 會話記憶介紹 三、大模型常用會話存儲數據庫介紹 3.1 常用的會話存儲數據庫 3.2 MongoDB 簡介 3.2.1 MongoDB 是什么 3.3 為什么選擇MongoDB 作為…

SQL 常用 OVER() 窗口函數介紹

1. sum() over() 做組內數據累加在 SQL 中想實現不同分組內數據累加&#xff0c;可以通過 sum() over() PARTITION BY ORDER BY 結合實現。這種方式能同時滿足多維度分組且組內累加的需求&#xff0c;示例如下&#xff1a;假設我們有一張 sales 表&#xff0c;表中存儲著…

OpenRouter:一站式 AI 模型調用平臺,免費暢享千問、DeepSeek 等頂級模型

歡迎來到我的博客&#xff0c;代碼的世界里&#xff0c;每一行都是一個故事&#x1f38f;&#xff1a;你只管努力&#xff0c;剩下的交給時間 &#x1f3e0; &#xff1a;小破站 OpenRouter&#xff1a;一站式 AI 模型調用平臺&#xff0c;免費暢享千問、DeepSeek 等頂級模型前…

SpringBoot 整合 Kafka 的實戰指南

引言&#xff1a; 本文總字數&#xff1a;約 9800 字預計閱讀時間&#xff1a;40 分鐘 為什么 Kafka 是高吞吐場景的首選&#xff1f; 在當今的分布式系統中&#xff0c;消息隊列已成為不可或缺的基礎設施。面對不同的業務場景&#xff0c;選擇合適的消息隊列至關重要。目前…

OpenCV 實戰篇——如何測算出任一副圖片中的物體的實際尺寸?傳感器尺寸與像元尺寸的關系?

文章目錄1 如何測算出任一副圖片中的物體的實際尺寸2 傳感器尺寸與像元尺寸的關系3 Max Frame Rate最大幀率4 為什么要進行相機標定?相機標定有何意義?5 基于相機模型的單目測距--普通相機1 如何測算出任一副圖片中的物體的實際尺寸 物體尺寸測量的思路是找一個確定尺寸的物…

Java并發鎖相關

鎖相關 ?1. 什么是可重入鎖&#xff1f;Java 中如何實現&#xff1f;?? ?答?&#xff1a; 可重入鎖允許一個線程多次獲取同一把鎖&#xff08;即遞歸調用時無需重新競爭鎖&#xff09;。 ?關鍵點?&#xff1a;防止死鎖&#xff0c;避免線程因重復請求已持有的鎖而阻塞。…

Pie Menu Editor V1.18.7.exe 怎么安裝?詳細安裝教程(附安裝包)?

??Pie Menu Editor V1.18.7.exe? 是一款用于創建和編輯 ?餅圖菜單&#xff08;Pie Menu&#xff09;?? 的工具軟件&#xff0c;通常用于游戲開發、UI設計、3D建模&#xff08;如 Blender 等&#xff09;、或自定義軟件操作界面。 一、準備工作 ?下載文件? 下載了 ?Pi…

基于Spark的中文文本情感分析系統研究

引言 1.1 研究背景與意義 隨著互聯網的普及和社交媒體的興起、特別是自媒體時代的來臨&#xff0c;網絡文本數據呈現爆炸式增長。這些文本數據蘊含著豐富的用戶情感信息&#xff0c;如何有效地挖掘和利用這些信息&#xff0c;對于了解輿情動態、改進客戶服務、輔助決策分析具…

Simulink子系統、變體子系統及封裝知識

1.引言 文章三相新能源并網系統序阻抗模型——序阻抗分析器IMAnalyzer介紹了一種用于分析和掃描序阻抗的軟件。其中&#xff0c;在序阻抗掃頻操作過程中&#xff0c;用到了一個擾動注入、測量和運算工具【IMtool】&#xff0c;它外表長這樣&#xff1a; 內部長這樣&#xff1a…

高階組件介紹

高階組件約定俗成以with開頭 import React, { useEffect } from react; import { TouchableOpacity, Image, StyleSheet } from react-native;type IReactComponent React.ClassicComponentClass| React.ComponentClass| React.FunctionComponent| React.ForwardRefExoticComp…

C++ STL系列-02.泛型入門

C STL系列-02.泛型入門C中的泛型編程主要通過模板&#xff08;template&#xff09;實現。模板允許我們編寫與類型無關的代碼&#xff0c;是一種將類型作為參數進行編程的方式。在C中&#xff0c;模板分為函數模板和類模板。 1. 函數模板函數模板允許我們定義一個函數&#xff…

高效管理網絡段和端口集合的工具之ipset

目錄 1. 核心命令速查 2. 集合類型 3. 實戰案例&#xff1a;使用 ipset 封禁 IP 案例 1&#xff1a;基礎黑名單封禁&#xff08;手動添加&#xff09; 案例 2&#xff1a;自動過期和解封 案例 3&#xff1a;封禁 IP 和端口組合 案例 4&#xff1a;白名單模式 案例 5&am…

實例和對象的區別

對象&#xff08;Object&#xff09;是一個概念&#xff0c;它表示“某個類的一個成員”&#xff0c;是“邏輯上的個體”。實例&#xff08;Instance&#xff09;是一個現實&#xff0c;指的是在內存中真正分配了空間的對象。實例一定是對象&#xff0c;但對象不一定是實例。例…

Win10 Chrome認不出新Emoji?兩個擴展搞定顯示與輸入

前言 用Win10電腦在Chrome里發消息、刷網頁時&#xff0c;你是否遇到過這樣的尷尬&#xff1a;別人發的、或者頁面顯示的 Emoji&#xff0c;在你屏幕上變成了空白方框&#xff0c;像“文字里缺了一塊拼圖”&#xff1f;其實這不是Chrome的錯&#xff0c;也不用換電腦&#xff0…

Golang中逃逸現象, 變量“何時棧?何時堆?”

目錄 什么是棧 什么是堆 棧 vs 堆&#xff08;核心區別&#xff09; GO編譯器的逃逸分析 什么是逃逸分析&#xff1f; 怎么看逃逸分析結果&#xff1f; 典型“會逃逸”的場景 閉包捕獲局部變量 返回或保存帶有“底層存儲”的容器 經由接口/反射/fmt 等導致裝箱或被長…

MySQL入門指南:從安裝到工作原理

什么是MySQL MySQL是一個開源的關系型數據庫管理系統&#xff0c;由瑞典MySQL AB公司開發&#xff08;目前屬于Oracle公司&#xff09;&#xff0c;被廣泛地應用在大中小型網站中 MySQL是一個小型的開源的關系型數據庫管理系統&#xff0c;與其他大型數據庫管理系統例如&…

dask.dataframe.shuffle.set_index中獲取 divisions 的步驟分析

dask.dataframe.shuffle.set_index 中獲取 divisions 的步驟分析 主要流程概述 在 set_index 函數中&#xff0c;當 divisionsNone 時&#xff0c;系統需要通過分析數據來動態計算分區邊界。這個過程分為以下幾個關鍵步驟&#xff1a; 1. 初始檢查和準備 if divisions is None:…

ai生成ppt工具有哪些?10款主流AI生成PPT工具盤點

隨著人工智能技術的飛速發展&#xff0c;AI生成PPT工具逐漸成為職場人士、學生和創作者提升效率的得力助手。這類工具通過智能算法&#xff0c;能夠快速將文本、數據或創意轉化為結構化、視覺化的演示文稿&#xff0c;大幅節省設計時間。1、AiPPT星級評分&#xff1a;★★★★★…