MongoDB_Tokyo_2012-NRI_OpenStandia
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

MongoDB_Tokyo_2012-NRI_OpenStandia

  • 3,647 views
Uploaded on

MongoDB Tokyo December 2012で発表した資料です。 http://www.10gen.com/events/mongodb-tokyo

MongoDB Tokyo December 2012で発表した資料です。 http://www.10gen.com/events/mongodb-tokyo

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,647
On Slideshare
3,621
From Embeds
26
Number of Embeds
2

Actions

Shares
Downloads
22
Comments
0
Likes
4

Embeds 26

https://twitter.com 24
http://eventifier.co 2

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. MongoDB Tokyo 2012 Nomura Research Institute OpenStandia Shoken Fujisaki Dec. 12, 20121
  • 2. About me• Shoken Fujisaki (@syokenz)• syokenz@gmail.com• Technical Engineer• Leader of Marunouchi MongoDB http://syokenz.github.com/marunouchi-mongodb• Write a series of MongoDB articles in gihyo.jp http://gihyo.jp/dev/serial/01/mongodb2
  • 3. About company• Nomura Research Institute ( NRI ) • 野村総合研究所• System Integrator• Department : Open Source Solution Department• Team: OpenStandia http://openstandia.jp• Mission: • System development using OSS • Support for OSS • MongoDB (In preparation. contact : ossc@nri.co.jp)• Assigned: Research and Development for OSS3
  • 4. Agenda 1.Meetup MongoDB in Marunouchi Tokyo 2.XML Search App on MongoDB 3.Hybrid MySQL and MongoDB 4.Summary4
  • 5. Agenda 1.Meetup MongoDB in Marunouchi Tokyo 2.XML Search App on MongoDB 3.Hybrid MySQL and MongoDB 4.Summary5
  • 6. Meetup MongoDB in Marunouchi Tokyo• Site : http://syokenz.github.com/marunouchi-mongodb• “Marunouchi” is near Tokyo Station. marunouchi mongodb• Held once a month.• Done four times, next fifth on Dec 18.• Features of this meetup • Free • Hands-On • Open old documents and source code in Github. http://github.com/syokenz/marunouchi-mongodb6
  • 7. Meetup MongoDB in Marunouchi Tokyo• Theme #1 - #5 • #1. Learn a query on MongoDB compared to SQL • #2. Sharding on each participant’s PC. • #3. “v2.2 new futures” and “Replica Sets hands-on” • #4. “Make sample app using REST I/F” and “Configuration File Options” • #5. “Source code reading”, “Custom building” and “Operation Tips” Next• Future Dec 18 • GridFS, Geo-indexing, Performance tuning, etc…7
  • 8. Articles in Web• Writie a series of MongoDB in gihyo.jp. • gihyo.jp is website of 技術評論社. • http://gihyo.jp/dev/serial/01/mongodb• This article is output of Meetup Marunouchi MongoDB.8
  • 9. Agenda 1.Meetup MongoDB in Marunouchi Tokyo 2.XML Search App on MongoDB 3.Hybrid MySQL and MongoDB 4.Summary9
  • 10. XML Search App on MongoDB• Purpose • Learning “When should we consider using MongoDB?”• Existing Problem • How do we store XML to DB?• Solution • Schema-less10
  • 11. XML Sample Data CD BOOK PC <?xml version="1.0" encoding=“UTF-8" ?> <?xml version="1.0" encoding=“UTF-8" ?> <?xml version="1.0" encoding=“UTF-8" ?> <items> <items> <items> <category>music cd</category> <category>book</category> <category>pc</category> <title>jazz collection</ title > <title>guide of mongodb</ title > <name>let’s book air</ name> <stock>10</stock> <stock>10</stock> <stock>10</stock> <price>1000</price> <price>1200</price> <price>120000</price> <artist>nomura band</artist> <ISBN>4797327421</ISBN> <software> </items> <publish> <os>windows 7 pro</os> <company>nomura pub</company> <option>Office 2010</option> search conditions <url>http://nomura.pub</url> </software> ex. <address>….</address> <hardware> select count(*) from items </publish> <cpu>Intell core i 7</cpu> where stock > 10 </items> …. </items> • Each XML schema is different. • If add “FOOD category” CD BOOK PC FOOD • In RDB, Create FOOD table? • => It takes a lot of cost and not scale out. • RDB is not good extending the Schema.11
  • 12. XML Sample Data CD BOOK PC <?xml version="1.0" encoding=“UTF-8" ?> <?xml version="1.0" encoding=“UTF-8" ?> <?xml version="1.0" encoding=“UTF-8" ?> <items> <items> <items> <category>music cd</category> <category>book</category> <category>pc</category> <title>jazz collection</ title > <title>guide of mongodb</ title > <name>let’s book air</ name> <stock>10</stock> <stock>10</stock> <stock>10</stock> <price>1000</price> <price>1200</price> <price>120000</price> <artist>nomura band</artist> <ISBN>4797327421</ISBN> <software> </items> <publish> <os>windows 7 pro</os> <company>nomura pub</company> <option>Office 2010</option> search conditions <url>http://nomura.pub</url> </software> ex. <address>….</address> <hardware> select count(*) from items </publish> <cpu>Intell core i 7</cpu> where stock > 10 </items> …. </items> • MongoDB is Schema-less. • MongoDB can save any XML Data in one collection. • Search on any element. ex. db.items.find( {‚stock‛: {$gt: 10} } ); // where stock > 10 db.items.find( {‚title‛: /^jazz/ } ); // where title like ‘jazz%’ • Scalable12
  • 13. Architecture Search by Web browser. WebUI (Node.js) Insert multi type XML data into MongoDB by batch. XML type1 XML type2 XML type3 MongoDB13
  • 14. Demo Search xml “IR” data14
  • 15. Insert multi type XML The code to insert the multi type XML data to MongoDB is 10 lines !15
  • 16. Agenda 1.Meetup MongoDB in Marunouchi Tokyo 2.XML Search App on MongoDB 3.Hybrid MySQL and MongoDB 4.Summary16
  • 17. Hybrid MySQL and MongoDB • Use case in NRI • Working SNS Service for financial business since Apr.2012 • MySQL (and Java) SNS Service MySQL17
  • 18. Hybrid MySQL and MongoDB • Use case in NRI • Working SNS Service for financial business since Apr.2012 • MySQL (and Java) • Add CRM system with MongoDB SNS Service CRM MySQL MongoDB18
  • 19. Extended fields for each user on MongoDB • Requirements • Defines extended fields BY user. • Extended fields type is text, list or check box. • Search with extended fields. Customers SNS Service Search salses_level = 3 Customer Fields -name CRM -email Customer Fields User A -address -name -sales_level -email -industry -address -… MySQL MongoDB User B -interests -assets Extended fields -… depents on the user19
  • 20. Schema Design MongoDB CRM extended_definition extended_values collection collection user user collection user collection collection20
  • 21. Schema Design MongoDB CRM extended_definition extended_values collection collection user user collection user collection collection21
  • 22. Schema Design Defined for each user extended_definition collection { ‚_id‛:ObjectID(‚50ad9b3976c25eb2096dd1da‛), ‚userId‛: 12233, ‚extendedItems‛:[ {‚name‛ : ‚sales_level‛, ‚type‛: 1,‚selectValues‛ : [1,2,3,4,5]}, {‚name‛ : ‚industry‛, ‚type‛: 2,‚selectValues‛ : [‚food‛,‚IT‛,‚vendor‛,‚retail‛]} ] } type … =0 : text extended_values collection =1 : list { =2 : check box ‚_id‛:ObjectID(‚50ad9b3976c27eb2096dd100‛), ‚userId‛: 12233, ‚name‛:‛Atsushi Sato‛, ‚email‛:‛a@a-example.com‛, ‚extendedValues‛:[ {‚name‛ : ‚sales_level‛, ‚value‛: [ 3 ]}, {‚name‛ : ‚industry‛, ‚value‛: [‚1‛,‛3‛,‚5‛]} ] } { ‚_id‛:ObjectID(‚50ad9b3976c26eb2096dd101‛), ‚userId‛: 12233, ‚name‛:‛Bunta Suzuki‛, ‚email‛:‛b@b-example.com‛, ‚extendedValues‛:[ {‚name‛ : ‚sales_level‛, ‚value‛: [ 2 ]}, {‚name‛ : ‚industry‛, ‚value‛: [‚1‛]} ]22 } …
  • 23. Agenda 1.Meetup MongoDB in Marunouchi Tokyo 2.XML Search App on MongoDB 3.Hybrid MySQL and MongoDB 4.Summary23
  • 24. Summary • MongoDB can meet various kinds of customer requirements, especially for large system. • Schema-less • Search like SQL • Scalable • We can add MongoDB to the system using MySQL. • Hybrid MySQL and MongoDB • Select database depending on the data characteristic24
  • 25. All product names mentioned are trademarks or registered trademarks of the respective companies. Thank You ossc@nri.co.jp http://openstandia.jp/25