Big Data & Tools with NoSQL
  • Big Data & Tools
  • ReadMe
  • Big Data Overview
    • Overview
    • Job Opportunities
    • What is Data?
    • How does it help?
    • Types of Data
    • The Big 4 V's
      • Variety
      • Volume
      • Velocity
      • Veracity
      • Other V's
    • Trending Technologies
    • Big Data Concerns
    • Big Data Challenges
    • Data Integration
    • Scaling
      • CAP Theorem
      • Optimistic concurrency
      • Eventual consistency
      • Concurrent vs. Parallel Programming
    • Big Data Tools
    • No SQL Databases
    • What does Big Data learning means?
  • Linux & Tools
    • Overview
    • Linux Commands - 01
    • Linux Commands - 02
    • AWK
    • CSVKIT
    • CSVSQL
    • CSVGREP
  • Data Format
    • Storage Formats
    • CSV/TSV/Parquet
    • Parquet Example
    • JSON
    • HTTP & REST API
      • Terms to Know
        • Statefulness
        • Statelessness
        • Monolithic Architecture
        • Microservices
        • Idempotency
    • REST API
    • Python
      • Setup
      • Decorator
      • Unit Testing
      • Flask Demo
      • Flask Demo - 01
      • Flask Demo - 02
      • Flask Demo - 03
      • Flask Demo - 04
      • Flask Demo - 06
    • API Testing
    • Flask Demo Testing
    • API Performance
    • API in Big Data World
  • NoSQL
    • Types of NoSQL Databases
    • Redis
      • Overview
      • Terms to know
      • Redis - (RDBMS) MySql
      • Redis Cache Demo
      • Use Cases
      • Data Structures
        • Strings
        • List
        • Set
        • Hash
        • Geospatial Index
        • Pub/Sub
        • Redis - Python
      • Redis JSON
      • Redis Search
      • Persistence
      • Databases
      • Timeseries
    • Neo4J
      • Introduction
      • Neo4J Terms
      • Software
      • Neo4J Components
      • Hello World
      • Examples
        • MySQL: Neo4J
        • Sample Transactions
        • Sample
        • Create Nodes
        • Update Nodes
        • Relation
        • Putting it all together
        • Commonly used Functions
        • Data Profiling
        • Queries
        • Python Scripts
      • More reading
    • MongoDB
      • Sample JSON
      • Introduction
      • Software
      • MongoDB Best Practices
      • MongoDB Commands
      • Insert Document
      • Querying MongoDB
      • Update & Remove
      • Import
      • Logical Operators
      • Data Types
      • Operators
      • Aggregation Pipeline
      • Further Reading
      • Fun Task
        • Sample
    • InfluxDB
      • Data Format
      • Scripts
  • Python
    • Python Classes
    • Serialization-Deserialization
  • Tools
    • JQ
    • DUCK DB
    • CICD Intro
    • CICD Tools
      • CI YAML
      • CD Yaml
    • Containers
      • VMs or Containers
      • What container does
      • Podman
      • Podman Examples
  • Cloud Everywhere
    • Overview
    • Types of Cloud Services
    • Challenges of Cloud Computing
    • High Availability
    • Azure Cloud
      • Services
      • Storages
      • Demo
    • Terraform
  • Data Engineering
    • Batch vs Streaming
    • Kafka
      • Introduction
      • Kafka Use Cases
      • Kafka Software
      • Python Scripts
      • Different types of Streaming
    • Quality & Governance
    • Medallion Architecture
    • Data Engineering Model
    • Data Mesh
  • Industry Trends
    • Roadmap - Data Engineer
    • Good Reads
      • IP & SUBNET
Powered by GitBook
On this page
  1. NoSQL
  2. Redis

Persistence

  1. RDB (Redis Database): This method takes snapshots of your database at specified intervals. It's efficient for saving a compact, point-in-time snapshot of your dataset. The RDB file is a binary file that Redis can use to restore its state.

SAVE

Synchronous save of the dataset to disk. When Redis starts the save operation, it blocks all the clients until the save operation is complete. NOT RECOMMENDED IN PROD.

BGSAVE

Background SAVE or Asynchronous SAVE. This forks a new process, and the child process writes the snapshot to the disk. It is used in Prod as Redis continues to process commands while the snapshot is being created.

Automation

redis.conf
save 900 1

Saves the datasets every 900 seconds if at least one write operation has occurred.

save 300 10

Saves the datasets every 300 seconds if at least 10 write operations have occurred.

You can have multiple SAVE in redis.conf file for different conditions.

It creates a dump.rdb file (it is configurable to different name in redis.conf)

dbfilename mybackup.rdb

How to load from RDB?

When Redis is restarted, it checks for the RDB file and loads the contents to memory.

  1. AOF (Append Only File): This method logs every write operation the server receives, appending each operation to a file. This allows for more granular persistence and more durability than RDB, as you can configure Redis to append data on every write operation at the cost of performance. The AOF file can be replayed to reconstruct the state of the data.

# Enable AOF persistence
appendonly yes

# Specify the filename for the AOF file
appendfilename "appendonly.aof"

# Set the fsync policy to balance durability and performance
# 'always' - fsync on every write; most durable but slower
# 'everysec' - fsync every second; good balance (recommended)
# 'no' - rely on OS to decide; fastest but least durable
appendfsync everysec

auto-aof-rewrite-percentage 100 # Rewrite when AOF size
# Automatic rewriting of the AOF file when it grows too big
auto-aof-rewrite-min-size 64mb  # Minimum size for the AOF file to be rewritten

PreviousRedis SearchNextDatabases

Last updated 1 year ago