DEV Community

AL EMRAN
AL EMRAN

Posted on • Edited on

1

Setup Redis Replica in Ubuntu/Linux

Follow me on Twitter

Redis is a powerful in-memory database that can handle a huge volume of data at high speeds. However, as your data grows, you may find that your Redis instance is struggling to keep up. This is where Redis replication comes in.

Redis replication allows you to scale your Redis database horizontally, without downtime. By configuring a replica server, you can create a copy of your master server that automatically updates itself whenever changes are made to the master. This means you can handle more read traffic and improve your database's fault tolerance.

Setting up Redis replication is easy. First, configure your master server with a password and a unique identifier. Then, create a replica server and use the replicaof command to specify the IP address and port number of the master server. Redis will handle the rest, automatically replicating data to the replica server in real-time.

With Redis replication, you can handle more traffic and keep your database running smoothly, all without downtime. So why not give it a try and see how it can improve your Redis performance?

setup Steps:

  1. Login to your Master Server

--Run

 nano /etc/redis/redis.conf 
Enter fullscreen mode Exit fullscreen mode

--Uncomment ‘requirepass’ and set a password like👇

  requirepass [password] 
Enter fullscreen mode Exit fullscreen mode

--restart redis

  1. Login to your replica server

--Run

  nano /etc/redis/redis.conf
Enter fullscreen mode Exit fullscreen mode

--Uncomment ‘replicaof’, 'masterauth' and set value like👇

  replicaof [master-server-private-ip] 6379  
  masterauth [master-requirepass]  
Enter fullscreen mode Exit fullscreen mode
  • restart redis

--Finally Run:

redis-cli
AUTH <master-requirepassword>
info replication
Enter fullscreen mode Exit fullscreen mode
  1. Verify: ss -antpl | grep redis

Done 😃 Follow me On Twitter

AL EMRAN
CTO at Besnik

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay