Presentation is loading. Please wait.

Presentation is loading. Please wait.

NoSQL Concepts, Redis, MongoDB, CouchDB Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training

Similar presentations


Presentation on theme: "NoSQL Concepts, Redis, MongoDB, CouchDB Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training"— Presentation transcript:

1 NoSQL Concepts, Redis, MongoDB, CouchDB Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training http://www.nakov.com

2  NoSQL Databases Overview  Redis  Ultra-fast data structures server  Redis Cloud: managed Redis  MongoDB  Powerful and mature NoSQL database  MongoLab: managed MongoDB in the cloud  CouchDB  JSON-based document database with REST API  Cloudant: managed CouchDB in the cloud 2

3 NoSQL Databases Overview, Models, Concepts, Examples

4  NoSQL (cloud) databases  Use document-based model (non-relational)  Schema-free document storage  Still support indexing and querying  Still support CRUD operations (create, read, update, delete)  Still supports concurrency and transactions  Highly optimized for append / retrieve  Great performance and scalability  NoSQL == “No SQL” or “Not Only SQL”? 4

5  Relational databases  Data stored as table rows  Relationships between related rows  Single entity spans multiple tables  RDBMS systems are very mature, rock solid  NoSQL databases  Data stored as documents  Single entity (document) is a single record  Documents do not have a fixed structure 5

6 * 1 6 Name: Svetlin Nakov Gender: male Phone: +359333777555 Address: - Street: Al. Malinov 31 - Post Code: 1729 - Town: Sofia - Country: Bulgaria Email: nakov@abv.bg Site: www.nakov.com Document Model Relational Model * 1 * 1 Name Svetlin Nakov Gendermale Phone+359333777555 Emailnakov@abv.bg Sitewww.nakov.com CountryBulgaria Street Al. Malinov 31 Post Code 1729 TownSofia

7 Ultra-Fast Data Structures Server

8  Redis is  Ultra-fast in-memory key-value data store  Powerful data structures server  Open-source software: http://redis.io http://redis.io  Redis stores data structures:  Strings  Lists  Hash tables  Sets / sorted sets 8

9  Redis Cloud  Fully managed Redis instance in the cloud  Highly scalable, highly available  Free 1 GB instance, stored in the Amazon cloud  Supports data persistence and replication  http://redis-cloud.com http://redis-cloud.com  Redis To Go  5 MB free non-persistent Redis instance  http://redistogo.com http://redistogo.com 9

10  ServiceStack.Redis API  github.com/ServiceStack/ServiceStack.Redis github.com/ServiceStack/ServiceStack.Redis  Sample C# code: 10 string redisHost = "redis.garantiadata.com"; int redisPort = 14233; string redisPass = "some@pass0rd"; using (var redisClient = new RedisClient(redisHost, redisPort, redisPass)) new RedisClient(redisHost, redisPort, redisPass)){ string key = "username"; string key = "username"; string value = "nakov"; string value = "nakov"; redisClient.Set (key, value); redisClient.Set (key, value); Console.WriteLine(redisClient.Get (key)); Console.WriteLine(redisClient.Get (key));}

11 Live Demo

12 Mature and Very Powerful NoSQL Database

13  MongoDB – http://mongodb.org http://mongodb.org  Very powerful and mature NoSQL database  Scalable, high-performance, open-source  JSON-style document storage, schemaless  Replication & high-availability support  Auto sharding – clustering & data partitioning  Indexing and powerful querying  Map-Reduce – parallel data processing  GridFS – store files of any size 13

14  MongoLab  Free 0.5 GB instance  https://mongolab.com https://mongolab.com  MongoHQ  Free 0.5 GB instance (sandbox)  https://www.mongohq.com https://www.mongohq.com  MongoOd  Free 100 MB instance  https://www.mongood.com https://www.mongood.com 14

15 15  The official MongoDB C# driver from 10 gen  github.com/mongodb/mongo-csharp-driver github.com/mongodb/mongo-csharp-driver  Sample C# code: var connectionStr = "mongodb://user:pass@server:part"; var client = new MongoClient(connectionSt); var server = client.GetServer(); var db = server.GetDatabase("mongodb-name"); var persons = db.GetCollection ("Persons"); persons.Insert (new Person(…)); var resultPersons = from p in persons.AsQueryable () from p in persons.AsQueryable () where p.Address.Town == "Sofia" where p.Address.Town == "Sofia" select p; select p;

16 Live Demo

17 JSON-based Document Database with RESTful API

18  Apache CouchDB  Open-source NoSQL database  Document-based: stored JSON documents  HTTP-based API  Query, combine, and transform documents with JavaScript  On-the-fly document transformation  Real-time change notifications  Highly available and partition tolerant 18

19  Cloudant  Managed CouchDB instances in the cloud  Free $5 account – unclear what this means  https://cloudant.com https://cloudant.com  Has nice web-based administration UI 19

20 20  Many CouchDB C# APIs  github.com/soitgoes/LoveSeat github.com/soitgoes/LoveSeat  Sample C# code: var client = new CouchClient( dbHost, dbPort, dbUsername, dbPassword, dbHost, dbPort, dbUsername, dbPassword, false, AuthenticationType.Cookie); false, AuthenticationType.Cookie); var db = client.GetDatabase("some-db"); db.CreateDocument(new Person() { Name = "Svetlin Nakov", Name = "Svetlin Nakov", Email = "nakov@abv.bg"} Email = "nakov@abv.bg"});

21 Live Demo

22 форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен SEO курс - оптимизация за търсачки уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop уроци по програмиране и уеб дизайн за ученици ASP.NET MVC курс – HTML, SQL, C#,.NET, ASP.NET MVC безплатен курс "Разработка на софтуер в cloud среда" BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране, книги – безплатно от Наков безплатен курс "Качествен програмен код" алго академия – състезателно програмиране, състезания ASP.NET курс - уеб програмиране, бази данни, C#,.NET, ASP.NET курсове и уроци по програмиране – Телерик академия курс мобилни приложения с iPhone, Android, WP7, PhoneGap free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране http://academy.telerik.com

23 1. Register for a free Cloudant account at https://cloudant.com. https://cloudant.com 2. Write a simple "Dictionary" application in C# or JavaScript to perform the following in Cloudant:  Add a dictionary entry (word + translation)  List all words and their translations  Find the translation of given word The UI of the application is up to you (it could be Web-based, GUI or console-based). You may download a Cloudant client library from http://wiki.apache.org/couchdb/Related_Projects http://wiki.apache.org/couchdb/Related_Projects 23

24 3. Implement the previous task ("Dictionary") with Redis  Register for a free "Redis To Go" account at: https://redistogo.com https://redistogo.com  Download the client libraries for your favorite programming language from http://redis.io/clients http://redis.io/clients 4. Implement the previous task ("Dictionary") with MongoDB (register at MongoLab or MongoHQ) 24

25  Telerik School Academy  schoolacademy.telerik.com schoolacademy.telerik.com  Telerik Software Academy  academy.telerik.com academy.telerik.com  Telerik Academy @ Facebook  facebook.com/TelerikAcademy facebook.com/TelerikAcademy  Telerik Software Academy Forums  forums.academy.telerik.com forums.academy.telerik.com


Download ppt "NoSQL Concepts, Redis, MongoDB, CouchDB Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training"

Similar presentations


Ads by Google