How to Use “Data Flashback” on ApsaraDB for Redis to Recover Data by Time Point

  • Create or startup a Redis instance of Enterprise Enhanced Edition (Tair)
  • Enable data flashback function
  • Read and write Redis database normally
  • Once the instant data recovery requirement occurs, select the corresponding instance and the point in time to be recovered to generate a new instance.
  • Toggle the instance address for the applications related when the new instance is ready.
% cat preparerepldata.sh
#!/bin/bash

echo "started at: `date +%m%d%H%M%S`"
for i in `seq -f "%010g" 1 $1`
do
namerand=$[ $RANDOM % 3 ]
timerand=`date +%m%d%H%M%S`
nationrand=$[ $RANDOM % 3 ]
redis-cli -h r-t4nq2viog3z4rshoxxpd.redis.singapore.rds.aliyuncs.com -a 'gnuhpc:Pa$$w0rd' hset userprofile foo$timerand $namerand
sleep 0.75 #consider the latency for connection establish
done

echo "ended at: `date +%m%d%H%M%S`"
% bash preparerepldata.sh   120
OK
OK


% redis-cli -h hosts -a 'username:password' hkeys userprofile | wc -l
120
% redis-cli -h hosts -a 'username:password' hkeys userprofile | sort -n
foo0803202709

foo0803202909
% redis-cli -h hosts -a 'username:password'   hkeys userprofile | wc -l
62

% redis-cli -h hosts -a 'username:password' hkeys userprofile | sort -n
foo0803202709

foo0803202810

Conclusion

--

--

--

First-hand & in-depth information about Alibaba's tech innovation in Artificial Intelligence, Big Data & Computer Engineering. Follow us on Facebook!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Scrintal

Service-to-Service Authentication for Microservice APIs

How does stack overflow help data scientists?

Policy automation over misconfiguration

Get Animated! — CSS Animation Basics

Preview Markdown in Vim

SQLAlchemy Cheetsheet

A Comprehensive Guide to Graph Search in Python- Part 3: Best First Search

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Tech

Alibaba Tech

First-hand & in-depth information about Alibaba's tech innovation in Artificial Intelligence, Big Data & Computer Engineering. Follow us on Facebook!

More from Medium

Apache Kafka

AWS ElasticCache Redis VS Memcached!

Stream avro data from kafka over ssl to Apache pinot

How We Made Data Aggregation Better and Faster on PostgreSQL With TimescaleDB 2.7