Posts

Layers of software

5 Layers of Software 5 Layers of Software 1. Hosting 2. Database 3. Logic 4. API 5. Presentation Click on any layer to learn more!

Git commands

Git Shortcuts with Examples Git Shortcuts Cheat Sheet with Examples Create & Clone ▼ Create new repository: git init Example: git init my-project This initializes a new Git repository in the "my-project" folder. Clone local repository: git clone /path/to/repository Example: git clone /home/user/my-project This clones a local repository located at "/home/user/my-project." Clone remote repository: git clone username@host:/path/to/repository Example: git clone user@github.com:user/repo.git This clones a remote repository from GitHub. Add ...

kubernetes intro

Image
Kubernetes Visualization Kubernetes Visualization Loading data from Wikipedia... Control Plane The Control Plane in Kubernetes is the core component responsible for managing the state and operation of the cluster. It oversees everything from scheduling pods to maintaining the desired state of the cluster. Etcd Etcd is a persistent, lightweight, distributed, key-value data store (originally developed for Container Linux). It reliably stores the configuration data of the cluster, representing the overall state of the cluster at any given point of time. API Server The API server serves the Kubernetes API using JSON over HTTP. Scheduler The scheduler selects nodes for unscheduled pods based on resource availability. Controllers Controllers drive the cluster state toward the desired state. Nodes No...

Failover between Primary and Replica

Redis Failover Process Redis Failover Process When a primary node fails in a Redis cluster, its associated replica is promoted to the new primary node. Here's what happens during this process: Key Points The primary node manages and owns hash slots. Replica nodes replicate data but do not own slots. During failover, write operations may pause temporarily. Write operations during the failover process are briefly paused to prevent inconsistencies. The cluster promotes a replica to a new primary to handle slots owned by the failed node. Failover Timeline Primary Node Fails: Write operations stop. Cluster Detects Failure: Failover is initiated. Replica Promotion: A replica is promoted to primary. Writes Resume: New primary starts accepting writes. ...

slots understanding

Redis Cluster Slot Assignment Understanding Slot Assignment in Redis Cluster If Node 2 has a replica, and you want to know where the key slots go for the primary node (master), here's how it works: How Redis Cluster Handles Slots In a Redis Cluster: Each primary node (master) is responsible for a range of slots. Replica nodes (slaves) are used for redundancy and failover purposes. They do not directly handle slot assignments themselves but replicate the data from their associated master node. Scenario Let’s assume the following: Node 2 is a replica of a primary node (Master). The primary node (Master) owns a certain range of slots. The replica node ( Node 2 ) simply mirrors the data of the primary node. In thi...

Slots |primary and Replica

Redis Cluster Sharding - 1 Primary and 2 Replica Nodes Node 1 (Primary) Slot Range: 0 - 16383 Responsible for all 16,384 slots. Node 2 (Replica) Slot Range: Replicates Node 1's data Replicates Node 1's data (No slots owned) Node 3 (Replica) Slot Range: Replicates Node 1's data Replicates Node 1's data (No slots owned) Explanation: Node 1 (Primary): Owns and manages all 16,384 slots, responsible for data storage and retrieval. Node 2 and Node 3 (Replicas): Replicate the data of Node 1. They do not own any slots but serve as backups in case Node 1 fails.

Redis log

Redis CLI Logs Viewer Redis CLI Logs Viewer Redis Command Logs bala:redis bala$ redis-cli -h 127.0.0.1 -p 6379 127.0.0.1:6379> keys * 1) "key1" 127.0.0.1:6379> scan (error) ERR wrong number of arguments for 'scan' command 127.0.0.1:6379> set key value1 OK 127.0.0.1:6379> get key "value1" 127.0.0.1:6379> shutdown not connected> Pod Status bala:redis bala$ kubectl get pods NAME READY STATUS RESTARTS AGE redis-5c995b7fbf-jxddf 1/1 Running 0 8h redis-master-5ccf554d96-ssrql 1/1 Running ...