OPENSHIFT
Workshop
PRESENTED
BY
Shekhar Gulati
Thinking Beyond RDBMS : OPEN SHIFT Building Polyglot Persistence - - PowerPoint PPT Presentation
Thinking Beyond RDBMS : OPEN SHIFT Building Polyglot Persistence Java Applications Workshop PRESENTED BY Shekhar Gulati WHO AM I? Shekhar Gulati -- OpenShift Developer Evangelist Java / JavaScript /Python / NoSQL / Cloud Guy
Workshop
PRESENTED
BY
Shekhar Gulati
WHO AM I?
AGENDA
WHO ARE YOU?
There are no stupid questions only stupid
ASK QUESTIONS
http://nosql-database.org/ lists 150 databases
NOW WE HAVE CHOICES ...
WHY RDBMS?
tables.
RDBMS LIMITATIONS
NoSQL Databases to rescue
storage
NoSQL TO RESCUE
NoSQL CLASSIFICATION NOSQL CLASSIFICATION
Source http://www.slideshare.net/bscofield/nosql-codemash-2010
Using multiple data storage technologies, chosen based upon the way data is being used by individual applications or components of single application. Martin Fowler http://martinfowler.com/articles/nosql-intro.pdf
POLYGLOT PERSISTENCE
http://martinfowler.com/articles/nosql-intro.pdf HYPOTHETICAL EXAMPLE
GET MORE INFO AT
APPLICATION
http://localjobs-t20.rhcloud.com/
– Spring framework , Spring Social, Spring MongoDB,
Spring Security , Spring Redis , etc.
TECHNOLOGY CHOICES
–
JSON-style documents
–
Each document is heterogeneous, and may have completely unique structure compared to other documents.
MONGODB
Database → Database Table → Collection Row → Document Index → Index
MONGODB TERMINOLOGY MONGODB TERMINOLOGY
WriteConcern
WHY MONGODB?
RICH DOCUMENT
21
What is it for?
Find all the MongoDB jobs near me – Proximity Queries
Find all the MongoDB jobs within Colombo – Bounded Queries
Find all the MongoDB job at this location – Exact Queries
You can only have one geospatial index per collection. By default, 2d geospatial indexes assume longitude
and latitude have boundaries of -180 inclusive and 180 non-inclusive (i.e. [-180, 180))
GEOSPATIAL INDEXING BASICS
22
1) Put your coordinates into an array { loc : [ 50 , 30 ] } //SUGGESTED OPTION { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } 1) { loc : { lon : 40.739037, lat: 73.992964 } } 2) Make a 2d index db.places.ensureIndex( { loc : "2d" } ) 3) If you use latitude and longitude as your coordinate system, always store longitude first. MongoDB’s 2d spherical index
HOW TO MAKE IT WORK
Multi-language, Auto-Scaling, Self-service, Elastic, Cloud Application Platform
Python, PHP and Ruby
WHY OPENSHIFT?
Public Cloud Service On- premise
Cloud Software Open Source Project FLAVORS OF OPENSHIFT
26
OUR STACK
27
28
OPENSHIFT – GETTING STARTED
https://openshift.redhat.com/app/account/new
Promo code is LINUXCON2013
utility
29
$ rhc create-app localjobs jbosseap mongodb-2.2 postgresql-9.2 -s $ rhc add-cartridge http://cartreflect-claytondev.rhcloud.com/reflect? github=smarterclayton/openshift-redis-cart --app localjobs $ rhc env set SPRING_PROFILES_ACTIVE=openshift Lot of other tasks you can do with rhc – tail log, app management, cartridge management , ssh management , namespace management, etc. Run rhc -h for details
DEMO : LOCALJOBS APP
30
$ git rm -rf src pom.xml $ git commit -am “delete template app” $ git remote add upstream -m master https://github.com/shekhargulati/localjobs- demo.git $ git pull -s recursive -X theirs upstream master
ITS All GIT
Source code https://github.com/shekhargulati/localjobs-demo
31
32
DONE!