SlideShare ist ein Scribd-Unternehmen logo
1 von 72
Downloaden Sie, um offline zu lesen
http://blog.nahurst.com/visual-guide-to-nosql-systems
{

    "_id" : ObjectId("4dcd3ebc9278000000005158"),

    "timestamp" : ISODate("2011-05-13T14:22:46.777Z"),

    "binary" : BinData(0,""),

    "string" : "abc",

    "number" : 3,

    "subobj" : {"subA": 1, "subB": 2 },

    "array" : [1, 2, 3],

    "dbref" : [_id1, _id2, _id3]

}
{

    "_id" : ObjectId("4dcd3ebc9278000000005158"),

    "timestamp" : ISODate("2011-05-13T14:22:46.777Z"),

    "binary" : BinData(0,""),

    "string" : "abc",

    "number" : 3,

    "subobj" : {"subA": 1, "subB": 2 },

    "array" : [1, 2, 3],

    "dbref" : [_id1, _id2, _id3]

}
{

    "_id" : ObjectId("4dcd3ebc9278000000005158"),

    "timestamp" : ISODate("2011-05-13T14:22:46.777Z"),

    "binary" : BinData(0,""),

    "string" : "abc",

    "number" : 3,

    "subobj" : {"subA": 1, "subB": 2 },

    "array" : [1, 2, 3],

                        padding
}
{

    "_id" : ObjectId("4dcd3ebc9278000000005158"),

    "timestamp" : ISODate("2011-05-13T14:22:46.777Z"),

    "binary" : BinData(0,""),

    "string" : "def",

    "number" : 4,

    "subobj" : {"subA": 1, "subB": 2 },

    "array" : [1, 2, 3, 4, 5, 6],

    "newkey" : "In-place"

}
{

    "_id" : ObjectId("4dcd3ebc9278000000005158"),

    "timestamp" : ISODate("2011-05-13T14:22:46.777Z"),

    "binary" : BinData(0,""),

    "string" : "abc",

    "number" : 3,

    "subobj" : {"subA": 1, "subB": 2 },

    "array" : [1, 2, 3],



}
$ mongod --master --dbpath /data/masterdb/ --rest
$ mongod --slave --source <masterhostname>[:<port>]
--dbpath /data/slavedb/ --rest
$ mongod --replSet setname --rest

> config = {_id: 'mySet', members: [

        {_id: 0, host: 'host1:27017', priority: 1.0},

        {_id: 1, host: 'host2:27018’, priority: 0.5},

        {_id: 2, host: 'host3:27019', priority: 0.0} ] }

> rs.initiate(config)

> rs.status() //
Cluster
                                   Shard Servers (Data)
   config Servers
 (Shard Configration)   shard1           shard2           shard3
                        [ a, f )          [ k, n)         [ o, t )   Chunk
                        [ f, k )          [ n, o )        [ t, } )




                               mongos Servers (Routers)
Shard

      1
 ( mongos
primary     primary
        )
                      Shard




cinfig      Shard
                              mongos
~   mkdir    -p   shard/shard00
~   mkdir    -p   shard/shard01
~   mkdir    -p   shard/shard02
~   mkdir    -p   shard/config




~   mongod   --shardsvr --port 27017 --dbpath    shard/shard00
~   mongod   --shardsvr --port 27018 --dbpath    shard/shard01
~   mongod   --shardsvr --port 27019 --dbpath    shard/shard02
~   mongod   --configsvr --port 27020 --dbpath   shard/config
~   mongos   --configdb localhost:27020 --port   27021
➜   ~    mongo localhost:27021 // mongos

MongoDB shell version: 1.8.0
connecting to: localhost:27021/test
> show dbs
config    0.1875GB // sharding

> db.adminCommand( { addshard: "localhost:27017", name: "shard00" } )
{ "shardAdded" : "shard00", "ok" : 1 }
> db.adminCommand( { addshard: "localhost:27018", name: "shard01" } )
{ "shardAdded" : "shard01", "ok" : 1 }
> db.adminCommand( { addshard: "localhost:27019", name: "shard02" } )
{ "shardAdded" : "shard02", "ok" : 1 }
> db.adminCommand( { addshard: "set00/delta1:27017,delta2:27017", name:
"shard00" } )
{ "shardAdded" : "shard00", "ok" : 1 }
> db.adminCommand( { addshard: "set01/delta3:27018,delta4:27018", name:
"shard01" } )
{ "shardAdded" : "shard01", "ok" : 1 }
> db.adminCommand( { addshard: "set02/delta5:27019,delta6:27019", name:
"shard02" } )
{ "shardAdded" : "shard02", "ok" : 1 }
//       mongos

> db.adminCommand( { enablesharding : "test" } )
{ "ok" : 1 }


> db.adminCommand( { shardcollection : "test.myshard", key : { n : 1 } } )
{ "collectionsharded" : "test.myshard", "ok" : 1 }
http://www.slideshare.net/doryokujin/mongo-sharding
http://www.mongodb.org/display/DOCSJP/Journaling
//
> box = [[40.73083, -73.99756], [40.741404, -73.988135]]
> db.places.find({"loc" : {"$within" : {"$box" : box}}})

//
> center = [50, 50]
> radius = 10
> db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}})

// v1.9
> polygonA = [ [ 10, 20 ], [   10, 40 ], [ 30, 40 ], [ 30, 20 ] ]
> polygonB = { a : { x : 10,   y : 20 }, b : { x : 15, y : 25 }, c : { x :
20, y : 20 } }
> db.places.find({ "loc" : {   "$within" : { "$polygon" : polygonA } } })
> db.places.find({ "loc" : {   "$within" : { "$polygon" : polygonB } } })
➜ ~ mongofiles list
connected to: 127.0.0.1

➜ ~ mongofiles put music1.mp3
connected to: 127.0.0.1
added file: { _id: ObjectId('4df17f8d9d47ba5c0247e72e'),
filename: "music1.mp3", chunkSize: 262144, uploadDate: new
Date(1307672462538), md5:
"9ee9472200a2e18bf376ce622c3b0055", length: 11183104 }
done!

➜   ~   mongofiles list -v // -v
Fri Jun 10 11:21:05 creating new connection to:127.0.0.1
Fri Jun 10 11:21:05 BackgroundJob starting:
connected to: 127.0.0.1
music.mp3   11183104
➜ ~ mongofiles put music2.mp3
connected to: 127.0.0.1
added file: { _id: ObjectId('4df181fc5e354129e833193f'),
filename: "music2.mp3", chunkSize: 262144, uploadDate: new
Date(1307673086293), md5:
"9d4f424fa1843711e196e502d8a00183", length: 12225353 }
done!

➜ ~ mongofiles list
connected to: 127.0.0.1
music1.mp3   11183104
music2.mp3   12225353

➜ ~ mongofiles search .mp3
connected to: 127.0.0.1
music1.mp3   11183104
music2.mp3   12225353
Map-Reduce on Mongo
はじめてのMongoDB
はじめてのMongoDB
はじめてのMongoDB
はじめてのMongoDB

Weitere ähnliche Inhalte

Was ist angesagt?

20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...Amazon Web Services Japan
 
AWSメンテナンス ElastiCache編
AWSメンテナンス ElastiCache編AWSメンテナンス ElastiCache編
AWSメンテナンス ElastiCache編Serverworks Co.,Ltd.
 
オンプレミスRDBMSをAWSへ移行する手法
オンプレミスRDBMSをAWSへ移行する手法オンプレミスRDBMSをAWSへ移行する手法
オンプレミスRDBMSをAWSへ移行する手法Amazon Web Services Japan
 
AWS Black Belt Tech シリーズ 2015 - AWS CloudFormation
AWS Black Belt Tech シリーズ 2015 - AWS CloudFormationAWS Black Belt Tech シリーズ 2015 - AWS CloudFormation
AWS Black Belt Tech シリーズ 2015 - AWS CloudFormationAmazon Web Services Japan
 
AWS Well-Architected Security とベストプラクティス
AWS Well-Architected Security とベストプラクティスAWS Well-Architected Security とベストプラクティス
AWS Well-Architected Security とベストプラクティスAmazon Web Services Japan
 
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)Amazon Web Services Japan
 
Amazon Aurora - Auroraの止まらない進化とその中身
Amazon Aurora - Auroraの止まらない進化とその中身Amazon Aurora - Auroraの止まらない進化とその中身
Amazon Aurora - Auroraの止まらない進化とその中身Amazon Web Services Japan
 
20200826 AWS Black Belt Online Seminar AWS CloudFormation
20200826 AWS Black Belt Online Seminar AWS CloudFormation 20200826 AWS Black Belt Online Seminar AWS CloudFormation
20200826 AWS Black Belt Online Seminar AWS CloudFormation Amazon Web Services Japan
 
AWS上で使えるストレージ十番勝負
AWS上で使えるストレージ十番勝負AWS上で使えるストレージ十番勝負
AWS上で使えるストレージ十番勝負Akio Katayama
 
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.020191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0Amazon Web Services Japan
 
Fluentdのお勧めシステム構成パターン
Fluentdのお勧めシステム構成パターンFluentdのお勧めシステム構成パターン
Fluentdのお勧めシステム構成パターンKentaro Yoshida
 
Serverless with IAC - terraform과 cloudformation 비교
Serverless with IAC - terraform과 cloudformation 비교Serverless with IAC - terraform과 cloudformation 비교
Serverless with IAC - terraform과 cloudformation 비교재현 신
 
[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例
[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例
[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例Amazon Web Services Japan
 
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...Amazon Web Services Japan
 
MongoDBのアレをアレする
MongoDBのアレをアレするMongoDBのアレをアレする
MongoDBのアレをアレするAkihiro Kuwano
 
AWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリAWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリAmazon Web Services Japan
 
CodeBuildを身近にするためのはじめの一歩
CodeBuildを身近にするためのはじめの一歩CodeBuildを身近にするためのはじめの一歩
CodeBuildを身近にするためのはじめの一歩淳 千葉
 

Was ist angesagt? (20)

20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
 
AWSメンテナンス ElastiCache編
AWSメンテナンス ElastiCache編AWSメンテナンス ElastiCache編
AWSメンテナンス ElastiCache編
 
オンプレミスRDBMSをAWSへ移行する手法
オンプレミスRDBMSをAWSへ移行する手法オンプレミスRDBMSをAWSへ移行する手法
オンプレミスRDBMSをAWSへ移行する手法
 
AWS Black Belt Tech シリーズ 2015 - AWS CloudFormation
AWS Black Belt Tech シリーズ 2015 - AWS CloudFormationAWS Black Belt Tech シリーズ 2015 - AWS CloudFormation
AWS Black Belt Tech シリーズ 2015 - AWS CloudFormation
 
AWS Well-Architected Security とベストプラクティス
AWS Well-Architected Security とベストプラクティスAWS Well-Architected Security とベストプラクティス
AWS Well-Architected Security とベストプラクティス
 
Maven基礎
Maven基礎Maven基礎
Maven基礎
 
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
 
第18回しゃちほこオラクル俱楽部
第18回しゃちほこオラクル俱楽部第18回しゃちほこオラクル俱楽部
第18回しゃちほこオラクル俱楽部
 
Amazon Aurora - Auroraの止まらない進化とその中身
Amazon Aurora - Auroraの止まらない進化とその中身Amazon Aurora - Auroraの止まらない進化とその中身
Amazon Aurora - Auroraの止まらない進化とその中身
 
20200826 AWS Black Belt Online Seminar AWS CloudFormation
20200826 AWS Black Belt Online Seminar AWS CloudFormation 20200826 AWS Black Belt Online Seminar AWS CloudFormation
20200826 AWS Black Belt Online Seminar AWS CloudFormation
 
AWS上で使えるストレージ十番勝負
AWS上で使えるストレージ十番勝負AWS上で使えるストレージ十番勝負
AWS上で使えるストレージ十番勝負
 
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.020191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
20191126 AWS Black Belt Online Seminar Amazon AppStream 2.0
 
Fluentdのお勧めシステム構成パターン
Fluentdのお勧めシステム構成パターンFluentdのお勧めシステム構成パターン
Fluentdのお勧めシステム構成パターン
 
Serverless with IAC - terraform과 cloudformation 비교
Serverless with IAC - terraform과 cloudformation 비교Serverless with IAC - terraform과 cloudformation 비교
Serverless with IAC - terraform과 cloudformation 비교
 
[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例
[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例
[よくわかるクラウドデータベース] CassandraからAmazon DynamoDBへの移行事例
 
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
 
MongoDBのアレをアレする
MongoDBのアレをアレするMongoDBのアレをアレする
MongoDBのアレをアレする
 
AWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリAWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリ
 
AWS CLIでAssumeRole
AWS CLIでAssumeRoleAWS CLIでAssumeRole
AWS CLIでAssumeRole
 
CodeBuildを身近にするためのはじめの一歩
CodeBuildを身近にするためのはじめの一歩CodeBuildを身近にするためのはじめの一歩
CodeBuildを身近にするためのはじめの一歩
 

Ähnlich wie はじめてのMongoDB

MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 
MongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduceMongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduceTakahiro Inoue
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - GuilinJackson Tian
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseMike Dirolf
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
MongoDB dla administratora
MongoDB dla administratora MongoDB dla administratora
MongoDB dla administratora 3camp
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live HackingTobias Trelle
 
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Grant Goodale
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo dbAmit Thakkar
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsServer Density
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit
 
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...MongoDB
 
MySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsMySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsAlexander Rubin
 

Ähnlich wie はじめてのMongoDB (20)

MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
MongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduceMongoDB: Replication,Sharding,MapReduce
MongoDB: Replication,Sharding,MapReduce
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
Latinoware
LatinowareLatinoware
Latinoware
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - Guilin
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
 
Couchdb
CouchdbCouchdb
Couchdb
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
MongoDB dla administratora
MongoDB dla administratora MongoDB dla administratora
MongoDB dla administratora
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
Mongo db dla administratora
Mongo db dla administratoraMongo db dla administratora
Mongo db dla administratora
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
 
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted Malaska
 
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
 
MySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsMySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of Things
 

Mehr von Takahiro Inoue

Treasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC DemoTreasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC DemoTakahiro Inoue
 
トレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティングトレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティングTakahiro Inoue
 
Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界Takahiro Inoue
 
トレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するトレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するTakahiro Inoue
 
20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューション20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューションTakahiro Inoue
 
トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方Takahiro Inoue
 
オンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータオンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータTakahiro Inoue
 
事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612Takahiro Inoue
 
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)Takahiro Inoue
 
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜Takahiro Inoue
 
Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!Takahiro Inoue
 
Hadoop and the Data Scientist
Hadoop and the Data ScientistHadoop and the Data Scientist
Hadoop and the Data ScientistTakahiro Inoue
 
MongoDB: Intro & Application for Big Data
MongoDB: Intro & Application  for Big DataMongoDB: Intro & Application  for Big Data
MongoDB: Intro & Application for Big DataTakahiro Inoue
 
An Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsAn Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsTakahiro Inoue
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to TinkerpopTakahiro Inoue
 
An Introduction to Neo4j
An Introduction to Neo4jAn Introduction to Neo4j
An Introduction to Neo4jTakahiro Inoue
 
The Definition of GraphDB
The Definition of GraphDBThe Definition of GraphDB
The Definition of GraphDBTakahiro Inoue
 
Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)Takahiro Inoue
 
Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)Takahiro Inoue
 

Mehr von Takahiro Inoue (20)

Treasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC DemoTreasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC Demo
 
トレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティングトレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティング
 
Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界
 
トレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するトレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解する
 
20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューション20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューション
 
トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方
 
オンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータオンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータ
 
事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612
 
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
 
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
 
Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!
 
Hadoop and the Data Scientist
Hadoop and the Data ScientistHadoop and the Data Scientist
Hadoop and the Data Scientist
 
MongoDB: Intro & Application for Big Data
MongoDB: Intro & Application  for Big DataMongoDB: Intro & Application  for Big Data
MongoDB: Intro & Application for Big Data
 
An Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsAn Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB Plugins
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to Tinkerpop
 
An Introduction to Neo4j
An Introduction to Neo4jAn Introduction to Neo4j
An Introduction to Neo4j
 
The Definition of GraphDB
The Definition of GraphDBThe Definition of GraphDB
The Definition of GraphDB
 
Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)
 
Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)
 
Advanced MongoDB #1
Advanced MongoDB #1Advanced MongoDB #1
Advanced MongoDB #1
 

Kürzlich hochgeladen

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

はじめてのMongoDB

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), "binary" : BinData(0,""), "string" : "abc", "number" : 3, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3], "dbref" : [_id1, _id2, _id3] }
  • 17. { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), "binary" : BinData(0,""), "string" : "abc", "number" : 3, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3], "dbref" : [_id1, _id2, _id3] }
  • 18.
  • 19.
  • 20. { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), "binary" : BinData(0,""), "string" : "abc", "number" : 3, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3], padding }
  • 21. { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), "binary" : BinData(0,""), "string" : "def", "number" : 4, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3, 4, 5, 6], "newkey" : "In-place" }
  • 22.
  • 23.
  • 24.
  • 25. { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), "binary" : BinData(0,""), "string" : "abc", "number" : 3, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3], }
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. $ mongod --master --dbpath /data/masterdb/ --rest $ mongod --slave --source <masterhostname>[:<port>] --dbpath /data/slavedb/ --rest
  • 37.
  • 38. $ mongod --replSet setname --rest > config = {_id: 'mySet', members: [ {_id: 0, host: 'host1:27017', priority: 1.0}, {_id: 1, host: 'host2:27018’, priority: 0.5}, {_id: 2, host: 'host3:27019', priority: 0.0} ] } > rs.initiate(config) > rs.status() //
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. Cluster Shard Servers (Data) config Servers (Shard Configration) shard1 shard2 shard3 [ a, f ) [ k, n) [ o, t ) Chunk [ f, k ) [ n, o ) [ t, } ) mongos Servers (Routers)
  • 48. Shard 1 ( mongos primary primary ) Shard cinfig Shard mongos
  • 49.
  • 50.
  • 51.
  • 52.
  • 53. ~ mkdir -p shard/shard00 ~ mkdir -p shard/shard01 ~ mkdir -p shard/shard02 ~ mkdir -p shard/config ~ mongod --shardsvr --port 27017 --dbpath shard/shard00 ~ mongod --shardsvr --port 27018 --dbpath shard/shard01 ~ mongod --shardsvr --port 27019 --dbpath shard/shard02 ~ mongod --configsvr --port 27020 --dbpath shard/config ~ mongos --configdb localhost:27020 --port 27021
  • 54. ~ mongo localhost:27021 // mongos MongoDB shell version: 1.8.0 connecting to: localhost:27021/test > show dbs config 0.1875GB // sharding > db.adminCommand( { addshard: "localhost:27017", name: "shard00" } ) { "shardAdded" : "shard00", "ok" : 1 } > db.adminCommand( { addshard: "localhost:27018", name: "shard01" } ) { "shardAdded" : "shard01", "ok" : 1 } > db.adminCommand( { addshard: "localhost:27019", name: "shard02" } ) { "shardAdded" : "shard02", "ok" : 1 }
  • 55. > db.adminCommand( { addshard: "set00/delta1:27017,delta2:27017", name: "shard00" } ) { "shardAdded" : "shard00", "ok" : 1 } > db.adminCommand( { addshard: "set01/delta3:27018,delta4:27018", name: "shard01" } ) { "shardAdded" : "shard01", "ok" : 1 } > db.adminCommand( { addshard: "set02/delta5:27019,delta6:27019", name: "shard02" } ) { "shardAdded" : "shard02", "ok" : 1 }
  • 56. // mongos > db.adminCommand( { enablesharding : "test" } ) { "ok" : 1 } > db.adminCommand( { shardcollection : "test.myshard", key : { n : 1 } } ) { "collectionsharded" : "test.myshard", "ok" : 1 }
  • 58.
  • 59.
  • 61.
  • 62.
  • 63. // > box = [[40.73083, -73.99756], [40.741404, -73.988135]] > db.places.find({"loc" : {"$within" : {"$box" : box}}}) // > center = [50, 50] > radius = 10 > db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}}) // v1.9 > polygonA = [ [ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ] ] > polygonB = { a : { x : 10, y : 20 }, b : { x : 15, y : 25 }, c : { x : 20, y : 20 } } > db.places.find({ "loc" : { "$within" : { "$polygon" : polygonA } } }) > db.places.find({ "loc" : { "$within" : { "$polygon" : polygonB } } })
  • 64.
  • 65. ➜ ~ mongofiles list connected to: 127.0.0.1 ➜ ~ mongofiles put music1.mp3 connected to: 127.0.0.1 added file: { _id: ObjectId('4df17f8d9d47ba5c0247e72e'), filename: "music1.mp3", chunkSize: 262144, uploadDate: new Date(1307672462538), md5: "9ee9472200a2e18bf376ce622c3b0055", length: 11183104 } done! ➜ ~ mongofiles list -v // -v Fri Jun 10 11:21:05 creating new connection to:127.0.0.1 Fri Jun 10 11:21:05 BackgroundJob starting: connected to: 127.0.0.1 music.mp3 11183104
  • 66. ➜ ~ mongofiles put music2.mp3 connected to: 127.0.0.1 added file: { _id: ObjectId('4df181fc5e354129e833193f'), filename: "music2.mp3", chunkSize: 262144, uploadDate: new Date(1307673086293), md5: "9d4f424fa1843711e196e502d8a00183", length: 12225353 } done! ➜ ~ mongofiles list connected to: 127.0.0.1 music1.mp3 11183104 music2.mp3 12225353 ➜ ~ mongofiles search .mp3 connected to: 127.0.0.1 music1.mp3 11183104 music2.mp3 12225353
  • 67.