SlideShare a Scribd company logo
1 of 14
徐熊瓶
Hot/Cold Data TransferHot/Cold Data Transfer
between Redis and Mongobetween Redis and Mongo
2
Redis is anRedis is an open sourceopen source,, BSDBSD licensed,licensed,
advancedadvanced key-valuekey-value store.store.
It is often referred to as a data structureIt is often referred to as a data structure
server since keys can containserver since keys can contain stringsstrings,,
hasheshashes,, listslists,, setssets andand sorted setssorted sets..
3
MongoDB is an MongoDB is an open sourceopen source
document databasedocument database,,
and the leading NoSQL database.and the leading NoSQL database.
Written in C++  Written in C++  
4
RedisDB is TemporarilyRedisDB is Temporarily
MongoDB is PersistenceMongoDB is Persistence
5
MongoDBRedisDB
6
TopDB
MongoDB
RedisDB
7
TopDB is implementsTopDB is implements
Jedis-like interfaceJedis-like interface
Jedis is redis driver for JavaJedis is redis driver for Java
8
TopDB support redis key typeTopDB support redis key type ::
a:b:ca:b:c
a:b:c:a:b:c:1234512345
a:b:c:a:b:c:1234512345::6789067890
a:b:c:a:b:c:1234512345::6789067890:d:e:f:d:e:f
prefixKey keyPair
recommend be shardkey
suffixKey
9
Redis dbIndex will get a Mongo dbNameRedis dbIndex will get a Mongo dbName
Mapping TableMapping Table (Defined in TopDBModel)(Defined in TopDBModel)::
dbIndex 1 -> mdb00001dbIndex 1 -> mdb00001
dbIndex 2 -> mdb00002dbIndex 2 -> mdb00002
dbIndex 3 -> mdb00003dbIndex 3 -> mdb00003
dbIndex 4 -> mdb00004dbIndex 4 -> mdb00004
dbIndex 5 -> mdb00005dbIndex 5 -> mdb00005
Another will throw Exception likeAnother will throw Exception like ““dbIndex Error : 6dbIndex Error : 6””
10
aaa:bbb:aaa:bbb:104150104150:ccc:ccc
↓↓
aaa:bbb:cccaaa:bbb:ccc
↓↓
aaa_bbb_cccaaa_bbb_ccc
Mongo Collection Name Defined in TopDBModelMongo Collection Name Defined in TopDBModel
if collection name doesnif collection name doesn’’t exists will throw Exception liket exists will throw Exception like
““TopDB vaild Mongo Collection Error!TopDB vaild Mongo Collection Error!”” ……etc.etc.
Mongo Collection Name defined ruleMongo Collection Name defined rule
Redis Key
Mongo Collection
11
104150104150 must become linkedHashMapmust become linkedHashMap
Ex 1 :Ex 1 :
LinkedHashMap keyPairMap = new LinkeHashMap()LinkedHashMap keyPairMap = new LinkeHashMap()
keyPairMap.put(keyPairMap.put(““idid””,, ““104150104150””))
Mean 1 is :Mean 1 is : aaa:bbb:aaa:bbb:104150104150:ccc:ccc
Ex 2 :Ex 2 :
LinkedHashMap keyPairMap = new LinkeHashMap()LinkedHashMap keyPairMap = new LinkeHashMap()
keyPairMap.put(keyPairMap.put(““id1id1””,, ““104150104150””))
keyPairMap.put(keyPairMap.put(““id2id2””,, ““000001000001””))
Mean 2 is :Mean 2 is : aaa:bbb:aaa:bbb:104150104150::000001000001:ccc:ccc
keyPair is sortedkeyPair is sorted
12
Sample CodeSample Code
topDB.hget(topDB.hget(
topDB.getTopDBModel(topDB.getTopDBModel(
1,1, ““aaa:bbbaaa:bbb””,, ““id:104150id:104150””,, ““cccccc””
))
, 123, 123
););
13
TopDB workflowTopDB workflow
TopDB.hget(topDBModel, field)TopDB.hget(topDBModel, field)
     ↓     ↓
checkStringData() {checkStringData() {
If (redisDB.get()==null) {If (redisDB.get()==null) { // redis data doesn// redis data doesn’’t existst exists
mongoDB.select();mongoDB.select();
redisDB.save(mongoDB);redisDB.save(mongoDB);
}}
}}
     ↓     ↓
Return redisDB.hget(dbIndex, redisDBKey, field);Return redisDB.hget(dbIndex, redisDBKey, field);
Q & AQ & A

More Related Content

What's hot

10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators  10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators iammutex
 
Introduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker NewsIntroduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker NewsMichael Parker
 
The Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterThe Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterChris Henry
 
Thinking in documents
Thinking in documentsThinking in documents
Thinking in documentsCésar Rodas
 
MongoDB PhillyDB database throw down
MongoDB PhillyDB database throw downMongoDB PhillyDB database throw down
MongoDB PhillyDB database throw downzippy1981
 
Optimize drupal using mongo db
Optimize drupal using mongo dbOptimize drupal using mongo db
Optimize drupal using mongo dbVladimir Ilic
 
RESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerRESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerYandex
 
Building a userspace filesystem in node.js
Building a userspace filesystem in node.jsBuilding a userspace filesystem in node.js
Building a userspace filesystem in node.jsClay Smith
 
Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo dbDaeMyung Kang
 
MongoDB全機能解説1
MongoDB全機能解説1MongoDB全機能解説1
MongoDB全機能解説1Takahiro Inoue
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source BridgeChris Anderson
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...MongoDB
 
PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)Pavel Emelyanov
 
Non-Framework MVC sites with PHP
Non-Framework MVC sites with PHPNon-Framework MVC sites with PHP
Non-Framework MVC sites with PHPCésar Rodas
 

What's hot (20)

Python and MongoDB
Python and MongoDBPython and MongoDB
Python and MongoDB
 
10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators  10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators
 
Introduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker NewsIntroduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker News
 
The Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterThe Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb Cluster
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
Thinking in documents
Thinking in documentsThinking in documents
Thinking in documents
 
MongoDB PhillyDB database throw down
MongoDB PhillyDB database throw downMongoDB PhillyDB database throw down
MongoDB PhillyDB database throw down
 
htaccess
htaccesshtaccess
htaccess
 
Optimize drupal using mongo db
Optimize drupal using mongo dbOptimize drupal using mongo db
Optimize drupal using mongo db
 
RESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerRESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens Аuer
 
Building a userspace filesystem in node.js
Building a userspace filesystem in node.jsBuilding a userspace filesystem in node.js
Building a userspace filesystem in node.js
 
Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo db
 
MongoDB全機能解説1
MongoDB全機能解説1MongoDB全機能解説1
MongoDB全機能解説1
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB Application
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
 
HTML5
HTML5HTML5
HTML5
 
Switch from shapefile
Switch from shapefileSwitch from shapefile
Switch from shapefile
 
PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)PFcache (Linuxcon, Seattle, 2015)
PFcache (Linuxcon, Seattle, 2015)
 
Non-Framework MVC sites with PHP
Non-Framework MVC sites with PHPNon-Framework MVC sites with PHP
Non-Framework MVC sites with PHP
 

Viewers also liked

滑鼠設計輕鬆聊
滑鼠設計輕鬆聊滑鼠設計輕鬆聊
滑鼠設計輕鬆聊Chonpin HSU
 
Buy the way web project report
Buy the way web project report Buy the way web project report
Buy the way web project report Chonpin HSU
 
training and sharing about clean code
training and sharing about clean codetraining and sharing about clean code
training and sharing about clean codeChonpin HSU
 
reading group 成為卓越程式設計師的38項必修法則(20~23)
reading group 成為卓越程式設計師的38項必修法則(20~23)reading group 成為卓越程式設計師的38項必修法則(20~23)
reading group 成為卓越程式設計師的38項必修法則(20~23)Chonpin HSU
 
2016 pycontw web api authentication
2016 pycontw web api authentication 2016 pycontw web api authentication
2016 pycontw web api authentication Micron Technology
 
那些年、我們還沒學會就已經過時的那些技術
那些年、我們還沒學會就已經過時的那些技術那些年、我們還沒學會就已經過時的那些技術
那些年、我們還沒學會就已經過時的那些技術鍾誠 陳鍾誠
 

Viewers also liked (7)

滑鼠設計輕鬆聊
滑鼠設計輕鬆聊滑鼠設計輕鬆聊
滑鼠設計輕鬆聊
 
Buy the way web project report
Buy the way web project report Buy the way web project report
Buy the way web project report
 
training and sharing about clean code
training and sharing about clean codetraining and sharing about clean code
training and sharing about clean code
 
reading group 成為卓越程式設計師的38項必修法則(20~23)
reading group 成為卓越程式設計師的38項必修法則(20~23)reading group 成為卓越程式設計師的38項必修法則(20~23)
reading group 成為卓越程式設計師的38項必修法則(20~23)
 
2016 pycontw web api authentication
2016 pycontw web api authentication 2016 pycontw web api authentication
2016 pycontw web api authentication
 
那些年、我們還沒學會就已經過時的那些技術
那些年、我們還沒學會就已經過時的那些技術那些年、我們還沒學會就已經過時的那些技術
那些年、我們還沒學會就已經過時的那些技術
 
IOT, Streaming Analytics and Machine Learning
IOT, Streaming Analytics and Machine Learning IOT, Streaming Analytics and Machine Learning
IOT, Streaming Analytics and Machine Learning
 

Similar to TopDB data transfer

Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & IntroductionJerwin Roy
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptxSurya937648
 
An introduction to MongoDB and Ruby
An introduction to MongoDB and RubyAn introduction to MongoDB and Ruby
An introduction to MongoDB and RubyTobias Trelle
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Kai Zhao
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBAshnikbiz
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introductionTse-Ching Ho
 
mongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxmongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxRoopaR36
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDBNorberto Leite
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsSrinivas Mutyala
 
My First Cluster with MongoDB Atlas
My First Cluster with MongoDB AtlasMy First Cluster with MongoDB Atlas
My First Cluster with MongoDB AtlasJay Gordon
 
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisMongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisJason Terpko
 

Similar to TopDB data transfer (20)

Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
 
An introduction to MongoDB and Ruby
An introduction to MongoDB and RubyAn introduction to MongoDB and Ruby
An introduction to MongoDB and Ruby
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
 
MongoDB
MongoDBMongoDB
MongoDB
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDB
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
MongoDB is the MashupDB
MongoDB is the MashupDBMongoDB is the MashupDB
MongoDB is the MashupDB
 
mongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxmongodb11 (1) (1).pptx
mongodb11 (1) (1).pptx
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
MongoDB and DynamoDB
MongoDB and DynamoDBMongoDB and DynamoDB
MongoDB and DynamoDB
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training Presentations
 
2012 phoenix mug
2012 phoenix mug2012 phoenix mug
2012 phoenix mug
 
MongoDB
MongoDBMongoDB
MongoDB
 
My First Cluster with MongoDB Atlas
My First Cluster with MongoDB AtlasMy First Cluster with MongoDB Atlas
My First Cluster with MongoDB Atlas
 
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisMongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
 

Recently uploaded

Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 

Recently uploaded (20)

Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 

TopDB data transfer

  • 1. 徐熊瓶 Hot/Cold Data TransferHot/Cold Data Transfer between Redis and Mongobetween Redis and Mongo
  • 2. 2 Redis is anRedis is an open sourceopen source,, BSDBSD licensed,licensed, advancedadvanced key-valuekey-value store.store. It is often referred to as a data structureIt is often referred to as a data structure server since keys can containserver since keys can contain stringsstrings,, hasheshashes,, listslists,, setssets andand sorted setssorted sets..
  • 3. 3 MongoDB is an MongoDB is an open sourceopen source document databasedocument database,, and the leading NoSQL database.and the leading NoSQL database. Written in C++  Written in C++  
  • 4. 4 RedisDB is TemporarilyRedisDB is Temporarily MongoDB is PersistenceMongoDB is Persistence
  • 7. 7 TopDB is implementsTopDB is implements Jedis-like interfaceJedis-like interface Jedis is redis driver for JavaJedis is redis driver for Java
  • 8. 8 TopDB support redis key typeTopDB support redis key type :: a:b:ca:b:c a:b:c:a:b:c:1234512345 a:b:c:a:b:c:1234512345::6789067890 a:b:c:a:b:c:1234512345::6789067890:d:e:f:d:e:f prefixKey keyPair recommend be shardkey suffixKey
  • 9. 9 Redis dbIndex will get a Mongo dbNameRedis dbIndex will get a Mongo dbName Mapping TableMapping Table (Defined in TopDBModel)(Defined in TopDBModel):: dbIndex 1 -> mdb00001dbIndex 1 -> mdb00001 dbIndex 2 -> mdb00002dbIndex 2 -> mdb00002 dbIndex 3 -> mdb00003dbIndex 3 -> mdb00003 dbIndex 4 -> mdb00004dbIndex 4 -> mdb00004 dbIndex 5 -> mdb00005dbIndex 5 -> mdb00005 Another will throw Exception likeAnother will throw Exception like ““dbIndex Error : 6dbIndex Error : 6””
  • 10. 10 aaa:bbb:aaa:bbb:104150104150:ccc:ccc ↓↓ aaa:bbb:cccaaa:bbb:ccc ↓↓ aaa_bbb_cccaaa_bbb_ccc Mongo Collection Name Defined in TopDBModelMongo Collection Name Defined in TopDBModel if collection name doesnif collection name doesn’’t exists will throw Exception liket exists will throw Exception like ““TopDB vaild Mongo Collection Error!TopDB vaild Mongo Collection Error!”” ……etc.etc. Mongo Collection Name defined ruleMongo Collection Name defined rule Redis Key Mongo Collection
  • 11. 11 104150104150 must become linkedHashMapmust become linkedHashMap Ex 1 :Ex 1 : LinkedHashMap keyPairMap = new LinkeHashMap()LinkedHashMap keyPairMap = new LinkeHashMap() keyPairMap.put(keyPairMap.put(““idid””,, ““104150104150””)) Mean 1 is :Mean 1 is : aaa:bbb:aaa:bbb:104150104150:ccc:ccc Ex 2 :Ex 2 : LinkedHashMap keyPairMap = new LinkeHashMap()LinkedHashMap keyPairMap = new LinkeHashMap() keyPairMap.put(keyPairMap.put(““id1id1””,, ““104150104150””)) keyPairMap.put(keyPairMap.put(““id2id2””,, ““000001000001””)) Mean 2 is :Mean 2 is : aaa:bbb:aaa:bbb:104150104150::000001000001:ccc:ccc keyPair is sortedkeyPair is sorted
  • 12. 12 Sample CodeSample Code topDB.hget(topDB.hget( topDB.getTopDBModel(topDB.getTopDBModel( 1,1, ““aaa:bbbaaa:bbb””,, ““id:104150id:104150””,, ““cccccc”” )) , 123, 123 ););
  • 13. 13 TopDB workflowTopDB workflow TopDB.hget(topDBModel, field)TopDB.hget(topDBModel, field)      ↓     ↓ checkStringData() {checkStringData() { If (redisDB.get()==null) {If (redisDB.get()==null) { // redis data doesn// redis data doesn’’t existst exists mongoDB.select();mongoDB.select(); redisDB.save(mongoDB);redisDB.save(mongoDB); }} }}      ↓     ↓ Return redisDB.hget(dbIndex, redisDBKey, field);Return redisDB.hget(dbIndex, redisDBKey, field);
  • 14. Q & AQ & A