mirror of https://github.com/dunwu/db-tutorial.git
docs: 更新文档
parent
ac47b8f762
commit
e1f862a770
256
README.md
256
README.md
|
@ -65,7 +65,20 @@ TODO...
|
|||
- [SqLite 应用指南](docs/sql/sqlite.md)
|
||||
- [PostgreSQL 应用指南](docs/sql/postgresql.md)
|
||||
|
||||
## [Redis](docs/nosql/redis)
|
||||
## 列式数据库
|
||||
|
||||
### HBase
|
||||
|
||||
> [HBase](https://dunwu.github.io/bigdata-tutorial/hbase) 📚 因为常用于大数据项目,所以将其文档和源码整理在 [bigdata-tutorial](https://dunwu.github.io/bigdata-tutorial/) 项目中。
|
||||
|
||||
- [HBase 原理](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase原理.md) ⚡
|
||||
- [HBase 命令](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase命令.md)
|
||||
- [HBase 应用](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase应用.md)
|
||||
- [HBase 运维](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase运维.md)
|
||||
|
||||
## KV 数据库
|
||||
|
||||
### Redis
|
||||
|
||||
![img](https://raw.githubusercontent.com/dunwu/images/dev/snap/20200713105627.png)
|
||||
|
||||
|
@ -79,7 +92,28 @@ TODO...
|
|||
- [Redis 实战](docs/nosql/redis/redis-action.md) - 关键词:`缓存`、`分布式锁`、`布隆过滤器`
|
||||
- [Redis 运维](docs/nosql/redis/redis-ops.md) 🔨 - 关键词:`安装`、`命令`、`集群`、`客户端`
|
||||
|
||||
## [Elasticsearch](docs/nosql/elasticsearch)
|
||||
## 文档数据库
|
||||
|
||||
### MongoDB
|
||||
|
||||
> MongoDB 是一个基于文档的分布式数据库,由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。
|
||||
>
|
||||
> MongoDB 是一个介于关系型数据库和非关系型数据库之间的产品。它是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。
|
||||
>
|
||||
> MongoDB 最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
|
||||
|
||||
- [MongoDB 应用指南](docs/nosql/mongodb/mongodb-quickstart.md)
|
||||
- [MongoDB 聚合操作](docs/nosql/mongodb/mongodb-aggregation.md)
|
||||
- [MongoDB 建模](docs/nosql/mongodb/mongodb-model.md)
|
||||
- [MongoDB 建模示例](docs/nosql/mongodb/mongodb-model-example.md)
|
||||
- [MongoDB 索引](docs/nosql/mongodb/mongodb-index.md)
|
||||
- [MongoDB 复制](docs/nosql/mongodb/mongodb-replication.md)
|
||||
- [MongoDB 分片](docs/nosql/mongodb/mongodb-sharding.md)
|
||||
- [MongoDB 运维](docs/nosql/mongodb/mongodb-ops.md)
|
||||
|
||||
## 搜索引擎数据库
|
||||
|
||||
### Elasticsearch
|
||||
|
||||
> Elasticsearch 是一个基于 Lucene 的搜索和数据分析工具,它提供了一个分布式服务。Elasticsearch 是遵从 Apache 开源条款的一款开源产品,是当前主流的企业级搜索引擎。
|
||||
|
||||
|
@ -97,32 +131,6 @@ TODO...
|
|||
- [Elasticsearch 运维](docs/nosql/elasticsearch/Elasticsearch运维.md)
|
||||
- [Elasticsearch 性能优化](docs/nosql/elasticsearch/Elasticsearch性能优化.md)
|
||||
|
||||
## [MongoDB](docs/nosql/mongodb)
|
||||
|
||||
> MongoDB 是一个基于文档的分布式数据库,由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。
|
||||
>
|
||||
> MongoDB 是一个介于关系型数据库和非关系型数据库之间的产品。它是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。
|
||||
>
|
||||
> MongoDB 最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
|
||||
|
||||
- [MongoDB 应用指南](docs/nosql/mongodb/mongodb-quickstart.md)
|
||||
- [MongoDB 聚合操作](docs/nosql/mongodb/mongodb-aggregation.md)
|
||||
- [MongoDB 建模](docs/nosql/mongodb/mongodb-model.md)
|
||||
- [MongoDB 建模示例](docs/nosql/mongodb/mongodb-model-example.md)
|
||||
- [MongoDB 索引](docs/nosql/mongodb/mongodb-index.md)
|
||||
- [MongoDB 复制](docs/nosql/mongodb/mongodb-replication.md)
|
||||
- [MongoDB 分片](docs/nosql/mongodb/mongodb-sharding.md)
|
||||
- [MongoDB 运维](docs/nosql/mongodb/mongodb-ops.md)
|
||||
|
||||
## HBase
|
||||
|
||||
> [HBase](https://dunwu.github.io/bigdata-tutorial/hbase) 📚 因为常用于大数据项目,所以将其文档和源码整理在 [bigdata-tutorial](https://dunwu.github.io/bigdata-tutorial/) 项目中。
|
||||
|
||||
- [HBase 原理](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase原理.md) ⚡
|
||||
- [HBase 命令](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase命令.md)
|
||||
- [HBase 应用](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase应用.md)
|
||||
- [HBase 运维](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase运维.md)
|
||||
|
||||
## 中间件
|
||||
|
||||
- [版本管理中间件 flyway](docs/middleware/flyway.md)
|
||||
|
@ -130,37 +138,135 @@ TODO...
|
|||
|
||||
## 资料 📚
|
||||
|
||||
### 综合
|
||||
### 数据库综合资料
|
||||
|
||||
- [DB-Engines](https://db-engines.com/en/ranking) - 数据库流行度排名
|
||||
- **书籍**
|
||||
- [《数据密集型应用系统设计》](https://book.douban.com/subject/30329536/) - 强力推荐【进阶】
|
||||
- **课程**
|
||||
- [《数据密集型应用系统设计》](https://book.douban.com/subject/30329536/) - 这可能是目前最好的分布式存储书籍,强力推荐【进阶】
|
||||
- **教程**
|
||||
- [CMU 15445 数据库基础课程](https://15445.courses.cs.cmu.edu/fall2019/schedule.html)
|
||||
- [CMU 15721 数据库高级课程](https://15721.courses.cs.cmu.edu/spring2020/schedule.html)
|
||||
- [检索技术核心 20 讲](https://time.geekbang.org/column/intro/100048401) - 极客教程【进阶】
|
||||
- [后端存储实战课](https://time.geekbang.org/column/intro/100046801) - 极客教程【进阶】
|
||||
- **论文**
|
||||
- [Efficiency in the Columbia Database Query Optimizer](https://15721.courses.cs.cmu.edu/spring2018/papers/15-optimizer1/xu-columbia-thesis1998.pdf)
|
||||
- [How Good Are Query Optimizers, Really?](http://www.vldb.org/pvldb/vol9/p204-leis.pdf)
|
||||
- [Architecture of a Database System](https://dsf.berkeley.edu/papers/fntdb07-architecture.pdf)
|
||||
- [Data Structures for Databases](https://www.cise.ufl.edu/~mschneid/Research/papers/HS05BoCh.pdf)
|
||||
- **文章**
|
||||
- [Data Structures and Algorithms for Big Databases](https://people.csail.mit.edu/bradley/BenderKuszmaul-tutorial-xldb12.pdf)
|
||||
|
||||
### Mysql 资料
|
||||
### 关系型数据库资料
|
||||
|
||||
- **综合资料**
|
||||
- [《数据库的索引设计与优化》](https://book.douban.com/subject/26419771/)
|
||||
- [《SQL 必知必会》](https://book.douban.com/subject/35167240/) - SQL 的基本概念和语法【入门】
|
||||
- **Oracle 资料**
|
||||
- [《Oracle Database 9i/10g/11g 编程艺术》](https://book.douban.com/subject/5402711/)
|
||||
|
||||
#### Mysql 资料
|
||||
|
||||
- **官方**
|
||||
- [Mysql 官网](https://www.mysql.com/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/refman/8.0/en/)
|
||||
- [Mysql 官方文档之命令行客户端](https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/)
|
||||
- **官方 PPT**
|
||||
- [How to Analyze and Tune MySQL Queries for Better Performance](https://www.mysql.com/cn/why-mysql/presentations/tune-mysql-queries-performance/)
|
||||
- [MySQL Performance Tuning 101](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-tuning101/)
|
||||
- [MySQL Performance Schema & Sys Schema](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-sys-schema/)
|
||||
- [MySQL Performance: Demystified Tuning & Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-tuning-best-practices/)
|
||||
- [MySQL Security Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-security-best-practices/)
|
||||
- [MySQL Cluster Deployment Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-cluster-deployment-best-practices/)
|
||||
- [MySQL High Availability with InnoDB Cluster](https://www.mysql.com/cn/why-mysql/presentations/mysql-high-availability-innodb-cluster/)
|
||||
- **书籍**
|
||||
- [《高性能 MySQL》](https://book.douban.com/subject/23008813/) - 经典,适合 DBA 或作为开发者的参考手册【进阶】
|
||||
- [《MySQL 必知必会》](https://book.douban.com/subject/3354490/) - Mysql的基本概念和语法【入门】
|
||||
- [《SQL必知必会》](https://book.douban.com/subject/35167240/) - SQL的基本概念和语法【入门】
|
||||
-
|
||||
- [《MySQL 技术内幕:InnoDB 存储引擎》](https://book.douban.com/subject/24708143/)
|
||||
- [《MySQL 必知必会》](https://book.douban.com/subject/3354490/) - Mysql 的基本概念和语法【入门】
|
||||
- **教程**
|
||||
- [runoob.com MySQL 教程](http://www.runoob.com/mysql/mysql-tutorial.html) - 入门级 SQL 教程
|
||||
- [mysql-tutorial](https://github.com/jaywcjlove/mysql-tutorial)
|
||||
- **文章**
|
||||
- [MySQL 索引背后的数据结构及算法原理](http://blog.codinglabs.org/articles/theory-of-mysql-index.html)
|
||||
- [Some study on database storage internals](https://medium.com/@kousiknath/data-structures-database-storage-internals-1f5ed3619d43)
|
||||
- [Sharding Pinterest: How we scaled our MySQL fleet](https://medium.com/@Pinterest_Engineering/sharding-pinterest-how-we-scaled-our-mysql-fleet-3f341e96ca6f)
|
||||
- [Guide to MySQL High Availability](https://www.mysql.com/cn/why-mysql/white-papers/mysql-guide-to-high-availability-solutions/)
|
||||
- [Choosing MySQL High Availability Solutions](https://dzone.com/articles/choosing-mysql-high-availability-solutions)
|
||||
- [High availability with MariaDB TX: The definitive guide](https://mariadb.com/sites/default/files/content/Whitepaper_High_availability_with_MariaDB-TX.pdf)
|
||||
- Mysql 相关经验
|
||||
- [Booking.com: Evolution of MySQL System Design](https://www.percona.com/live/mysql-conference-2015/sessions/bookingcom-evolution-mysql-system-design) ,Booking.com 的 MySQL 数据库使用的演化,其中有很多不错的经验分享,我相信也是很多公司会遇到的的问题。
|
||||
- [Tracking the Money - Scaling Financial Reporting at Airbnb](https://medium.com/airbnb-engineering/tracking-the-money-scaling-financial-reporting-at-airbnb-6d742b80f040) ,Airbnb 的数据库扩展的经验分享。
|
||||
- [Why Uber Engineering Switched from Postgres to MySQL](https://eng.uber.com/mysql-migration/) ,无意比较两个数据库谁好谁不好,推荐这篇 Uber 的长文,主要是想让你从中学习到一些经验和技术细节,这是一篇很不错的文章。
|
||||
- Mysql 集群复制
|
||||
- [Monitoring Delayed Replication, With A Focus On MySQL](https://engineering.imvu.com/2013/01/09/monitoring-delayed-replication-with-a-focus-on-mysql/)
|
||||
- [Mitigating replication lag and reducing read load with freno](https://githubengineering.com/mitigating-replication-lag-and-reducing-read-load-with-freno/)
|
||||
- [Better Parallel Replication for MySQL](https://medium.com/booking-com-infrastructure/better-parallel-replication-for-mysql-14e2d7857813)
|
||||
- [Evaluating MySQL Parallel Replication Part 2: Slave Group Commit](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-2-slave-group-commit-459026a141d2)
|
||||
- [Evaluating MySQL Parallel Replication Part 3: Benchmarks in Production](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-3-benchmarks-in-production-db5811058d74)
|
||||
- [Evaluating MySQL Parallel Replication Part 4: More Benchmarks in Production
|
||||
](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-4-more-benchmarks-in-production-49ee255043ab)
|
||||
- [Evaluating MySQL Parallel Replication Part 4, Annex: Under the Hood](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-4-annex-under-the-hood-eb456cf8b2fb)
|
||||
- Mysql 数据分区
|
||||
- [StackOverflow: MySQL sharding approaches?](https://stackoverflow.com/questions/5541421/mysql-sharding-approaches)
|
||||
- [Why you don’t want to shard](https://www.percona.com/blog/2009/08/06/why-you-dont-want-to-shard/)
|
||||
- [How to Scale Big Data Applications](https://www.percona.com/sites/default/files/presentations/How to Scale Big Data Applications.pdf)
|
||||
- [MySQL Sharding with ProxySQL](https://www.percona.com/blog/2016/08/30/mysql-sharding-with-proxysql/)
|
||||
- 各公司的 Mysql 数据分区经验分享
|
||||
- [MailChimp: Using Shards to Accommodate Millions of Users
|
||||
](https://devs.mailchimp.com/blog/using-shards-to-accommodate-millions-of-users/)
|
||||
- [Uber: Code Migration in Production: Rewriting the Sharding Layer of Uber’s Schemaless Datastore](https://eng.uber.com/schemaless-rewrite/)
|
||||
- [Sharding & IDs at Instagram](https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c)
|
||||
- [Airbnb: How We Partitioned Airbnb’s Main Database in Two Weeks](https://medium.com/airbnb-engineering/how-we-partitioned-airbnb-s-main-database-in-two-weeks-55f7e006ff21)
|
||||
- **更多资源**
|
||||
- [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn)
|
||||
- [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn) - MySQL 的资源列表
|
||||
|
||||
### Redis 资料
|
||||
### Nosql 数据库综合
|
||||
|
||||
- Martin Fowler 在 YouTube 上分享的 NoSQL 介绍 [Introduction To NoSQL](https://youtu.be/qI_g07C_Q5I), 以及他参与编写的 [NoSQL Distilled - NoSQL 精粹](https://book.douban.com/subject/25662138/),这本书才 100 多页,是本难得的关于 NoSQL 的书,很不错,非常易读。
|
||||
- [NoSQL Databases: a Survey and Decision Guidance](https://medium.com/baqend-blog/nosql-databases-a-survey-and-decision-guidance-ea7823a822d#.nhzop4d23),这篇文章可以带你自上而下地从 CAP 原理到开始了解 NoSQL 的种种技术,是一篇非常不错的文章。
|
||||
- [Distribution, Data, Deployment: Software Architecture Convergence in Big Data Systems](https://resources.sei.cmu.edu/asset_files/WhitePaper/2014_019_001_90915.pdf),这是卡内基·梅隆大学的一篇讲分布式大数据系统的论文。其中主要讨论了在大数据时代下的软件工程中的一些关键点,也说到了 NoSQL 数据库。
|
||||
- [No Relation: The Mixed Blessings of Non-Relational Databases](http://ianvarley.com/UT/MR/Varley_MastersReport_Full_2009-08-07.pdf),这篇论文虽然有点年代久远。但这篇论文是 HBase 的基础,你花上一点时间来读读,就可以了解到,对各种非关系型数据存储优缺点的一个很好的比较。
|
||||
- [NoSQL Data Modeling Techniques](https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/) ,NoSQL 建模技术。这篇文章我曾经翻译在了 CoolShell 上,标题为 [NoSQL 数据建模技术](https://coolshell.cn/articles/7270.htm),供你参考。
|
||||
- [MongoDB - Data Modeling Introduction](https://docs.mongodb.com/manual/core/data-modeling-introduction/) ,虽然这是 MongoDB 的数据建模介绍,但是其很多观点可以用于其它的 NoSQL 数据库。
|
||||
- [Firebase - Structure Your Database](https://firebase.google.com/docs/database/android/structure-data) ,Google 的 Firebase 数据库使用 JSON 建模的一些最佳实践。
|
||||
- 因为 CAP 原理,所以当你需要选择一个 NoSQL 数据库的时候,你应该看看这篇文档 [Visual Guide to NoSQL Systems](http://blog.nahurst.com/visual-guide-to-nosql-systems)。
|
||||
|
||||
选 SQL 还是 NoSQL,这里有两篇文章,值得你看看。
|
||||
|
||||
- [SQL vs. NoSQL Databases: What’s the Difference?](https://www.upwork.com/hiring/data/sql-vs-nosql-databases-whats-the-difference/)
|
||||
- [Salesforce: SQL or NoSQL](https://engineering.salesforce.com/sql-or-nosql-9eaf1d92545b)
|
||||
|
||||
### 列式数据库资料
|
||||
|
||||
#### Cassandra 资料
|
||||
|
||||
- 沃尔玛实验室有两篇文章值得一读。
|
||||
- [Avoid Pitfalls in Scaling Cassandra Cluster at Walmart](https://medium.com/walmartlabs/avoid-pitfalls-in-scaling-your-cassandra-cluster-lessons-and-remedies-a71ca01f8c04)
|
||||
- [Storing Images in Cassandra at Walmart](https://medium.com/walmartlabs/building-object-store-storing-images-in-cassandra-walmart-scale-a6b9c02af593)
|
||||
- [Yelp: How We Scaled Our Ad Analytics with Apache Cassandra](https://engineeringblog.yelp.com/2016/08/how-we-scaled-our-ad-analytics-with-cassandra.html) ,Yelp 的这篇博客也有一些相关的经验和教训。
|
||||
- [Discord: How Discord Stores Billions of Messages](https://blog.discordapp.com/how-discord-stores-billions-of-messages-7fa6ec7ee4c7) ,Discord 公司分享的一个如何存储十亿级消息的技术文章。
|
||||
- [Cassandra at Instagram](https://www.slideshare.net/DataStax/cassandra-at-instagram-2016) ,Instagram 的一个 PPT,其中介绍了 Instagram 中是怎么使用 Cassandra 的。
|
||||
- [Netflix: Benchmarking Cassandra Scalability on AWS - Over a million writes per second](https://medium.com/netflix-techblog/benchmarking-cassandra-scalability-on-aws-over-a-million-writes-per-second-39f45f066c9e) ,Netflix 公司在 AWS 上给 Cassandra 做的一个 Benchmark。
|
||||
|
||||
#### HBase 资料
|
||||
|
||||
- [Imgur Notification: From MySQL to HBASE](https://medium.com/imgur-engineering/imgur-notifications-from-mysql-to-hbase-9dba6fc44183)
|
||||
- [Pinterest: Improving HBase Backup Efficiency](https://medium.com/@Pinterest_Engineering/improving-hbase-backup-efficiency-at-pinterest-86159da4b954)
|
||||
- [IBM : Tuning HBase performance](https://www.ibm.com/support/knowledgecenter/en/SSPT3X_2.1.2/com.ibm.swg.im.infosphere.biginsights.analyze.doc/doc/bigsql_TuneHbase.html)
|
||||
- [HBase File Locality in HDFS](http://www.larsgeorge.com/2010/05/hbase-file-locality-in-hdfs.html)
|
||||
- [Apache Hadoop Goes Realtime at Facebook](http://borthakur.com/ftp/RealtimeHadoopSigmod2011.pdf)
|
||||
- [Storage Infrastructure Behind Facebook Messages: Using HBase at Scale](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.294.8459&rep=rep1&type=pdf)
|
||||
- [GitHub: Awesome HBase](https://github.com/rayokota/awesome-hbase)
|
||||
|
||||
针对于 HBase 有两本书你可以考虑一下。
|
||||
|
||||
- 首先,先推荐两本书,一本是偏实践的《[HBase 实战](https://book.douban.com/subject/25706541/)》,另一本是偏大而全的手册型的《[HBase 权威指南](https://book.douban.com/subject/10748460/)》。
|
||||
- 当然,你也可以看看官方的 [The Apache HBase™ Reference Guide](http://hbase.apache.org/0.94/book/book.html)
|
||||
- 另外两个列数据库:
|
||||
- [ClickHouse - Open Source Distributed Column Database at Yandex](https://clickhouse.yandex/)
|
||||
- [Scaling Redshift without Scaling Costs at GIPHY](https://engineering.giphy.com/scaling-redshift-without-scaling-costs/)
|
||||
|
||||
### KV 数据库资料
|
||||
|
||||
#### Redis 资料
|
||||
|
||||
- **官网**
|
||||
- [Redis 官网](https://redis.io/)
|
||||
|
@ -180,8 +286,24 @@ TODO...
|
|||
- [redisson 官方文档(英文)](https://github.com/redisson/redisson/wiki/Table-of-Content)
|
||||
- [CRUG | Redisson PRO vs. Jedis: Which Is Faster? 翻译](https://www.jianshu.com/p/82f0d5abb002)
|
||||
- [redis 分布锁 Redisson 性能测试](https://blog.csdn.net/everlasting_188/article/details/51073505)
|
||||
- **文章**
|
||||
- [Learn Redis the hard way (in production) at Trivago](http://tech.trivago.com/2017/01/25/learn-redis-the-hard-way-in-production/)
|
||||
- [Twitter: How Twitter Uses Redis To Scale - 105TB RAM, 39MM QPS, 10,000+ Instances](http://highscalability.com/blog/2014/9/8/how-twitter-uses-redis-to-scale-105tb-ram-39mm-qps-10000-ins.html)
|
||||
- [Slack: Scaling Slack’s Job Queue - Robustly Handling Billions of Tasks in Milliseconds Using Kafka and Redis](https://slack.engineering/scaling-slacks-job-queue-687222e9d100)
|
||||
- [GitHub: Moving persistent data out of Redis at GitHub](https://githubengineering.com/moving-persistent-data-out-of-redis/)
|
||||
- [Instagram: Storing Hundreds of Millions of Simple Key-Value Pairs in Redis](https://engineering.instagram.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c)
|
||||
- [Redis in Chat Architecture of Twitch (from 27:22)](https://www.infoq.com/presentations/twitch-pokemon)
|
||||
- [Deliveroo: Optimizing Session Key Storage in Redis](https://deliveroo.engineering/2016/10/07/optimising-session-key-storage.html)
|
||||
- [Deliveroo: Optimizing Redis Storage](https://deliveroo.engineering/2017/01/19/optimising-membership-queries.html)
|
||||
- [GitHub: Awesome Redis](https://github.com/JamzyWang/awesome-redis)
|
||||
|
||||
### MongoDB 资料
|
||||
### 文档数据库资料
|
||||
|
||||
- [Couchbase Ecosystem at LinkedIn](https://engineering.linkedin.com/blog/2017/12/couchbase-ecosystem-at-linkedin)
|
||||
- [SimpleDB at Zendesk](https://medium.com/zendesk-engineering/resurrecting-amazon-simpledb-9404034ec506)
|
||||
- [Data Points - What the Heck Are Document Databases?](https://msdn.microsoft.com/en-us/magazine/hh547103.aspx)
|
||||
|
||||
#### MongoDB 资料
|
||||
|
||||
- **官方**
|
||||
- [MongoDB 官网](https://www.mongodb.com/)
|
||||
|
@ -194,6 +316,60 @@ TODO...
|
|||
- [mongodb-json-files](https://github.com/ozlerhakan/mongodb-json-files)
|
||||
- **文章**
|
||||
- [Introduction to MongoDB](https://www.slideshare.net/mdirolf/introduction-to-mongodb)
|
||||
- [eBay: Building Mission-Critical Multi-Data Center Applications with MongoDB](https://www.mongodb.com/blog/post/ebay-building-mission-critical-multi-data-center-applications-with-mongodb)
|
||||
- [The AWS and MongoDB Infrastructure of Parse: Lessons Learned](https://medium.baqend.com/parse-is-gone-a-few-secrets-about-their-infrastructure-91b3ab2fcf71)
|
||||
- [Migrating Mountains of Mongo Data](https://medium.com/build-addepar/migrating-mountains-of-mongo-data-63e530539952)
|
||||
- **更多资源**
|
||||
- [Github: Awesome MongoDB](https://github.com/ramnes/awesome-mongodb)
|
||||
|
||||
### 搜索引擎数据库资料
|
||||
|
||||
#### ElasticSearch
|
||||
|
||||
- **官方**
|
||||
- [Elasticsearch 官网](https://www.elastic.co/cn/products/elasticsearch)
|
||||
- [Elasticsearch Github](https://github.com/elastic/elasticsearch)
|
||||
- [Elasticsearch 官方文档](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)
|
||||
- [Elasticsearch: The Definitive Guide](https://www.elastic.co/guide/en/elasticsearch/guide/master/index.html) - ElasticSearch 官方学习资料
|
||||
- **书籍**
|
||||
- [《Elasticsearch 实战》](https://book.douban.com/subject/30380439/)
|
||||
- **教程**
|
||||
- [ELK Stack 权威指南](https://github.com/chenryn/logstash-best-practice-cn)
|
||||
- [Elasticsearch 教程](https://www.knowledgedict.com/tutorial/elasticsearch-intro.html)
|
||||
- **文章**
|
||||
- [Elasticsearch+Logstash+Kibana 教程](https://www.cnblogs.com/xing901022/p/4704319.html)
|
||||
- [ELK(Elasticsearch、Logstash、Kibana)安装和配置](https://github.com/judasn/Linux-Tutorial/blob/master/ELK-Install-And-Settings.md)
|
||||
- **性能调优相关**的工程实践
|
||||
- [Elasticsearch Performance Tuning Practice at eBay](https://www.ebayinc.com/stories/blogs/tech/elasticsearch-performance-tuning-practice-at-ebay/)
|
||||
- [Elasticsearch at Kickstarter](https://kickstarter.engineering/elasticsearch-at-kickstarter-db3c487887fc)
|
||||
- [9 tips on ElasticSearch configuration for high performance](https://www.loggly.com/blog/nine-tips-configuring-elasticsearch-for-high-performance/)
|
||||
- [Elasticsearch In Production - Deployment Best Practices](https://medium.com/@abhidrona/elasticsearch-deployment-best-practices-d6c1323b25d7)
|
||||
- **更多资源**
|
||||
- [GitHub: Awesome ElasticSearch](https://github.com/dzharii/awesome-elasticsearch)
|
||||
|
||||
### 图数据库
|
||||
|
||||
- 首先是 IBM Devloperworks 上的两个简介性的 PPT。
|
||||
- [Intro to graph databases, Part 1, Graph databases and the CRUD operations](https://www.ibm.com/developerworks/library/cl-graph-database-1/cl-graph-database-1-pdf.pdf)
|
||||
- [Intro to graph databases, Part 2, Building a recommendation engine with a graph database](https://www.ibm.com/developerworks/library/cl-graph-database-2/cl-graph-database-2-pdf.pdf)
|
||||
- 然后是一本免费的电子书《[Graph Database](http://graphdatabases.com)》。
|
||||
- 接下来是一些图数据库的介绍文章。
|
||||
- [Handling Billions of Edges in a Graph Database](https://www.infoq.com/presentations/graph-database-scalability)
|
||||
- [Neo4j case studies with Walmart, eBay, AirBnB, NASA, etc](https://neo4j.com/customers/)
|
||||
- [FlockDB: Distributed Graph Database for Storing Adjacency Lists at Twitter](https://blog.twitter.com/engineering/en_us/a/2010/introducing-flockdb.html)
|
||||
- [JanusGraph: Scalable Graph Database backed by Google, IBM and Hortonworks](https://architecht.io/google-ibm-back-new-open-source-graph-database-project-janusgraph-1d74fb78db6b)
|
||||
- [Amazon Neptune](https://aws.amazon.com/neptune/)
|
||||
|
||||
### 时序数据库
|
||||
|
||||
- [What is Time-Series Data & Why We Need a Time-Series Database](https://blog.timescale.com/what-the-heck-is-time-series-data-and-why-do-i-need-a-time-series-database-dcf3b1b18563)
|
||||
- [Time Series Data: Why and How to Use a Relational Database instead of NoSQL](https://blog.timescale.com/time-series-data-why-and-how-to-use-a-relational-database-instead-of-nosql-d0cd6975e87c)
|
||||
- [Beringei: High-performance Time Series Storage Engine @Facebook](https://code.facebook.com/posts/952820474848503/beringei-a-high-performance-time-series-storage-engine/)
|
||||
- [Introducing Atlas: Netflix’s Primary Telemetry Platform @Netflix](https://medium.com/netflix-techblog/introducing-atlas-netflixs-primary-telemetry-platform-bd31f4d8ed9a)
|
||||
- [Building a Scalable Time Series Database on PostgreSQL](https://blog.timescale.com/when-boring-is-awesome-building-a-scalable-time-series-database-on-postgresql-2900ea453ee2)
|
||||
- [Scaling Time Series Data Storage - Part I @Netflix](https://medium.com/netflix-techblog/scaling-time-series-data-storage-part-i-ec2b6d44ba39)
|
||||
- [Design of a Cost Efficient Time Series Store for Big Data](https://medium.com/@leventov/design-of-a-cost-efficient-time-series-store-for-big-data-88c5dc41af8e)
|
||||
- [GitHub: Awesome Time-Series Database](https://github.com/xephonhq/awesome-time-series-database)
|
||||
|
||||
## 传送 🚪
|
||||
|
||||
|
|
Binary file not shown.
254
docs/README.md
254
docs/README.md
|
@ -64,7 +64,20 @@ TODO...
|
|||
- [SqLite 应用指南](sql/sqlite.md)
|
||||
- [PostgreSQL 应用指南](sql/postgresql.md)
|
||||
|
||||
## [Redis](nosql/redis)
|
||||
## 列式数据库
|
||||
|
||||
### HBase
|
||||
|
||||
> [HBase](https://dunwu.github.io/bigdata-tutorial/hbase) 📚 因为常用于大数据项目,所以将其文档和源码整理在 [bigdata-tutorial](https://dunwu.github.io/bigdata-tutorial/) 项目中。
|
||||
|
||||
- [HBase 原理](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase原理.md) ⚡
|
||||
- [HBase 命令](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase命令.md)
|
||||
- [HBase 应用](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase应用.md)
|
||||
- [HBase 运维](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase运维.md)
|
||||
|
||||
## KV 数据库
|
||||
|
||||
### Redis
|
||||
|
||||
![img](https://raw.githubusercontent.com/dunwu/images/dev/snap/20200713105627.png)
|
||||
|
||||
|
@ -78,7 +91,28 @@ TODO...
|
|||
- [Redis 实战](nosql/redis/redis-action.md) - 关键词:`缓存`、`分布式锁`、`布隆过滤器`
|
||||
- [Redis 运维](nosql/redis/redis-ops.md) 🔨 - 关键词:`安装`、`命令`、`集群`、`客户端`
|
||||
|
||||
## [Elasticsearch](nosql/elasticsearch)
|
||||
## 文档数据库
|
||||
|
||||
### MongoDB
|
||||
|
||||
> MongoDB 是一个基于文档的分布式数据库,由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。
|
||||
>
|
||||
> MongoDB 是一个介于关系型数据库和非关系型数据库之间的产品。它是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。
|
||||
>
|
||||
> MongoDB 最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
|
||||
|
||||
- [MongoDB 应用指南](nosql/mongodb/mongodb-quickstart.md)
|
||||
- [MongoDB 聚合操作](nosql/mongodb/mongodb-aggregation.md)
|
||||
- [MongoDB 建模](nosql/mongodb/mongodb-model.md)
|
||||
- [MongoDB 建模示例](nosql/mongodb/mongodb-model-example.md)
|
||||
- [MongoDB 索引](nosql/mongodb/mongodb-index.md)
|
||||
- [MongoDB 复制](nosql/mongodb/mongodb-replication.md)
|
||||
- [MongoDB 分片](nosql/mongodb/mongodb-sharding.md)
|
||||
- [MongoDB 运维](nosql/mongodb/mongodb-ops.md)
|
||||
|
||||
## 搜索引擎数据库
|
||||
|
||||
### Elasticsearch
|
||||
|
||||
> Elasticsearch 是一个基于 Lucene 的搜索和数据分析工具,它提供了一个分布式服务。Elasticsearch 是遵从 Apache 开源条款的一款开源产品,是当前主流的企业级搜索引擎。
|
||||
|
||||
|
@ -96,32 +130,6 @@ TODO...
|
|||
- [Elasticsearch 运维](nosql/elasticsearch/Elasticsearch运维.md)
|
||||
- [Elasticsearch 性能优化](nosql/elasticsearch/Elasticsearch性能优化.md)
|
||||
|
||||
## [MongoDB](nosql/mongodb)
|
||||
|
||||
> MongoDB 是一个基于文档的分布式数据库,由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。
|
||||
>
|
||||
> MongoDB 是一个介于关系型数据库和非关系型数据库之间的产品。它是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。
|
||||
>
|
||||
> MongoDB 最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
|
||||
|
||||
- [MongoDB 应用指南](nosql/mongodb/mongodb-quickstart.md)
|
||||
- [MongoDB 聚合操作](nosql/mongodb/mongodb-aggregation.md)
|
||||
- [MongoDB 建模](nosql/mongodb/mongodb-model.md)
|
||||
- [MongoDB 建模示例](nosql/mongodb/mongodb-model-example.md)
|
||||
- [MongoDB 索引](nosql/mongodb/mongodb-index.md)
|
||||
- [MongoDB 复制](nosql/mongodb/mongodb-replication.md)
|
||||
- [MongoDB 分片](nosql/mongodb/mongodb-sharding.md)
|
||||
- [MongoDB 运维](nosql/mongodb/mongodb-ops.md)
|
||||
|
||||
## HBase
|
||||
|
||||
> [HBase](https://dunwu.github.io/bigdata-tutorial/hbase) 📚 因为常用于大数据项目,所以将其文档和源码整理在 [bigdata-tutorial](https://dunwu.github.io/bigdata-tutorial/) 项目中。
|
||||
|
||||
- [HBase 原理](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase原理.md) ⚡
|
||||
- [HBase 命令](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase命令.md)
|
||||
- [HBase 应用](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase应用.md)
|
||||
- [HBase 运维](https://github.com/dunwu/bigdata-tutorial/blob/master/docs/hbase/HBase运维.md)
|
||||
|
||||
## 中间件
|
||||
|
||||
- [版本管理中间件 flyway](middleware/flyway.md)
|
||||
|
@ -129,37 +137,135 @@ TODO...
|
|||
|
||||
## 资料 📚
|
||||
|
||||
### 综合
|
||||
### 数据库综合资料
|
||||
|
||||
- [DB-Engines](https://db-engines.com/en/ranking) - 数据库流行度排名
|
||||
- **书籍**
|
||||
- [《数据密集型应用系统设计》](https://book.douban.com/subject/30329536/) - 强力推荐【进阶】
|
||||
- **课程**
|
||||
- [《数据密集型应用系统设计》](https://book.douban.com/subject/30329536/) - 这可能是目前最好的分布式存储书籍,强力推荐【进阶】
|
||||
- **教程**
|
||||
- [CMU 15445 数据库基础课程](https://15445.courses.cs.cmu.edu/fall2019/schedule.html)
|
||||
- [CMU 15721 数据库高级课程](https://15721.courses.cs.cmu.edu/spring2020/schedule.html)
|
||||
- [检索技术核心 20 讲](https://time.geekbang.org/column/intro/100048401) - 极客教程【进阶】
|
||||
- [后端存储实战课](https://time.geekbang.org/column/intro/100046801) - 极客教程【进阶】
|
||||
- **论文**
|
||||
- [Efficiency in the Columbia Database Query Optimizer](https://15721.courses.cs.cmu.edu/spring2018/papers/15-optimizer1/xu-columbia-thesis1998.pdf)
|
||||
- [How Good Are Query Optimizers, Really?](http://www.vldb.org/pvldb/vol9/p204-leis.pdf)
|
||||
- [Architecture of a Database System](https://dsf.berkeley.edu/papers/fntdb07-architecture.pdf)
|
||||
- [Data Structures for Databases](https://www.cise.ufl.edu/~mschneid/Research/papers/HS05BoCh.pdf)
|
||||
- **文章**
|
||||
- [Data Structures and Algorithms for Big Databases](https://people.csail.mit.edu/bradley/BenderKuszmaul-tutorial-xldb12.pdf)
|
||||
|
||||
### Mysql 资料
|
||||
### 关系型数据库资料
|
||||
|
||||
- **综合资料**
|
||||
- [《数据库的索引设计与优化》](https://book.douban.com/subject/26419771/)
|
||||
- [《SQL 必知必会》](https://book.douban.com/subject/35167240/) - SQL 的基本概念和语法【入门】
|
||||
- **Oracle 资料**
|
||||
- [《Oracle Database 9i/10g/11g 编程艺术》](https://book.douban.com/subject/5402711/)
|
||||
|
||||
#### Mysql 资料
|
||||
|
||||
- **官方**
|
||||
- [Mysql 官网](https://www.mysql.com/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/refman/8.0/en/)
|
||||
- [Mysql 官方文档之命令行客户端](https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/)
|
||||
- **官方 PPT**
|
||||
- [How to Analyze and Tune MySQL Queries for Better Performance](https://www.mysql.com/cn/why-mysql/presentations/tune-mysql-queries-performance/)
|
||||
- [MySQL Performance Tuning 101](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-tuning101/)
|
||||
- [MySQL Performance Schema & Sys Schema](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-sys-schema/)
|
||||
- [MySQL Performance: Demystified Tuning & Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-tuning-best-practices/)
|
||||
- [MySQL Security Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-security-best-practices/)
|
||||
- [MySQL Cluster Deployment Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-cluster-deployment-best-practices/)
|
||||
- [MySQL High Availability with InnoDB Cluster](https://www.mysql.com/cn/why-mysql/presentations/mysql-high-availability-innodb-cluster/)
|
||||
- **书籍**
|
||||
- [《高性能 MySQL》](https://book.douban.com/subject/23008813/) - 经典,适合 DBA 或作为开发者的参考手册【进阶】
|
||||
- [《MySQL 技术内幕:InnoDB 存储引擎》](https://book.douban.com/subject/24708143/)
|
||||
- [《MySQL 必知必会》](https://book.douban.com/subject/3354490/) - Mysql 的基本概念和语法【入门】
|
||||
- [《SQL 必知必会》](https://book.douban.com/subject/35167240/) - SQL 的基本概念和语法【入门】
|
||||
-
|
||||
- **教程**
|
||||
- [runoob.com MySQL 教程](http://www.runoob.com/mysql/mysql-tutorial.html) - 入门级 SQL 教程
|
||||
- [mysql-tutorial](https://github.com/jaywcjlove/mysql-tutorial)
|
||||
- **文章**
|
||||
- [MySQL 索引背后的数据结构及算法原理](http://blog.codinglabs.org/articles/theory-of-mysql-index.html)
|
||||
- [Some study on database storage internals](https://medium.com/@kousiknath/data-structures-database-storage-internals-1f5ed3619d43)
|
||||
- [Sharding Pinterest: How we scaled our MySQL fleet](https://medium.com/@Pinterest_Engineering/sharding-pinterest-how-we-scaled-our-mysql-fleet-3f341e96ca6f)
|
||||
- [Guide to MySQL High Availability](https://www.mysql.com/cn/why-mysql/white-papers/mysql-guide-to-high-availability-solutions/)
|
||||
- [Choosing MySQL High Availability Solutions](https://dzone.com/articles/choosing-mysql-high-availability-solutions)
|
||||
- [High availability with MariaDB TX: The definitive guide](https://mariadb.com/sites/default/files/content/Whitepaper_High_availability_with_MariaDB-TX.pdf)
|
||||
- Mysql 相关经验
|
||||
- [Booking.com: Evolution of MySQL System Design](https://www.percona.com/live/mysql-conference-2015/sessions/bookingcom-evolution-mysql-system-design) ,Booking.com 的 MySQL 数据库使用的演化,其中有很多不错的经验分享,我相信也是很多公司会遇到的的问题。
|
||||
- [Tracking the Money - Scaling Financial Reporting at Airbnb](https://medium.com/airbnb-engineering/tracking-the-money-scaling-financial-reporting-at-airbnb-6d742b80f040) ,Airbnb 的数据库扩展的经验分享。
|
||||
- [Why Uber Engineering Switched from Postgres to MySQL](https://eng.uber.com/mysql-migration/) ,无意比较两个数据库谁好谁不好,推荐这篇 Uber 的长文,主要是想让你从中学习到一些经验和技术细节,这是一篇很不错的文章。
|
||||
- Mysql 集群复制
|
||||
- [Monitoring Delayed Replication, With A Focus On MySQL](https://engineering.imvu.com/2013/01/09/monitoring-delayed-replication-with-a-focus-on-mysql/)
|
||||
- [Mitigating replication lag and reducing read load with freno](https://githubengineering.com/mitigating-replication-lag-and-reducing-read-load-with-freno/)
|
||||
- [Better Parallel Replication for MySQL](https://medium.com/booking-com-infrastructure/better-parallel-replication-for-mysql-14e2d7857813)
|
||||
- [Evaluating MySQL Parallel Replication Part 2: Slave Group Commit](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-2-slave-group-commit-459026a141d2)
|
||||
- [Evaluating MySQL Parallel Replication Part 3: Benchmarks in Production](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-3-benchmarks-in-production-db5811058d74)
|
||||
- [Evaluating MySQL Parallel Replication Part 4: More Benchmarks in Production
|
||||
](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-4-more-benchmarks-in-production-49ee255043ab)
|
||||
- [Evaluating MySQL Parallel Replication Part 4, Annex: Under the Hood](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-4-annex-under-the-hood-eb456cf8b2fb)
|
||||
- Mysql 数据分区
|
||||
- [StackOverflow: MySQL sharding approaches?](https://stackoverflow.com/questions/5541421/mysql-sharding-approaches)
|
||||
- [Why you don’t want to shard](https://www.percona.com/blog/2009/08/06/why-you-dont-want-to-shard/)
|
||||
- [How to Scale Big Data Applications](https://www.percona.com/sites/default/files/presentations/How to Scale Big Data Applications.pdf)
|
||||
- [MySQL Sharding with ProxySQL](https://www.percona.com/blog/2016/08/30/mysql-sharding-with-proxysql/)
|
||||
- 各公司的 Mysql 数据分区经验分享
|
||||
- [MailChimp: Using Shards to Accommodate Millions of Users
|
||||
](https://devs.mailchimp.com/blog/using-shards-to-accommodate-millions-of-users/)
|
||||
- [Uber: Code Migration in Production: Rewriting the Sharding Layer of Uber’s Schemaless Datastore](https://eng.uber.com/schemaless-rewrite/)
|
||||
- [Sharding & IDs at Instagram](https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c)
|
||||
- [Airbnb: How We Partitioned Airbnb’s Main Database in Two Weeks](https://medium.com/airbnb-engineering/how-we-partitioned-airbnb-s-main-database-in-two-weeks-55f7e006ff21)
|
||||
- **更多资源**
|
||||
- [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn)
|
||||
- [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn) - MySQL 的资源列表
|
||||
|
||||
### Redis 资料
|
||||
### Nosql 数据库综合
|
||||
|
||||
- Martin Fowler 在 YouTube 上分享的 NoSQL 介绍 [Introduction To NoSQL](https://youtu.be/qI_g07C_Q5I), 以及他参与编写的 [NoSQL Distilled - NoSQL 精粹](https://book.douban.com/subject/25662138/),这本书才 100 多页,是本难得的关于 NoSQL 的书,很不错,非常易读。
|
||||
- [NoSQL Databases: a Survey and Decision Guidance](https://medium.com/baqend-blog/nosql-databases-a-survey-and-decision-guidance-ea7823a822d#.nhzop4d23),这篇文章可以带你自上而下地从 CAP 原理到开始了解 NoSQL 的种种技术,是一篇非常不错的文章。
|
||||
- [Distribution, Data, Deployment: Software Architecture Convergence in Big Data Systems](https://resources.sei.cmu.edu/asset_files/WhitePaper/2014_019_001_90915.pdf),这是卡内基·梅隆大学的一篇讲分布式大数据系统的论文。其中主要讨论了在大数据时代下的软件工程中的一些关键点,也说到了 NoSQL 数据库。
|
||||
- [No Relation: The Mixed Blessings of Non-Relational Databases](http://ianvarley.com/UT/MR/Varley_MastersReport_Full_2009-08-07.pdf),这篇论文虽然有点年代久远。但这篇论文是 HBase 的基础,你花上一点时间来读读,就可以了解到,对各种非关系型数据存储优缺点的一个很好的比较。
|
||||
- [NoSQL Data Modeling Techniques](https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/) ,NoSQL 建模技术。这篇文章我曾经翻译在了 CoolShell 上,标题为 [NoSQL 数据建模技术](https://coolshell.cn/articles/7270.htm),供你参考。
|
||||
- [MongoDB - Data Modeling Introduction](https://docs.mongodb.com/manual/core/data-modeling-introduction/) ,虽然这是 MongoDB 的数据建模介绍,但是其很多观点可以用于其它的 NoSQL 数据库。
|
||||
- [Firebase - Structure Your Database](https://firebase.google.com/docs/database/android/structure-data) ,Google 的 Firebase 数据库使用 JSON 建模的一些最佳实践。
|
||||
- 因为 CAP 原理,所以当你需要选择一个 NoSQL 数据库的时候,你应该看看这篇文档 [Visual Guide to NoSQL Systems](http://blog.nahurst.com/visual-guide-to-nosql-systems)。
|
||||
|
||||
选 SQL 还是 NoSQL,这里有两篇文章,值得你看看。
|
||||
|
||||
- [SQL vs. NoSQL Databases: What’s the Difference?](https://www.upwork.com/hiring/data/sql-vs-nosql-databases-whats-the-difference/)
|
||||
- [Salesforce: SQL or NoSQL](https://engineering.salesforce.com/sql-or-nosql-9eaf1d92545b)
|
||||
|
||||
### 列式数据库资料
|
||||
|
||||
#### Cassandra 资料
|
||||
|
||||
- 沃尔玛实验室有两篇文章值得一读。
|
||||
- [Avoid Pitfalls in Scaling Cassandra Cluster at Walmart](https://medium.com/walmartlabs/avoid-pitfalls-in-scaling-your-cassandra-cluster-lessons-and-remedies-a71ca01f8c04)
|
||||
- [Storing Images in Cassandra at Walmart](https://medium.com/walmartlabs/building-object-store-storing-images-in-cassandra-walmart-scale-a6b9c02af593)
|
||||
- [Yelp: How We Scaled Our Ad Analytics with Apache Cassandra](https://engineeringblog.yelp.com/2016/08/how-we-scaled-our-ad-analytics-with-cassandra.html) ,Yelp 的这篇博客也有一些相关的经验和教训。
|
||||
- [Discord: How Discord Stores Billions of Messages](https://blog.discordapp.com/how-discord-stores-billions-of-messages-7fa6ec7ee4c7) ,Discord 公司分享的一个如何存储十亿级消息的技术文章。
|
||||
- [Cassandra at Instagram](https://www.slideshare.net/DataStax/cassandra-at-instagram-2016) ,Instagram 的一个 PPT,其中介绍了 Instagram 中是怎么使用 Cassandra 的。
|
||||
- [Netflix: Benchmarking Cassandra Scalability on AWS - Over a million writes per second](https://medium.com/netflix-techblog/benchmarking-cassandra-scalability-on-aws-over-a-million-writes-per-second-39f45f066c9e) ,Netflix 公司在 AWS 上给 Cassandra 做的一个 Benchmark。
|
||||
|
||||
#### HBase 资料
|
||||
|
||||
- [Imgur Notification: From MySQL to HBASE](https://medium.com/imgur-engineering/imgur-notifications-from-mysql-to-hbase-9dba6fc44183)
|
||||
- [Pinterest: Improving HBase Backup Efficiency](https://medium.com/@Pinterest_Engineering/improving-hbase-backup-efficiency-at-pinterest-86159da4b954)
|
||||
- [IBM : Tuning HBase performance](https://www.ibm.com/support/knowledgecenter/en/SSPT3X_2.1.2/com.ibm.swg.im.infosphere.biginsights.analyze.doc/doc/bigsql_TuneHbase.html)
|
||||
- [HBase File Locality in HDFS](http://www.larsgeorge.com/2010/05/hbase-file-locality-in-hdfs.html)
|
||||
- [Apache Hadoop Goes Realtime at Facebook](http://borthakur.com/ftp/RealtimeHadoopSigmod2011.pdf)
|
||||
- [Storage Infrastructure Behind Facebook Messages: Using HBase at Scale](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.294.8459&rep=rep1&type=pdf)
|
||||
- [GitHub: Awesome HBase](https://github.com/rayokota/awesome-hbase)
|
||||
|
||||
针对于 HBase 有两本书你可以考虑一下。
|
||||
|
||||
- 首先,先推荐两本书,一本是偏实践的《[HBase 实战](https://book.douban.com/subject/25706541/)》,另一本是偏大而全的手册型的《[HBase 权威指南](https://book.douban.com/subject/10748460/)》。
|
||||
- 当然,你也可以看看官方的 [The Apache HBase™ Reference Guide](http://hbase.apache.org/0.94/book/book.html)
|
||||
- 另外两个列数据库:
|
||||
- [ClickHouse - Open Source Distributed Column Database at Yandex](https://clickhouse.yandex/)
|
||||
- [Scaling Redshift without Scaling Costs at GIPHY](https://engineering.giphy.com/scaling-redshift-without-scaling-costs/)
|
||||
|
||||
### KV 数据库资料
|
||||
|
||||
#### Redis 资料
|
||||
|
||||
- **官网**
|
||||
- [Redis 官网](https://redis.io/)
|
||||
|
@ -179,8 +285,24 @@ TODO...
|
|||
- [redisson 官方文档(英文)](https://github.com/redisson/redisson/wiki/Table-of-Content)
|
||||
- [CRUG | Redisson PRO vs. Jedis: Which Is Faster? 翻译](https://www.jianshu.com/p/82f0d5abb002)
|
||||
- [redis 分布锁 Redisson 性能测试](https://blog.csdn.net/everlasting_188/article/details/51073505)
|
||||
- **文章**
|
||||
- [Learn Redis the hard way (in production) at Trivago](http://tech.trivago.com/2017/01/25/learn-redis-the-hard-way-in-production/)
|
||||
- [Twitter: How Twitter Uses Redis To Scale - 105TB RAM, 39MM QPS, 10,000+ Instances](http://highscalability.com/blog/2014/9/8/how-twitter-uses-redis-to-scale-105tb-ram-39mm-qps-10000-ins.html)
|
||||
- [Slack: Scaling Slack’s Job Queue - Robustly Handling Billions of Tasks in Milliseconds Using Kafka and Redis](https://slack.engineering/scaling-slacks-job-queue-687222e9d100)
|
||||
- [GitHub: Moving persistent data out of Redis at GitHub](https://githubengineering.com/moving-persistent-data-out-of-redis/)
|
||||
- [Instagram: Storing Hundreds of Millions of Simple Key-Value Pairs in Redis](https://engineering.instagram.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c)
|
||||
- [Redis in Chat Architecture of Twitch (from 27:22)](https://www.infoq.com/presentations/twitch-pokemon)
|
||||
- [Deliveroo: Optimizing Session Key Storage in Redis](https://deliveroo.engineering/2016/10/07/optimising-session-key-storage.html)
|
||||
- [Deliveroo: Optimizing Redis Storage](https://deliveroo.engineering/2017/01/19/optimising-membership-queries.html)
|
||||
- [GitHub: Awesome Redis](https://github.com/JamzyWang/awesome-redis)
|
||||
|
||||
### MongoDB 资料
|
||||
### 文档数据库资料
|
||||
|
||||
- [Couchbase Ecosystem at LinkedIn](https://engineering.linkedin.com/blog/2017/12/couchbase-ecosystem-at-linkedin)
|
||||
- [SimpleDB at Zendesk](https://medium.com/zendesk-engineering/resurrecting-amazon-simpledb-9404034ec506)
|
||||
- [Data Points - What the Heck Are Document Databases?](https://msdn.microsoft.com/en-us/magazine/hh547103.aspx)
|
||||
|
||||
#### MongoDB 资料
|
||||
|
||||
- **官方**
|
||||
- [MongoDB 官网](https://www.mongodb.com/)
|
||||
|
@ -193,6 +315,60 @@ TODO...
|
|||
- [mongodb-json-files](https://github.com/ozlerhakan/mongodb-json-files)
|
||||
- **文章**
|
||||
- [Introduction to MongoDB](https://www.slideshare.net/mdirolf/introduction-to-mongodb)
|
||||
- [eBay: Building Mission-Critical Multi-Data Center Applications with MongoDB](https://www.mongodb.com/blog/post/ebay-building-mission-critical-multi-data-center-applications-with-mongodb)
|
||||
- [The AWS and MongoDB Infrastructure of Parse: Lessons Learned](https://medium.baqend.com/parse-is-gone-a-few-secrets-about-their-infrastructure-91b3ab2fcf71)
|
||||
- [Migrating Mountains of Mongo Data](https://medium.com/build-addepar/migrating-mountains-of-mongo-data-63e530539952)
|
||||
- **更多资源**
|
||||
- [Github: Awesome MongoDB](https://github.com/ramnes/awesome-mongodb)
|
||||
|
||||
### 搜索引擎数据库资料
|
||||
|
||||
#### ElasticSearch
|
||||
|
||||
- **官方**
|
||||
- [Elasticsearch 官网](https://www.elastic.co/cn/products/elasticsearch)
|
||||
- [Elasticsearch Github](https://github.com/elastic/elasticsearch)
|
||||
- [Elasticsearch 官方文档](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)
|
||||
- [Elasticsearch: The Definitive Guide](https://www.elastic.co/guide/en/elasticsearch/guide/master/index.html) - ElasticSearch 官方学习资料
|
||||
- **书籍**
|
||||
- [《Elasticsearch 实战》](https://book.douban.com/subject/30380439/)
|
||||
- **教程**
|
||||
- [ELK Stack 权威指南](https://github.com/chenryn/logstash-best-practice-cn)
|
||||
- [Elasticsearch 教程](https://www.knowledgedict.com/tutorial/elasticsearch-intro.html)
|
||||
- **文章**
|
||||
- [Elasticsearch+Logstash+Kibana 教程](https://www.cnblogs.com/xing901022/p/4704319.html)
|
||||
- [ELK(Elasticsearch、Logstash、Kibana)安装和配置](https://github.com/judasn/Linux-Tutorial/blob/master/ELK-Install-And-Settings.md)
|
||||
- **性能调优相关**的工程实践
|
||||
- [Elasticsearch Performance Tuning Practice at eBay](https://www.ebayinc.com/stories/blogs/tech/elasticsearch-performance-tuning-practice-at-ebay/)
|
||||
- [Elasticsearch at Kickstarter](https://kickstarter.engineering/elasticsearch-at-kickstarter-db3c487887fc)
|
||||
- [9 tips on ElasticSearch configuration for high performance](https://www.loggly.com/blog/nine-tips-configuring-elasticsearch-for-high-performance/)
|
||||
- [Elasticsearch In Production - Deployment Best Practices](https://medium.com/@abhidrona/elasticsearch-deployment-best-practices-d6c1323b25d7)
|
||||
- **更多资源**
|
||||
- [GitHub: Awesome ElasticSearch](https://github.com/dzharii/awesome-elasticsearch)
|
||||
|
||||
### 图数据库
|
||||
|
||||
- 首先是 IBM Devloperworks 上的两个简介性的 PPT。
|
||||
- [Intro to graph databases, Part 1, Graph databases and the CRUD operations](https://www.ibm.com/developerworks/library/cl-graph-database-1/cl-graph-database-1-pdf.pdf)
|
||||
- [Intro to graph databases, Part 2, Building a recommendation engine with a graph database](https://www.ibm.com/developerworks/library/cl-graph-database-2/cl-graph-database-2-pdf.pdf)
|
||||
- 然后是一本免费的电子书《[Graph Database](http://graphdatabases.com)》。
|
||||
- 接下来是一些图数据库的介绍文章。
|
||||
- [Handling Billions of Edges in a Graph Database](https://www.infoq.com/presentations/graph-database-scalability)
|
||||
- [Neo4j case studies with Walmart, eBay, AirBnB, NASA, etc](https://neo4j.com/customers/)
|
||||
- [FlockDB: Distributed Graph Database for Storing Adjacency Lists at Twitter](https://blog.twitter.com/engineering/en_us/a/2010/introducing-flockdb.html)
|
||||
- [JanusGraph: Scalable Graph Database backed by Google, IBM and Hortonworks](https://architecht.io/google-ibm-back-new-open-source-graph-database-project-janusgraph-1d74fb78db6b)
|
||||
- [Amazon Neptune](https://aws.amazon.com/neptune/)
|
||||
|
||||
### 时序数据库
|
||||
|
||||
- [What is Time-Series Data & Why We Need a Time-Series Database](https://blog.timescale.com/what-the-heck-is-time-series-data-and-why-do-i-need-a-time-series-database-dcf3b1b18563)
|
||||
- [Time Series Data: Why and How to Use a Relational Database instead of NoSQL](https://blog.timescale.com/time-series-data-why-and-how-to-use-a-relational-database-instead-of-nosql-d0cd6975e87c)
|
||||
- [Beringei: High-performance Time Series Storage Engine @Facebook](https://code.facebook.com/posts/952820474848503/beringei-a-high-performance-time-series-storage-engine/)
|
||||
- [Introducing Atlas: Netflix’s Primary Telemetry Platform @Netflix](https://medium.com/netflix-techblog/introducing-atlas-netflixs-primary-telemetry-platform-bd31f4d8ed9a)
|
||||
- [Building a Scalable Time Series Database on PostgreSQL](https://blog.timescale.com/when-boring-is-awesome-building-a-scalable-time-series-database-on-postgresql-2900ea453ee2)
|
||||
- [Scaling Time Series Data Storage - Part I @Netflix](https://medium.com/netflix-techblog/scaling-time-series-data-storage-part-i-ec2b6d44ba39)
|
||||
- [Design of a Cost Efficient Time Series Store for Big Data](https://medium.com/@leventov/design-of-a-cost-efficient-time-series-store-for-big-data-88c5dc41af8e)
|
||||
- [GitHub: Awesome Time-Series Database](https://github.com/xephonhq/awesome-time-series-database)
|
||||
|
||||
## 传送 🚪
|
||||
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
# 数据结构在数据库中的应用
|
||||
|
||||
> 关键词:链表、数组、散列表、红黑树、B+ 树、LSM 树、跳表
|
||||
|
||||
## 引言
|
||||
|
||||
从本质来看,数据库只负责两件事:读数据、写数据。
|
||||
|
||||
数据结构的核心就是合理组织数据,尽可能提升读、写数据的效率。
|
||||
|
||||
所以,数据结构是实现数据库的基石。
|
||||
|
||||
## 索引
|
||||
|
||||
索引是基于原始数据衍生的扩展数据结构。它的主要作用是缩小检索的数据范围,提升查询性能。
|
||||
|
||||
很多数据库允许单独添加和删除索引,而不影响数据库的内容,它只会影响查询性能。维护额外的结构势必会引入开销,特别是在新数据写入时。对于写人,它很难超过简单地追加文件方式的性能,因为那已经是最简单的写操作了。由于每次写数据时,需要更新索引,因此任何类型的索引通常都会降低写的速度。
|
||||
|
||||
### 数组和链表
|
||||
|
||||
数组和链表分别代表了连续空间和不连续空间的存储方式,它们是线性表(Linear List)的典型代表。其他所有的数据结构,比如栈、队列、二叉树、B+ 树等,实际上都是这两者的结合和变化。
|
||||
|
||||
数组**支持随机访问**。根据下标随机访问的时间复杂度为 `O(1)`。但这并不代表数组的查找时间复杂度也是 `O(1)`。
|
||||
|
||||
- 对于无序数组,只能顺序查找,其时间复杂度为 `O(n)`。
|
||||
- 对于有序数组,可以应用二分查找法,其时间复杂度为 `O(log n)`。
|
||||
|
||||
在有序数组上应用二分查找法如此高效,为什么几乎没有数据库直接使用数组作为索引?这是因为它的限制条件:数据有序。为了保证数据有序,每次添加、删除数组数据时,都必须要进行数据调整,来保证其有序。此外,由于数组空间大小固定,每次扩容只能采用复制数组的方式。数组的这些特性,决定了它不适合用于数据频繁变化的应用场景。
|
||||
|
||||
### 散列表
|
||||
|
||||
散列表的思路是:使用 Hash 函数将 Key 转换为数组下标。
|
||||
|
||||
哈希表的本质是一个数组,它通过 Hash 函数将查询的 Key 转为数组下标,利用数组的随机访问特性,使得我们能在 `O(1)` 的时间代价内完成检索。
|
||||
|
||||
#### 位图和布隆过滤器
|
||||
|
||||
在海量数据中,快速判断一个对象是否存在。相比于有序数组、二叉检索树和哈希表这三种方案,位图和布隆过滤器其实更适合解决这类状态检索的问题。这是因为,在不要求 100% 判断正确的情况下,使用位图和布隆过滤器可以达到 `O(1)` 时间代价的检索效率,同时空间使用率也非常高效。
|
||||
|
||||
为了判断一个很大的数据范围中,某数值是否存在,可以将这个范围的数据存为数组,其数组值为布尔型(true 或 false)。由于很多语言中,布尔类型需要 1 个字节,而二进制位(bit)的值 0 或 1 也可以表示 true 或 false,并且占用空间更小,所以更加合适。而这种基于位运算的哈希结构,即为位图。
|
||||
|
||||
布隆过滤器最大的特点,就是对一个对象使用多个哈希函数。如果我们使用了 k 个哈希函数,就会得到 k 个哈希值,也就是 k 个下标,我们会把数组中对应下标位置的值都置为 1。布隆过滤器和位图最大的区别就在于,我们不再使用一位来表示一个对象,而是使用 k 位来表示一个对象。这样两个对象的 k 位都相同的概率就会大大降低,从而能够解决哈希冲突的问题了。
|
||||
|
||||
布隆过滤器的误判有一个特点,那就是,它只会对存在的情况有误判。如果某个数字经过布隆过滤器判断不存在,那说明这个数字真的不存在,不会发生误判;如果某个数字经过布隆过滤器判断存在,这个时候才会有可能误判,有可能并不存在。不过,只要我们调整哈希函数的个数、位图大小跟要存储数字的个数之间的比例,那就可以将这种误判的概率降到非常低。
|
||||
|
||||
布隆过滤器过滤器适用于对误判有一定容忍度的场景。
|
||||
|
||||
### B+ 树
|
||||
|
||||
内存是半导体元件。对于内存而言,只要给出了内存地址,我们就可以直接访问该地址取出数据。这个过程具有高效的随机访问特性,因此内存也叫随机访问存储器(Random Access Memory,即 RAM)。内存的访问速度很快,但是价格相对较昂贵,因此一般的计算机内存空间都相对较小。
|
||||
|
||||
而磁盘是机械器件。磁盘访问数据时,需要等磁盘盘片旋转到磁头下,才能读取相应的数据。尽管磁盘的旋转速度很快,但是和内存的随机访问相比,性能差距非常大。一般来说,如果是随机读写,会有 10 万到 100 万倍左右的差距。但如果是顺序访问大批量数据的话,磁盘的性能和内存就是一个数量级的。
|
||||
|
||||
磁盘的最小读写单位是扇区,较早期的磁盘一个扇区是 **`512`** 字节。随着磁盘技术的发展,目前常见的磁盘扇区是 **`4K`** 个字节。操作系统一次会读写多个扇区,所以操作系统的最小读写单位是块(Block),也叫作簇(Cluster)。当我们要从磁盘中读取一个数据时,操作系统会一次性将整个块都读出来。因此,对于大批量的顺序读写来说,磁盘的效率会比随机读写高许多。
|
||||
|
||||
假设有一个有序数组存储在硬盘中,如果它足够大,那么它会存储在多个块中。当我们要对这个数组使用二分查找时,需要先找到中间元素所在的块,将这个块从磁盘中读到内存里,然后在内存中进行二分查找。如果下一步要读的元素在其他块中,则需要再将相应块从磁盘中读入内存。直到查询结束,这个过程可能会多次访问磁盘。我们可以看到,这样的检索性能非常低。
|
||||
|
||||
由于磁盘相对于内存而言访问速度实在太慢,因此,对于磁盘上数据的高效检索,我们有一个极其重要的原则:对磁盘的访问次数要尽可能的少!
|
||||
|
||||
将索引和数据分离就是一种常见的设计思路。在数据频繁变化的场景中,有序数组并不是一个最好的选择,二叉检索树或者哈希表往往更有普适性。但是,哈希表由于缺乏范围检索的能力,在一些场合也不适用。因此,二叉检索树这种树形结构是许多常见检索系统的实施方案。
|
||||
|
||||
随着索引数据越来越大,直到无法完全加载到内存中,这是需要将索引数据也存入磁盘中。B+ 树给出了将树形索引的所有节点都存在磁盘上的高效检索方案。操作系统对磁盘数据的访问是以块为单位的。因此,如果我们想将树型索引的一个节点从磁盘中读出,即使该节点的数据量很小(比如说只有几个字节),但磁盘依然会将整个块的数据全部读出来,而不是只读这一小部分数据,这会让有效读取效率很低。B+ 树的一个关键设计,就是让一个节点的大小等于一个块的大小。节点内存储的数据,不是一个元素,而是一个可以装 m 个元素的有序数组。这样一来,我们就可以将磁盘一次读取的数据全部利用起来,使得读取效率最大化。
|
||||
|
||||
B+ 树还有另一个设计,就是将所有的节点分为内部节点和叶子节点。内部节点仅存储 key 和维持树形结构的指针,并不存储 key 对应的数据(无论是具体数据还是文件位置信息)。这样内部节点就能存储更多的索引数据,我们也就可以使用最少的内部节点,将所有数据组织起来了。而叶子节点仅存储 key 和对应数据,不存储维持树形结构的指针。通过这样的设计,B+ 树就能做到节点的空间利用率最大化。此外,B+ 树还将同一层的所有节点串成了有序的双向链表,这样一来,B+ 树就同时具备了良好的范围查询能力和灵活调整的能力了。
|
||||
|
||||
因此,B+ 树是一棵完全平衡的 m 阶多叉树。所谓的 m 阶,指的是每个节点最多有 m 个子节点,并且每个节点里都存了一个紧凑的可包含 m 个元素的数组。
|
||||
|
||||
即使是复杂的 B+ 树,我们将它拆解开来,其实也是由简单的数组、链表和树组成的,而且 B+ 树的检索过程其实也是二分查找。因此,如果 B+ 树完全加载在内存中的话,它的检索效率其实并不会比有序数组或者二叉检索树更
|
||||
高,也还是二分查找的 log(n) 的效率。并且,它还比数组和二叉检索树更加复杂,还会带来额外的开销。
|
||||
|
||||
另外,这一节还有一个很重要的设计思想需要你掌握,那就是将索引和数据分离。通过这样的方式,我们能将索引的数组大小保持在一个较小的范围内,让它能加载在内存中。在许多大规模系统中,都是使用这个设计思想来精简索引的。而且,B+ 树的内部节点和叶子节点的区分,其实也是索引和数据分离的一次实践。
|
||||
|
||||
MySQL 中的 B+ 树实现其实有两种,一种是 MyISAM 引擎,另一种是 InnoDB 引擎。它们的核心区别就在于,数据和索引是否是分离的。
|
||||
|
||||
在 MyISAM 引擎中,B+ 树的叶子节点仅存储了数据的位置指针,这是一种索引和数据分离的设计方案,叫作非聚集索引。如果要保证 MyISAM 的数据一致性,那我们需要在表级别上进行加锁处理。
|
||||
|
||||
在 InnoDB 中,B+ 树的叶子节点直接存储了具体数据,这是一种索引和数据一体的方案。叫作聚集索引。由于数据直接就存在索引的叶子节点中,因此 InnoDB 不需要给全表加锁来保证一致性,它只需要支持行级的锁就可以了。
|
||||
|
||||
### LSM 树
|
||||
|
||||
B+ 树的数据都存储在叶子节点中,而叶子节点一般都存储在磁盘中。因此,每次插入的新数据都需要随机写入磁盘,而随机写入的性能非常慢。如果是一个日志系统,每秒钟要写入上千条甚至上万条数据,这样的磁盘操作代价会使得系统性能急剧下降,甚至无法使用。
|
||||
|
||||
操作系统对磁盘的读写是以块为单位的,我们能否以块为单位写入,而不是每次插入一个数据都要随机写入磁盘呢?这样是不是就可以大幅度减少写入操作了呢?解决方案就是:**LSM 树**(Log Structured Merge Trees)。
|
||||
|
||||
LSM 树就是根据这个思路设计了这样一个机制:当数据写入时,延迟写磁盘,将数据先存放在内存中的树里,进行常规的存储和查询。当内存中的树持续变大达到阈值时,再批量地以块为单位写入磁盘的树中。因此,LSM 树至少需要由两棵树组成,一棵是存储在内存中较小的 C0 树,另一棵是存储在磁盘中较大的 C1 树。
|
||||
|
||||
LSM 树具有以下 3 个特点:
|
||||
|
||||
1. 将索引分为内存和磁盘两部分,并在内存达到阈值时启动树合并(Merge Trees);
|
||||
2. 用批量写入代替随机写入,并且用预写日志 WAL 技术(Write AheadLog,预写日志技术)保证内存数据,在系统崩溃后可以被恢复;
|
||||
3. 数据采取类似日志追加写的方式写入(Log Structured)磁盘,以顺序写的方式提高写
|
||||
入效率。
|
||||
|
||||
LSM 树的这些特点,使得它相对于 B+ 树,在写入性能上有大幅提升。所以,许多 NoSQL 系统都使用 LSM 树作为检索引擎,而且还对 LSM 树进行了优化以提升检索性能。
|
||||
|
||||
### 倒排索引
|
||||
|
||||
倒排索引的核心其实并不复杂,它的具体实现其实是哈希表,只是它不是将文档 ID 或者题目作为 key,而是反过来,通过将内容或者属性作为 key 来存储对应的文档列表,使得我们能在 O(1) 的时间代价内完成查询。
|
||||
|
||||
尽管原理并不复杂,但是倒排索引是许多检索引擎的核心。比如说,数据库的全文索引功能、搜索引擎的索引、广告引擎和推荐引擎,都使用了倒排索引技术来实现检索功能。
|
||||
|
||||
### 索引的维护
|
||||
|
||||
#### 创建索引
|
||||
|
||||
- **数据压缩**:一个是尽可能地将数据加载到内存中,因为内存的检索效率大大高于磁盘。那为了将数据更多地加载到内存中,索引压缩是一个重要的研究方向。
|
||||
- **分支处理**:另一个是将大数据集合拆成多个小数据集合来处理。这其实就是分布式系统的核心思想。
|
||||
|
||||
#### 更新索引
|
||||
|
||||
(1)Double Buffer(双缓冲)机制
|
||||
|
||||
就是在内存中同时保存两份一样的索引,一个是索引 A,一个是索引 B。两个索引保持一个读、一个写,并且来回切换,最终完成高性能的索引更新。
|
||||
|
||||
优点:简单高效
|
||||
|
||||
缺点:达到一定数据量级后,会带来翻倍的内存开销,甚至有些索引存储在磁盘上的情况下,更是无法使用此机制。
|
||||
|
||||
(2)全量索引和增量索引
|
||||
|
||||
将新接收到的数据单独建立一个可以存在内存中的倒排索引,也就是增量索引。当查询发生的时候,我们会同时查询全量索引和增量索引,将合并的结果作为总的结果输出。
|
||||
|
||||
因为增量索引相对全量索引而言会小很多,内存资源消耗在可承受范围,所以我们可以使用 Double Buffer 机制
|
||||
对增量索引进行索引更新。这样一来,增量索引就可以做到无锁访问。而全量索引本身就是只读的,也不需要加锁。因此,整个检索过程都可以做到无锁访问,也就提高了系统的检索效率。
|
||||
|
||||
## 参考资料
|
||||
|
||||
- **书籍**
|
||||
- [《数据密集型应用系统设计》](https://book.douban.com/subject/30329536/)
|
||||
- **教程**
|
||||
- [数据结构与算法之美](https://time.geekbang.org/column/intro/100017301)
|
||||
- [检索技术核心 20 讲](https://time.geekbang.org/column/intro/100048401)
|
||||
- **论文**
|
||||
- [Data Structures for Databases](https://www.cise.ufl.edu/~mschneid/Research/papers/HS05BoCh.pdf)
|
||||
- **文章**
|
||||
- [Data Structures and Algorithms for Big Databases](https://people.csail.mit.edu/bradley/BenderKuszmaul-tutorial-xldb12.pdf)
|
|
@ -1,97 +0,0 @@
|
|||
# Nosql 数据库
|
||||
|
||||
## 📖 内容
|
||||
|
||||
### 列式数据库
|
||||
|
||||
#### [HBase](hbase.md)
|
||||
|
||||
### K-V 数据库
|
||||
|
||||
#### [Redis](redis/README.md)
|
||||
|
||||
#### [Cassandra](cassandra.md)
|
||||
|
||||
### 文档数据库
|
||||
|
||||
#### [MongoDB](mongodb)
|
||||
|
||||
### 搜索引擎数据库
|
||||
|
||||
#### [Elasticsearch](elasticsearch) 📚
|
||||
|
||||
> Elasticsearch 是一个基于 Lucene 的搜索和数据分析工具,它提供了一个分布式服务。Elasticsearch 是遵从 Apache 开源条款的一款开源产品,是当前主流的企业级搜索引擎。
|
||||
|
||||
- [Elasticsearch 面试总结](elasticsearch/elasticsearch-interview.md) 💯
|
||||
- [Elasticsearch 快速入门](elasticsearch/Elasticsearch快速入门.md)
|
||||
- [Elasticsearch 简介](elasticsearch/Elasticsearch简介.md)
|
||||
- [Elasticsearch Rest API](elasticsearch/ElasticsearchRestApi.md)
|
||||
- [ElasticSearch Java API 之 High Level REST Client](elasticsearch/ElasticsearchHighLevelRestJavaApi.md)
|
||||
- [Elasticsearch 索引管理](elasticsearch/Elasticsearch索引管理.md)
|
||||
- [Elasticsearch 查询](elasticsearch/Elasticsearch查询.md)
|
||||
- [Elasticsearch 高亮](elasticsearch/Elasticsearch高亮.md)
|
||||
- [Elasticsearch 排序](elasticsearch/Elasticsearch排序.md)
|
||||
- [Elasticsearch 聚合](elasticsearch/Elasticsearch聚合.md)
|
||||
- [Elasticsearch 分析器](elasticsearch/Elasticsearch分析器.md)
|
||||
- [Elasticsearch 运维](elasticsearch/Elasticsearch运维.md)
|
||||
- [Elasticsearch 性能优化](elasticsearch/Elasticsearch性能优化.md)
|
||||
|
||||
### 图数据库
|
||||
|
||||
TODO: 待补充
|
||||
|
||||
## 📚 资料
|
||||
|
||||
### Mysql 资料
|
||||
|
||||
- **官方**
|
||||
- [Mysql 官网](https://www.mysql.com/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/refman/8.0/en/)
|
||||
- [Mysql 官方文档之命令行客户端](https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
|
||||
- **书籍**
|
||||
- [《高性能 MySQL》](https://book.douban.com/subject/23008813/) - 经典,适合 DBA 或作为开发者的参考手册
|
||||
- [《MySQL 必知必会》](https://book.douban.com/subject/3354490/) - 适合入门者
|
||||
- **教程**
|
||||
- [runoob.com MySQL 教程](http://www.runoob.com/mysql/mysql-tutorial.html) - 入门级 SQL 教程
|
||||
- [mysql-tutorial](https://github.com/jaywcjlove/mysql-tutorial)
|
||||
- **更多资源**
|
||||
- [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn)
|
||||
|
||||
### Redis 资料
|
||||
|
||||
- **官网**
|
||||
- [Redis 官网](https://redis.io/)
|
||||
- [Redis github](https://github.com/antirez/redis)
|
||||
- [Redis 官方文档中文版](http://redis.cn/)
|
||||
- [Redis 命令参考](http://redisdoc.com/)
|
||||
- **书籍**
|
||||
- [《Redis 实战》](https://item.jd.com/11791607.html)
|
||||
- [《Redis 设计与实现》](https://item.jd.com/11486101.html)
|
||||
- **源码**
|
||||
- [《Redis 实战》配套 Python 源码](https://github.com/josiahcarlson/redis-in-action)
|
||||
- **资源汇总**
|
||||
- [awesome-redis](https://github.com/JamzyWang/awesome-redis)
|
||||
- **Redis Client**
|
||||
- [spring-data-redis 官方文档](https://docs.spring.io/spring-data/redis/docs/1.8.13.RELEASE/reference/html/)
|
||||
- [redisson 官方文档(中文,略有滞后)](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95)
|
||||
- [redisson 官方文档(英文)](https://github.com/redisson/redisson/wiki/Table-of-Content)
|
||||
- [CRUG | Redisson PRO vs. Jedis: Which Is Faster? 翻译](https://www.jianshu.com/p/82f0d5abb002)
|
||||
- [redis 分布锁 Redisson 性能测试](https://blog.csdn.net/everlasting_188/article/details/51073505)
|
||||
|
||||
### MongoDB 资料
|
||||
|
||||
- **官方**
|
||||
- [MongoDB 官网](https://www.mongodb.com/)
|
||||
- [MongoDB Github](https://github.com/mongodb/mongo)
|
||||
- [MongoDB 官方免费教程](https://university.mongodb.com/)
|
||||
- **教程**
|
||||
- [MongoDB 教程](https://www.runoob.com/mongodb/mongodb-tutorial.html)
|
||||
- [MongoDB 高手课](https://time.geekbang.org/course/intro/100040001)
|
||||
- **数据**
|
||||
- [mongodb-json-files](https://github.com/ozlerhakan/mongodb-json-files)
|
||||
- **文章**
|
||||
- [Introduction to MongoDB](https://www.slideshare.net/mdirolf/introduction-to-mongodb)
|
||||
|
||||
## 🚪 传送
|
||||
|
||||
◾ 🏠 [DB-TUTORIAL 首页](https://github.com/dunwu/db-tutorial) ◾ 🎯 [我的博客](https://github.com/dunwu/blog) ◾
|
|
@ -54,10 +54,32 @@
|
|||
|
||||
## 📚 资料
|
||||
|
||||
### Elasticsearch 资料
|
||||
|
||||
- **官方**
|
||||
- [Elasticsearch 官网](https://www.elastic.co/cn/products/elasticsearch)
|
||||
- [Elasticsearch Github](https://github.com/elastic/elasticsearch)
|
||||
- [Elasticsearch 官方文档](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)
|
||||
- [Elasticsearch: The Definitive Guide](https://www.elastic.co/guide/en/elasticsearch/guide/master/index.html) - ElasticSearch 官方学习资料
|
||||
- **书籍**
|
||||
- [《Elasticsearch 实战》](https://book.douban.com/subject/30380439/)
|
||||
- **教程**
|
||||
- [ELK Stack 权威指南](https://github.com/chenryn/logstash-best-practice-cn)
|
||||
- [Elasticsearch 教程](https://www.knowledgedict.com/tutorial/elasticsearch-intro.html)
|
||||
- **文章**
|
||||
- [Elasticsearch+Logstash+Kibana 教程](https://www.cnblogs.com/xing901022/p/4704319.html)
|
||||
- [ELK(Elasticsearch、Logstash、Kibana)安装和配置](https://github.com/judasn/Linux-Tutorial/blob/master/ELK-Install-And-Settings.md)
|
||||
- **性能调优相关**的工程实践
|
||||
- [Elasticsearch Performance Tuning Practice at eBay](https://www.ebayinc.com/stories/blogs/tech/elasticsearch-performance-tuning-practice-at-ebay/)
|
||||
- [Elasticsearch at Kickstarter](https://kickstarter.engineering/elasticsearch-at-kickstarter-db3c487887fc)
|
||||
- [9 tips on ElasticSearch configuration for high performance](https://www.loggly.com/blog/nine-tips-configuring-elasticsearch-for-high-performance/)
|
||||
- [Elasticsearch In Production - Deployment Best Practices](https://medium.com/@abhidrona/elasticsearch-deployment-best-practices-d6c1323b25d7)
|
||||
- **更多资源**
|
||||
- [GitHub: Awesome ElasticSearch](https://github.com/dzharii/awesome-elasticsearch)
|
||||
|
||||
### Elastic 技术栈资料
|
||||
|
||||
- **官方**
|
||||
- [Logstash 官网](https://www.elastic.co/cn/products/logstash)
|
||||
- [Logstash Github](https://github.com/elastic/logstash)
|
||||
- [Logstash 官方文档](https://www.elastic.co/guide/en/logstash/current/index.html)
|
||||
|
@ -67,15 +89,9 @@
|
|||
- [Beats 官网](https://www.elastic.co/cn/products/beats)
|
||||
- [Beats Github](https://github.com/elastic/beats)
|
||||
- [Beats 官方文档](https://www.elastic.co/guide/en/beats/libbeat/current/index.html)
|
||||
- **官方**
|
||||
- [《Elasticsearch 实战》](https://item.jd.com/12454556.html)
|
||||
- **第三方工具**
|
||||
- [logstash-logback-encoder](https://github.com/logstash/logstash-logback-encoder)
|
||||
- **教程**
|
||||
- [Elasticsearch 权威指南(中文版)](https://es.xiaoleilu.com/index.html)
|
||||
- [ELK Stack 权威指南](https://github.com/chenryn/logstash-best-practice-cn)
|
||||
- [Elasticsearch 教程](https://www.knowledgedict.com/tutorial/elasticsearch-intro.html)
|
||||
- **博文**
|
||||
- **文章**
|
||||
- [Elasticsearch+Logstash+Kibana 教程](https://www.cnblogs.com/xing901022/p/4704319.html)
|
||||
- [ELK(Elasticsearch、Logstash、Kibana)安装和配置](https://github.com/judasn/Linux-Tutorial/blob/master/ELK-Install-And-Settings.md)
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
# 关系型数据库
|
||||
|
||||
> 关系数据库,是建立在关系模型基础上的数据库,借助于集合代数等数学概念和方法来处理数据库中的数据。现实世界中的各种实体以及实体之间的各种联系均用关系模型来表示。关系模型由关系数据结构、关系操作集合、关系完整性约束三部分组成。
|
||||
|
||||
## 📖 内容
|
||||
|
||||
### [共性知识](common)
|
||||
|
||||
- [关系型数据库面试总结](common/sql-interview.md) 💯
|
||||
- [SQL Cheat Sheet](common/sql-cheat-sheet.md) 是一个 SQL 入门教程。
|
||||
- [分布式存储基本原理](https://github.com/dunwu/blog/blob/master/source/_posts/theory/distributed-storage.md)
|
||||
- [分布式事务基本原理](https://github.com/dunwu/blog/blob/master/source/_posts/theory/distributed-transaction.md)
|
||||
|
||||
### [Mysql](mysql/README.md)
|
||||
|
||||
![img](https://raw.githubusercontent.com/dunwu/images/dev/snap/20200716103611.png)
|
||||
|
||||
- [Mysql 应用指南](mysql/mysql-quickstart.md) ⚡
|
||||
- [Mysql 工作流](mysql/mysql-index.md) - 关键词:`连接`、`缓存`、`语法分析`、`优化`、`执行引擎`、`redo log`、`bin log`、`两阶段提交`
|
||||
- [Mysql 索引](mysql/mysql-index.md) - 关键词:`Hash`、`B 树`、`聚簇索引`、`回表`
|
||||
- [Mysql 锁](mysql/mysql-lock.md) - 关键词:`乐观锁`、`表级锁`、`行级锁`、`意向锁`、`MVCC`、`Next-key 锁`
|
||||
- [Mysql 事务](mysql/mysql-transaction.md) - 关键词:`ACID`、`AUTOCOMMIT`、`事务隔离级别`、`死锁`、`分布式事务`
|
||||
- [Mysql 性能优化](mysql/mysql-optimization.md)
|
||||
- [Mysql 运维](mysql/mysql-ops.md) 🔨
|
||||
- [Mysql 配置](mysql/mysql-config.md)
|
||||
- [Mysql 问题](mysql/mysql-faq.md)
|
||||
|
||||
### 其他关系型数据库
|
||||
|
||||
- [H2 入门](h2.md)
|
||||
- [SqLite 入门](sqlite.md)
|
||||
- [PostgreSQL 入门](postgresql.md)
|
||||
|
||||
## 📚 资料
|
||||
|
||||
- **官方**
|
||||
- [Mysql 官网](https://www.mysql.com/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/refman/8.0/en/)
|
||||
- [Mysql 官方文档之命令行客户端](https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
|
||||
- **书籍**
|
||||
- [《高性能 MySQL》](https://item.jd.com/11220393.html) - Mysql 经典
|
||||
- [《SQL 必知必会》](https://item.jd.com/11232698.html) - SQL 入门
|
||||
- **教程**
|
||||
- [runoob.com MySQL 教程](http://www.runoob.com/mymysql-tutorial.html) - 入门级 SQL 教程
|
||||
- [mysql-tutorial](https://github.com/jaywcjlove/mysql-tutorial)
|
||||
- **更多资源**
|
||||
- [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn)
|
||||
|
||||
## 🚪 传送
|
||||
|
||||
◾ 🏠 [DB-TUTORIAL 首页](https://github.com/dunwu/db-tutorial) ◾ 🎯 [我的博客](https://github.com/dunwu/blog) ◾
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
- **官方**
|
||||
- [Mysql 官网](https://www.mysql.com/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/refman/8.0/en/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/)
|
||||
- [Mysql 官方文档之命令行客户端](https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
|
||||
- **书籍**
|
||||
- [《高性能 MySQL》](https://item.jd.com/11220393.html) - Mysql 经典
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
- **官方**
|
||||
- [Mysql 官网](https://www.mysql.com/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/refman/8.0/en/)
|
||||
- [Mysql 官方文档](https://dev.mysql.com/doc/)
|
||||
- [Mysql 官方文档之命令行客户端](https://dev.mysql.com/doc/refman/8.0/en/mysql.html)
|
||||
- **书籍**
|
||||
- [《高性能 MySQL》](https://book.douban.com/subject/23008813/) - 经典,适合 DBA 或作为开发者的参考手册
|
||||
|
|
Loading…
Reference in New Issue