Chapter 9. How to Store Data
In Chapter 8, you learned how to protect your data in transit and at rest. In this chapter, you’ll learn about other aspects of data, including storage, querying, and replication. What data am I referring to? Just about all software relies on data: social networking apps need profile, connection, and messaging data; shopping apps need inventory and purchase data; fitness apps need workout and activity data.
Data is one of your most valuable, longest-lived assets. In all likelihood, your data will outlive your shiny web framework, your orchestration tool, your service mesh, your CI/CD pipeline, most employees at your company, and perhaps even the company itself, starting a second life as part of an acquisition. Data is important, and this chapter will show you how to manage it properly, covering the following use cases:
- Local storage
-
Hard drives
- Primary data store
-
Relational databases
- Caching
-
Key-value stores and content distribution networks (CDNs)
- File storage
-
File servers and object stores
- Semistructured data and search
-
Document stores
- Analytics
-
Columnar databases
- Asynchronous processing
-
Queues and streams
- Scalability and availability
-
Replication and partitioning
- Backup and recovery
-
Snapshots, continuous backups, and replication
As you go through these use cases, this chapter will walk you through hands-on examples, including deploying a PostgreSQL database, automating schema migrations, configuring backups and replication, serving ...