diff --git a/index.md b/index.md index 59ded66f4d48099f98a5f9d48cc00d2139c7ff30..278d1eaf3e86ed52df3d65f5ad5016460a1c3a09 100644 --- a/index.md +++ b/index.md @@ -543,23 +543,23 @@ MySQL 初阶-关系型数据库- MySQL 基本概念 #### 25.1 复用数据库连接 -高阶--应用程序优化-复用数据库连 +高阶-应用程序优化-复用数据库连 #### 25.2 减少数据访问 -高阶--应用程序优化-减少数据访问 +高阶-应用程序优化-减少数据访问 #### 25.3 开启查询缓存 -高阶--应用程序优化-开启查询缓存 +高阶-应用程序优化-开启查询缓存 #### 25.4 使用外部缓存 -高阶--应用程序优化-使用外部缓存 +高阶-应用程序优化-使用外部缓存 #### 25.5 使用分布式MySQL架构 -高阶--应用程序优化-分布式MySQL架构 +高阶-应用程序优化-分布式MySQL架构 ### 第26章 MySQL的其他优化选项 diff --git a/src/data/mysql_update_4_top.csv b/src/data/mysql_update_4_top.csv new file mode 100644 index 0000000000000000000000000000000000000000..390cd146aa85673d503462849b1a5650bc059469 --- /dev/null +++ b/src/data/mysql_update_4_top.csv @@ -0,0 +1,158 @@ +node_id,text,book_text,sample_id,tree_name,category +mysql-8e971f3c569a4e56bb83b5d75a2a425f,mysql初阶-关系型数据库-数据库基本概念,[技能树-初阶] 第1篇 MySQL基础,,mysql,blog +mysql-8e971f3c569a4e56bb83b5d75a2a425f,mysql初阶-关系型数据库-数据库基本概念,第2章 数据库技术,,mysql,blog +mysql-8e971f3c569a4e56bb83b5d75a2a425f,mysql初阶-关系型数据库-数据库基本概念,2.1 数据库系统,,mysql,blog +mysql-8e971f3c569a4e56bb83b5d75a2a425f,mysql初阶-关系型数据库-数据库基本概念,2.2 SQL语言,,mysql,blog +mysql-925f9d57c7794e5391fb790bcdbf43c6,mysql初阶-关系型数据库-mysql基本概念,2.3 数据库访问技术,,mysql,blog +mysql-8e971f3c569a4e56bb83b5d75a2a425f,mysql初阶-关系型数据库-数据库基本概念,3.1 MySQL三大范式,,mysql,blog +mysql-925f9d57c7794e5391fb790bcdbf43c6,mysql初阶-关系型数据库-mysql基本概念,3.2 MySQL存储引擎,,mysql,blog +mysql-764d5080ddb943fe9236922984afa152,mysql初阶-使用数据库-创建和删除数据库,7.1 创建数据库,,mysql,blog +mysql-764d5080ddb943fe9236922984afa152,mysql初阶-使用数据库-创建和删除数据库,7.2 查看数据库,,mysql,blog +mysql-764d5080ddb943fe9236922984afa152,mysql初阶-使用数据库-创建和删除数据库,7.3 修改数据库名称,,mysql,blog +mysql-764d5080ddb943fe9236922984afa152,mysql初阶-使用数据库-创建和删除数据库,7.4 数据库编码,,mysql,blog +mysql-764d5080ddb943fe9236922984afa152,mysql初阶-使用数据库-创建和删除数据库,7.5 删除数据库,,mysql,blog +mysql-426b0b1e04a4462e984ee77ca536f916,mysql初阶-使用数据库-表,8.2 查看数据表结构,,mysql,blog +mysql-426b0b1e04a4462e984ee77ca536f916,mysql初阶-使用数据库-表,8.4 删除数据表,,mysql,blog +mysql-0f0cd6ec82e343db95ed800a7d964cfc,mysql中阶-数据库组成-表,[技能树-进阶] 8.5 MySQL中的临时表,,mysql,blog +mysql-1418d1a710ab4e7c8cacb0bad047179e,mysql初阶-数据类型-数值类型,9.1 数值类型,,mysql,blog +mysql-27ff66e31d3d4118977cbbc04da6887e,mysql初阶-数据类型-文本字符串类型,9.3 文本字符串类型,,mysql,blog +mysql-ec8f22f2c63a4f27bd12815644d0f3db,mysql初阶-数据类型-二进制字符串类型,9.4 二进制字符串类型,,mysql,blog +mysql-8f2aac71ea494f1b84372d43aa436135,mysql初阶-数据查询-运算符,10.1 算术运算符,,mysql,blog +mysql-8f2aac71ea494f1b84372d43aa436135,mysql初阶-数据查询-运算符,10.2 比较运算符,,mysql,blog +mysql-8f2aac71ea494f1b84372d43aa436135,mysql初阶-数据查询-运算符,10.3 逻辑运算符,,mysql,blog +mysql-8f2aac71ea494f1b84372d43aa436135,mysql初阶-数据查询-运算符,10.4 位运算符,,mysql,blog +mysql-8f2aac71ea494f1b84372d43aa436135,mysql初阶-数据查询-运算符,10.5 运算符的优先级,,mysql,blog +mysql-07b85d4c87c84a62a9b55299250cd9a3,mysql初阶-数据查询-函数,11.2 数学函数,,mysql,blog +mysql-07b85d4c87c84a62a9b55299250cd9a3,mysql初阶-数据查询-函数,11.3 字符串函数,,mysql,blog +mysql-07b85d4c87c84a62a9b55299250cd9a3,mysql初阶-数据查询-函数,11.4 日期和时间函数,,mysql,blog +mysql-07b85d4c87c84a62a9b55299250cd9a3,mysql初阶-数据查询-函数,11.5 流程处理函数,,mysql,blog +mysql-07b85d4c87c84a62a9b55299250cd9a3,mysql初阶-数据查询-函数,11.6 加密与解密函数,,mysql,blog +mysql-07b85d4c87c84a62a9b55299250cd9a3,mysql初阶-数据查询-函数,11.7 聚合函数,,mysql,blog +mysql-39c24ef50f5a48b2a0130260485980b1,mysql高阶-深入函数-mysql信息相关,[技能树-进阶] 11.8 获取MySQL信息函数,,mysql,blog +mysql-e5c47aa105c5484c8871825dd622cc5e,mysql高阶-深入函数-锁相关,[技能树-进阶] 11.9 加锁与解锁函数,,mysql,blog +mysql-2adc9f3d02b54abc893f288140109118,mysql高阶-深入函数-json函数,[技能树-进阶] 11.10 JSON函数,,mysql,blog +mysql-5ccb985581644784ae82118849bc241c,mysql高阶-深入函数-窗口函数,[技能树-进阶] 11.11 窗口函数,,mysql,blog +mysql-f2fe15b77d5d4ecb92e2840e8b831af2,mysql高阶-深入函数-其它函数,[技能树-进阶] 11.12 MySQL的其他函数,,mysql,blog +mysql-fcca525ab0f04f16834ded9b2b3f38a4,mysql初阶-数据修改-插入,12.1 数据插入,,mysql,blog +mysql-3cae643e21644d6d937d69b59014922f,mysql初阶-数据修改-删除,12.3 数据删除,,mysql,blog +mysql-f5527eae7f3148108c92ff99a6d4ed4a,mysql初阶-数据查询-select,13.2 SELECT查询语句,,mysql,blog +mysql-91cc9c73e58945d3ba654370a057a1c7,mysql初阶-数据查询-where,13.3 WHERE条件语句,,mysql,blog +mysql-b57b6c08f5f240c6a997284e4448f088,mysql中阶-查询-union,13.7 UNION联合语句,,mysql,blog +mysql-1d350c6226d443bdb76b5058d8ee23e7,mysql中阶-查询-别名,13.8 使用别名查询数据,,mysql,blog +mysql-e6cbbff27cd04bc0b61ebbb3ef27d4b2,mysql中阶-查询-正则表达式,13.9 使用正则表达式查询数据,,mysql,blog +mysql-bf629829370d405cbfcd5aa83adb536a,mysql中阶-索引-索引入门,14.1 索引简介,,mysql,blog +mysql-bf629829370d405cbfcd5aa83adb536a,mysql中阶-索引-索引入门,14.2 索引的使用场景,,mysql,blog +mysql-fe65d5c615ad40f8ac056cc654f2d788,mysql中阶-索引-创建索引,14.3 创建数据表时创建索引,,mysql,blog +mysql-fe65d5c615ad40f8ac056cc654f2d788,mysql中阶-索引-创建索引,14.4 为已有数据表添加索引,,mysql,blog +mysql-85ba0df78d754b00b30aa8e74ad35d06,mysql中阶-索引-删除索引,14.5 删除索引,,mysql,blog +mysql-bf629829370d405cbfcd5aa83adb536a,mysql中阶-索引-索引入门,14.6 隐藏索引,,mysql,blog +mysql-bf629829370d405cbfcd5aa83adb536a,mysql中阶-索引-索引入门,14.7 降序索引,,mysql,blog +mysql-157170c2c7454b3ca78a4f7f7f6f3739,mysql高阶-深入索引-函数索引,[技能树-进阶] 14.8 函数索引,,mysql,blog +mysql-95a29a6a448849029d548393bbdf283e,mysql中阶-视图-视图的基本概念,15.1 视图概述,,mysql,blog +mysql-9339ebb389474492a0ba2c2ff29e78fb,mysql中阶-视图-创建视图,15.2 创建视图,,mysql,blog +mysql-95a29a6a448849029d548393bbdf283e,mysql中阶-视图-视图的基本概念,15.3 查看视图,,mysql,blog +mysql-3a51b0740b704d92a534335a7a8dfd6e,mysql中阶-视图-修改视图,15.4 修改视图的结构,,mysql,blog +mysql-36171582b8324dc98ff16d9b0cac406d,mysql中阶-视图-删除视图,15.6 删除视图,,mysql,blog +mysql-0666cae9faaa41b7b2413063e1214edd,mysql中阶-存储过程和函数-存储过程和函数简介,16.1 存储过程和函数简介,,mysql,blog +mysql-101770860dbe48ad92566d296809b34d,mysql中阶-存储过程和函数-创建存储过程和函数,16.2 创建存储过程和函数,,mysql,blog +mysql-5af12dac5321409baa0479ba2824e0bf,mysql中阶-存储过程和函数-查看存储过程和函数,16.3 查看存储过程和函数,,mysql,blog +mysql-9d19fedcc1fd48c9a450e71403b9099f,mysql中阶-存储过程和函数-修改存储过程和函数,16.4 修改存储过程和函数,,mysql,blog +mysql-2fd94590dfca4068bc713bbf132f8653,mysql中阶-存储过程和函数-调用存储过程和函数,16.5 调用存储过程和函数,,mysql,blog +mysql-24789b2078dc4f44b8ad150ce571314e,mysql中阶-存储过程和函数-删除存储过程和函数,16.6 删除存储过程和函数,,mysql,blog +mysql-cece7ee8078441a6a032cf1a71cac21c,mysql中阶-存储过程和函数-变量,16.7 MySQL中使用变量,,mysql,blog +mysql-cece7ee8078441a6a032cf1a71cac21c,mysql中阶-存储过程和函数-变量,16.8 MySQL中使用变量案例,,mysql,blog +mysql-459fd14ff096438d9b6460270bec4754,mysql高阶-过程化编程-游标,[技能树-进阶] 16.12 MySQL中游标的使用案例,,mysql,blog +mysql-459fd14ff096438d9b6460270bec4754,mysql高阶-过程化编程-游标,[技能树-进阶] 16.13 MySQL中控制流程的使用,,mysql,blog +mysql-6724aaaef7d3404fb06d322f9d9534ed,mysql中阶-触发器-创建触发器,17.1 创建触发器,,mysql,blog +mysql-ec8ee43f3a6340638362d38157fbc66b,mysql中阶-触发器-查看触发器,17.2 查看触发器,,mysql,blog +mysql-876f66d6f6404fe8813a932df024cb5d,mysql中阶-触发器-删除触发器,17.3 删除触发器,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.1 分区介绍,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.2 RANGE分区,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.3 LIST分区,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.4 COLUMNS分区,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.5 HASH分区,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.6 KEY分区,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.7 子分区,,mysql,blog +mysql-ac73930a15c149b9ba0b250e46a109e2,mysql高阶-运维与架构-分区,18.8 分区中的NULL值处理,,mysql,blog +mysql-753300de6ef94af7be40fb91a05421a6,mysql高阶-sql高级技巧-cte和递归查询,19.1 公用表表达式,,mysql,blog +mysql-d3611482eecd4055816df4b1dd9ff90d,mysql高阶-设计优化-生成列,19.2 生成列,,mysql,blog +mysql-3574b2e5c9ca475789d9d582d7726906,mysql高阶-查询优化-showstatus,20.1 SHOW STATUS语句解析,,mysql,blog +mysql-a42f617d4eb54aabbc649bdde4485117,mysql高阶-查询优化-explain,20.2 EXPLAIN语句解析,,mysql,blog +mysql-f0b12126dd3e4be09010a308a822bc32,mysql高阶-查询优化-showprofile,20.3 SHOW PROFILE语句解析,,mysql,blog +mysql-4d5cfac3820648ffbe0b382898d9cf26,mysql高阶-查询优化-子查询优化,20.5 优化子查询,,mysql,blog +mysql-5b21eb9eb2f446288d80c6bd65a6416f,mysql高阶-深入索引-索引概述,21.1 索引的类型,,mysql,blog +mysql-5b21eb9eb2f446288d80c6bd65a6416f,mysql高阶-深入索引-索引概述,21.2 使用索引的场景,,mysql,blog +mysql-5b21eb9eb2f446288d80c6bd65a6416f,mysql高阶-深入索引-索引概述,21.3 无法使用索引的场景,,mysql,blog +mysql-5b21eb9eb2f446288d80c6bd65a6416f,mysql高阶-深入索引-索引概述,21.4 使用索引提示,,mysql,blog +mysql-9f8881b9f30544149327af68e3007603,mysql高阶-深入索引-json索引,21.5 使用生成列为JSON建立索引,,mysql,blog +mysql-4381bed0477f412e80f0509b0e2bb3f9,mysql高阶-查询优化-嵌套查询,22.1 嵌套查询的优化,,mysql,blog +mysql-5e5c02582f1641ada50c92161d0e0587,mysql高阶-查询优化-or子句优化,22.2 OR条件语句的优化,,mysql,blog +mysql-c140ce4a6f0a4557a3a5ce0b471fd6da,mysql高阶-查询优化-orderby优化,22.3 ORDER BY语句的优化,,mysql,blog +mysql-66fc4566eaf34994b072ca83bf79ceb4,mysql高阶-查询优化-groupby优化,22.4 GROUP BY语句的优化,,mysql,blog +mysql-6e063c40f1ba485288eba2376097b79c,mysql高阶-查询优化-分页查询优化,22.5 分页查询的优化,,mysql,blog +mysql-4e93793f51a24f0eb00f7824ecc8929b,mysql高阶-写优化-插入优化,22.6 插入数据的优化,,mysql,blog +mysql-ff4222264013437da2214ff77ca92961,mysql高阶-写优化-删除优化,22.7 删除数据的优化,,mysql,blog +mysql-e5530d16129047d38934c3ce9a906650,mysql高阶-设计优化-优化数据类型,23.1 优化数据类型,,mysql,blog +mysql-3e4c837b471c454c90bfbc32445f2780,mysql高阶-设计优化-反范式设计,23.3 反范式化设计,,mysql,blog +mysql-a2ddae1b044149ecbb74db3b6eb32721,mysql高阶-设计优化-增加中间表,23.4 增加中间表,,mysql,blog +mysql-cde6eae01784468fa0171ff3042f221f,mysql高阶-设计优化-分析数据表,23.5 分析数据表,,mysql,blog +mysql-fbcc654d6a86452aa349d2ed6003adb6,mysql高阶-设计优化-检查数据表,23.6 检查数据表,,mysql,blog +mysql-f5775462ae784d44a4b2bce5f456311a,mysql高阶-设计优化-优化数据表,23.7 优化数据表,,mysql,blog +mysql-ccb6fcf2983b4b3e8b37abbcbc776f21,mysql高阶-设计优化-拆分数据表,23.8 拆分数据表,,mysql,blog +mysql-f2a76883814745b9979541ed4117754f,mysql高阶-服务器优化-硬件配置,24.1 MySQL服务器硬件的优化,,mysql,blog +mysql-6d4f4d7aecfb4546a8163256859562e1,mysql高阶-服务器优化-配置项优化,24.2 MySQL配置项的优化,,mysql,blog +mysql-d7b339f2b2434e3fbd3721b7cd1abc1a,mysql高阶-应用程序优化-减少数据访问,25.2 减少数据访问,,mysql,blog +mysql-8973ee6a0cb045b7bcf623b4e5757baa,mysql高阶-应用程序优化-开启查询缓存,25.3 开启查询缓存,,mysql,blog +mysql-7f86d4e58a514a44bce09a19595f9cab,mysql高阶-应用程序优化-使用外部缓存,25.4 使用外部缓存,,mysql,blog +mysql-402ec368b74f4c33b33c812e9f762d3a,mysql高阶-应用程序优化-分布式mysql架构,25.5 使用分布式MySQL架构,,mysql,blog +mysql-36d638345c1949f7bb032baf8d9f996e,mysql高阶-服务器优化-performance_schema,26.1 使用performance_schema数据库分析MySQL,,mysql,blog +mysql-3d5c8647b1674de18c8348454d16fee5,mysql高阶-服务器优化-sys数据库,26.2 使用sys数据库分析MySQL',,mysql,blog +mysql-715cc1f656df4b099d952145a53dd006,mysql高阶-服务器优化-资源组,26.3 MySQL 8.x中的资源组,,mysql,blog +mysql-343463029f6d41068885687f4dd8bfbd,mysql初阶-命令行工具-mysql,27.2 mysql命令,,mysql,blog +mysql-daca74b56aca48cea2da14078b518051,mysql初阶-命令行工具-mysqladmin,27.3 mysqladmin命令,,mysql,blog +mysql-b34e3244a8ba4166bd22bc4fe5f7d8db,mysql初阶-命令行工具-myisampack,27.4 myisampack命令,,mysql,blog +mysql-fe9caf0e07a94efc8b7c8f2a4c683efe,mysql初阶-命令行工具-mysqlbinlog,27.5 mysqlbinlog命令,,mysql,blog +mysql-d9cdafd993bf41bbb860e5087dd54bd1,mysql初阶-命令行工具-mysqlcheck,27.6 mysqlcheck命令,,mysql,blog +mysql-430b0de67c294d64aff35c85fec8393e,mysql初阶-命令行工具-mysqlshow,27.7 mysqlshow命令,,mysql,blog +mysql-a4998d140f024982989ed4647c78ba65,mysql初阶-命令行工具-mysqldump,27.8 mysqldump命令,,mysql,blog +mysql-e782e10839d843c0ad36a05ae7d0366f,mysql初阶-命令行工具-mysqlimport,27.9 mysqlimport命令,,mysql,blog +mysql-4964024c989c4346861b67ae013d746c,mysql中阶-mysql日志-查询日志,28.1 查询日志,,mysql,blog +mysql-6f74222f9e3d422c87b6b2dd30c2cc80,mysql中阶-mysql日志-慢查询日志,28.2 慢查询日志,,mysql,blog +mysql-7645195ec078406c9303d39ea9c3738c,mysql中阶-mysql日志-错误日志,28.3 错误日志,,mysql,blog +mysql-ab25d57bc9704572bc3c54abb83b769b,mysql中阶-mysql日志-二进制日志,28.4 二进制日志,,mysql,blog +mysql-c9a8e4223b6c47efb08e2015f7570317,mysql中阶-备份与恢复-mysqldump,29.1 基于mysqldump备份并恢复数据,,mysql,blog +mysql-40cf0134521849d891d6135e2316491a,mysql中阶-备份与恢复-mysqldumper,[技能树-进阶] 29.3 基于mydumper备份并恢复数据,,mysql,blog +mysql-0b976462e6314fa499a9f086c0eded8f,mysql中阶-备份与恢复-mysqlhotcopy,[技能树-进阶] 29.4 基于mysqlhotcopy备份并恢复数据,,mysql,blog +mysql-6064766016164bfebb475090c0979d2a,mysql中阶-备份与恢复-xtrabackup,[技能树-进阶] 29.5 基于xtrabackup备份并恢复数据,,mysql,blog +mysql-76b4d2f260f94ea1a6692d5a8dab2709,mysql中阶-备份与恢复-灾难恢复,29.7 MySQL灾难恢复,,mysql,blog +mysql-3c8b76e8fa914a7a87c74f511fd39680,mysql中阶-备份与恢复-自动备份,[技能树-进阶] 29.8 实现数据库的自动备份,,mysql,blog +mysql-e2eefb85984643f8adb95f4eee16bc8f,mysql中阶-备份与恢复-数据导入和导出,29.9 导出数据,,mysql,blog +mysql-e2eefb85984643f8adb95f4eee16bc8f,mysql中阶-备份与恢复-数据导入和导出,29.10 导入数据,,mysql,blog +mysql-1d0dd362995d4ee0b59e9e8d2e918d5f,mysql中阶-用户和权限-权限表,30.1 MySQL中的权限表,,mysql,blog +mysql-25808aa5b4ba4e78bd3dc59e09b403ed,mysql中阶-用户和权限-创建普通用户,30.2 创建普通用户,,mysql,blog +mysql-291ab4c99fa945ae8629b1956bc1ecc9,mysql中阶-用户和权限-为用户授权,30.3 为用户授权,,mysql,blog +mysql-d2b788a8200140a693297356c02ce872,mysql中阶-用户和权限-查看用户权限,30.4 查看用户权限,,mysql,blog +mysql-ae1794fcc925471cb8b1972cbfbf2951,mysql中阶-用户和权限-修改用户权限,30.5 修改用户权限,,mysql,blog +mysql-d47605d2cb134cdc98e6fbefc0651e8f,mysql中阶-用户和权限-撤销用户权限,30.6 撤销用户权限,,mysql,blog +mysql-12a66fd74a2741bbbfc0df7a59801123,mysql中阶-用户和权限-修改用户密码,30.7 修改用户密码,,mysql,blog +mysql-0bb8146d9ee54ff6934e45ce4e3b2f99,mysql中阶-用户和权限-删除用户,30.8 删除用户,,mysql,blog +mysql-ab80d0d8af69427ab91a65b89de7e30c,mysql中阶-用户和权限-限制用户使用资源,30.9 限制用户使用资源,,mysql,blog +mysql-8689980164b1428c865cf33ad889a088,mysql中阶-用户和权限-mysql8的账户管理,30.10 MySQL 8.x版本中的账户管理,,mysql,blog +mysql-cc8606a40aac43cb8b063a65f51e4df1,mysql高阶-运维与架构-主从复制,31.1 搭建MySQL主从复制环境,,mysql,blog +mysql-91ba7f7a6b684b8aad01abd583cf0442,mysql高阶-运维与架构-多主复制,31.2 搭建MySQL主主复制环境,,mysql,blog +mysql-1c778aa1adfd43d4ac9da32df9e44238,mysql高阶-运维与架构-添加从库,31.3 添加MySQL从库,,mysql,blog +mysql-88333dcb84a946a78bfd9f413c6e795b,mysql高阶-运维与架构-从主从复制到链式复制,31.4 切换主从复制到链式复制,,mysql,blog +mysql-2f6f847907d4415788e98d2f70f64d3c,mysql高阶-运维与架构-从链式复制到主从复制,31.5 切换链式复制到主从复制,,mysql,blog +mysql-5026c95794f44de081e2aefd3af8bb32,mysql高阶-运维与架构-多源复制,31.6 搭建MySQL多源复制环境,,mysql,blog +mysql-b3cba2e9c7ea46d5beeb1948b41a74d5,mysql高阶-运维与架构-复制过滤器,31.7 添加复制过滤器,,mysql,blog +mysql-9dee640902204fcbbe780c0f04bc7c18,mysql高阶-运维与架构-延迟复制,31.8 设置延迟复制,,mysql,blog +mysql-cc8606a40aac43cb8b063a65f51e4df1,mysql高阶-运维与架构-主从复制,31.9 基于GTID搭建MySQL主从复制环境,,mysql,blog +mysql-cc8606a40aac43cb8b063a65f51e4df1,mysql高阶-运维与架构-主从复制,31.10 基于半同步模式搭建MySQL主从复制环境,,mysql,blog +mysql-f4d43d35c4c846baa2761d02fff5b09a,mysql高阶-运维与架构-读写分离,32.1 基于MySQL Proxy实现读写分离,,mysql,blog +mysql-f4d43d35c4c846baa2761d02fff5b09a,mysql高阶-运维与架构-读写分离,32.2 基于Atlas实现读写分离,,mysql,blog +mysql-f4d43d35c4c846baa2761d02fff5b09a,mysql高阶-运维与架构-读写分离,32.3 基于ProxySQL实现读写分离,,mysql,blog +mysql-f4d43d35c4c846baa2761d02fff5b09a,mysql高阶-运维与架构-读写分离,32.4 基于Amoeba实现读写分离,,mysql,blog +mysql-f4d43d35c4c846baa2761d02fff5b09a,mysql高阶-运维与架构-读写分离,32.5 基于Mycat实现读写分离,,mysql,blog +mysql-46c46e16ac404db99e61412a948e3a3c,mysql高阶-运维与架构-ha高可用,33.1 基于Keepalived搭建MySQL高可用环境,,mysql,blog +mysql-46c46e16ac404db99e61412a948e3a3c,mysql高阶-运维与架构-ha高可用,33.2 基于HAProxy搭建Mycat高可用环境,,mysql,blog +mysql-46c46e16ac404db99e61412a948e3a3c,mysql高阶-运维与架构-ha高可用,33.3 基于Keepalived搭建HAProxy高可用环境,,mysql,blog diff --git a/src/data/section_id_dict.json b/src/data/section_id_dict.json new file mode 100644 index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b --- /dev/null +++ b/src/data/section_id_dict.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/node_knowledge_mapping.py b/src/node_knowledge_mapping.py new file mode 100644 index 0000000000000000000000000000000000000000..c45a17e85fff209669f2e5274a79faa2ef3d89c7 --- /dev/null +++ b/src/node_knowledge_mapping.py @@ -0,0 +1,113 @@ +''' +@File : node_knowledge_mapping.py +@Time : 2022/05/30 16:21:40 +@Author : Lu Xin +@Contact : luxin@csdn.net +''' + +# here put the import lib +import re +import ipdb + +import pandas as pd + +from treelib import Tree +from treelib import Node + +from path import get_tree_dir +from path import get_index_dir +from path import get_sample_id_dir + +from utils import load_json +from utils import load_markdown + + +class NodeKnowledgeMapping(): + def __init__(self, category="blog") -> None: + self.tree_name = None + self.category = category + self.tree = Tree() + self.text_id_dict = None + self.section_text_dict = None + self.section_sample_dict = None + + def load(self): + self.__load_tree() + self.__load_index() + self.__load_sample_id() + + def __construct_tree(self, tree_dict, parent): + for node_text, node_info in tree_dict.items(): + node_id = node_info["node_id"] + subtree_list = node_info["children"] + node = Node( + tag=node_text, + identifier=node_id) + self.tree.add_node(node, parent=parent) + for subtree_dict in subtree_list: + self.__construct_tree(subtree_dict, node_id) + + def __load_tree(self): + self.text_id_dict = {} + + tree_dict = load_json(get_tree_dir()) + self.tree_name = list(tree_dict.keys())[0].lower() + self.__construct_tree(tree_dict, None) + paths_to_leaves = self.tree.paths_to_leaves() + for path in paths_to_leaves: + text = "-".join( + [self.tree.get_node(node_id).tag.replace(" ", "").lower() \ + for node_id in path[1: ]]) + id = path[-1] + self.text_id_dict[text] = id + + def __load_index(self): + self.section_text_dict = {} + + mk_list = load_markdown(get_index_dir()) + _len = len(mk_list) + _index = 0 + while _index < (_len - 1): + line = mk_list[_index] + line_next = mk_list[_index + 1] + + if line.startswith("##") and not line_next.startswith("##"): + section = re.sub(r"^#{1,10} {1,5}", "", line) + text = line_next.replace(" ", "").lower() + if not text.startswith(self.tree_name): + text = self.tree_name + text + if text.find("不采纳") == -1: + self.section_text_dict[section] = text + _index += 2 + else: + _index += 1 + + def __load_sample_id(self): + self.section_sample_dict = load_json(get_sample_id_dir()) + + def get_node_knowledge_mapping(self, file_name): + columns = ["node_id", "text", "book_text", "sample_id", "tree_name", "category"] + contents = [] + for section, text in self.section_text_dict.items(): + if text in self.text_id_dict: + node_id = self.text_id_dict[text] + else: + print("路径 \"{}\" 不存在!".format(text)) + continue + sample_id = self.section_sample_dict.get(section, None) + contents.append([node_id, text, section, sample_id, self.tree_name, self.category]) + + df = pd.DataFrame(contents, columns=columns) + df.to_csv(file_name, index=False) + + +def main(): + nkm = NodeKnowledgeMapping() + nkm.load() + + file_name = "./data/mysql_update_4_top.csv" + nkm.get_node_knowledge_mapping(file_name) + + +if __name__=='__main__': + main() diff --git a/src/path.py b/src/path.py new file mode 100644 index 0000000000000000000000000000000000000000..fb7ab132a887b962b16ee1f550e7e2e42f9fcad9 --- /dev/null +++ b/src/path.py @@ -0,0 +1,24 @@ +''' +@File : path.py +@Time : 2022/05/25 16:00:20 +@Author : Lu Xin +@Contact : luxin@csdn.net +''' + +# here put the import lib +import os + +def get_data_root(): + return '../data' + + +def get_tree_dir(): + return '{}/tree.json'.format(get_data_root()) + + +def get_index_dir(): + return '../index.md' + + +def get_sample_id_dir(): + return './data/section_id_dict.json' diff --git a/src/utils.py b/src/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..7cd5c131b1dbb5ee7eb9d63bd75e5f76801c00f4 --- /dev/null +++ b/src/utils.py @@ -0,0 +1,105 @@ +''' +@File : utils.py +@Time : 2022/05/25 15:54:19 +@Author : Lu Xin +@Contact : luxin@csdn.net +''' + +# here put the import lib +import json +import logging +import requests + +logger = logging.getLogger(__name__) + + +def load_json(path): + """ load_json(path:str)->jsObject + 从指定文件读取内容,解析为 json 返回 + @param path: 文件路径 + @return: 解析后的 json + """ + with open(path) as f: + data = f.read() + return json.loads(data) + + +def dump_json(path, data): + """ dump_json(path:str, data:obj)->None + 从指定文件读取内容,解析为 json 返回 + @param path: 文件路径 + @param data: json 对象 + @return: None + """ + with open(path, "w+") as df: + df.write(json.dumps(data, indent=2, ensure_ascii=False)) + + +def load_markdown(path): + data = [] + with open(path, "r", encoding="utf-8") as f: + for line in f.readlines(): + line = line.strip() + if line == "": + continue + + data.append(line) + + return data + +def write_markdwon(path, data): + with open(path, "w", encoding='utf-8') as f: + for line in data: + f.write(line) + + +def post_request(url, params, retry=3, headers=None, json_api=True, timeout=20): + if headers is None: + hdrs = {"Content-Type": "application/json"} + else: + hdrs = headers + fails = 0 + while fails < retry: + try: + if headers is None: + data = json.dumps(params) + else: + data = params + logger.debug(f"will post {data} to {url}") + resp = requests.post(url, data, headers=hdrs, timeout=timeout) + if resp: + logger.info(f"resp {resp.content}") + if json_api: + return resp.json() + else: + return resp.content + else: + logger.error(f"resp: [{resp.status_code}] {resp.content}") + fails += 1 + except Exception as error: + logger.error(f"post {params} to {url} failed {error}") + fails += 1 + if fails > retry: + raise error + + +def get_request(url, params, retry=3, json_api=True): + fails = 0 + while fails < retry: + try: + logger.debug(f"will get {params} from {url}") + resp = requests.get(url, params, timeout=10) + if resp: + logger.info(f"resp {resp.content}") + if json_api: + return resp.json() + else: + return resp.content + else: + logger.error("resp: None") + + except Exception as error: + logger.error(f"get {params} from {url} failed {error}") + fails += 1 + if fails > retry: + raise error \ No newline at end of file