tms training
DESCRIPTION
CHT TMS training and MongoDB introduction.TRANSCRIPT
TMS system and MongoDB introduction
RICH LEE
CHT TMS Developer
richleethinkpowercomtw
TMS System Architecture
MongoDB Introduction
TMS MongoDB
QampA
2014826 CHT TMS Training 2
TMS Module CDR Parser
CDR Consolidator Data Voice Mvpn
CSV Generator
Report Usage Lumsum Frozen
Performance Report
SNMP Alarm
API
2014826 CHT TMS Training 3
TMS Module Diagram
2014826 CHT TMS Training 4
CDR process flow
2014826 CHT TMS Training 5
Parser multi-thread conceptsbull Three stages of the CDR Parser
1st Decoder (Decode worker and MongoBO)
2nd Queues (Mongo Queue)
3rd Insert into DB (Mongo worker)bull Three parser instances
Parser (CCN)
Parser (SDP)
Parser (AIR)
2014826 CHT TMS Training 6
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
TMS System Architecture
MongoDB Introduction
TMS MongoDB
QampA
2014826 CHT TMS Training 2
TMS Module CDR Parser
CDR Consolidator Data Voice Mvpn
CSV Generator
Report Usage Lumsum Frozen
Performance Report
SNMP Alarm
API
2014826 CHT TMS Training 3
TMS Module Diagram
2014826 CHT TMS Training 4
CDR process flow
2014826 CHT TMS Training 5
Parser multi-thread conceptsbull Three stages of the CDR Parser
1st Decoder (Decode worker and MongoBO)
2nd Queues (Mongo Queue)
3rd Insert into DB (Mongo worker)bull Three parser instances
Parser (CCN)
Parser (SDP)
Parser (AIR)
2014826 CHT TMS Training 6
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
TMS Module CDR Parser
CDR Consolidator Data Voice Mvpn
CSV Generator
Report Usage Lumsum Frozen
Performance Report
SNMP Alarm
API
2014826 CHT TMS Training 3
TMS Module Diagram
2014826 CHT TMS Training 4
CDR process flow
2014826 CHT TMS Training 5
Parser multi-thread conceptsbull Three stages of the CDR Parser
1st Decoder (Decode worker and MongoBO)
2nd Queues (Mongo Queue)
3rd Insert into DB (Mongo worker)bull Three parser instances
Parser (CCN)
Parser (SDP)
Parser (AIR)
2014826 CHT TMS Training 6
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
TMS Module Diagram
2014826 CHT TMS Training 4
CDR process flow
2014826 CHT TMS Training 5
Parser multi-thread conceptsbull Three stages of the CDR Parser
1st Decoder (Decode worker and MongoBO)
2nd Queues (Mongo Queue)
3rd Insert into DB (Mongo worker)bull Three parser instances
Parser (CCN)
Parser (SDP)
Parser (AIR)
2014826 CHT TMS Training 6
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
CDR process flow
2014826 CHT TMS Training 5
Parser multi-thread conceptsbull Three stages of the CDR Parser
1st Decoder (Decode worker and MongoBO)
2nd Queues (Mongo Queue)
3rd Insert into DB (Mongo worker)bull Three parser instances
Parser (CCN)
Parser (SDP)
Parser (AIR)
2014826 CHT TMS Training 6
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Parser multi-thread conceptsbull Three stages of the CDR Parser
1st Decoder (Decode worker and MongoBO)
2nd Queues (Mongo Queue)
3rd Insert into DB (Mongo worker)bull Three parser instances
Parser (CCN)
Parser (SDP)
Parser (AIR)
2014826 CHT TMS Training 6
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
What is MongoDB MongoDB is an open source document-oriented
database designed with both scalability and developer agility in mind
Instead of storing your data in tables and rows as you would with a relational database in MongoDB you store JSON-like documents with dynamic schemas(schema-free schemaless)
2014826 CHT TMS Training 7
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
MongoDB Feature
Schema-less
Document-oriented (Bson)
Scale-out
Replica set
Sharding
Rich functionality
Index Aggregation Backup
2014826 CHT TMS Training 8
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Why use MongoDB bridge the gap between key-value stores (which are fast and
scalable) and relational databases (which have rich functionality)
2014826 CHT TMS Training 9
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
MongoDB vs RDBMS
2014826 CHT TMS Training 10
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Data model
Using BSON (binary JSON) developers can easily map to modern object-oriented languages without a complicated ORM layer
2014826 CHT TMS Training 11
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Schema design
2014826 CHT TMS Training 12
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Schema design
2014826 CHT TMS Training 13
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Basic operator
2014826 CHT TMS Training 14
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
2014826 CHT TMS Training 15
Read Command in MySQL
Read Command in MongoDB
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Replica set ndash scale out
2014826 CHT TMS Training 16
1 Availability
2 Fault tolerance
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Replica set - election
2014826 CHT TMS Training 17
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Replica set consistency Only one server is active for writes (the primary) at a given time ndash
this is to allow strong consistent (atomic) operations
One can optionally send read operations to the secondaries when eventual consistency semantics are acceptable
2014826 CHT TMS Training 18
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
DB list
2014826 CHT TMS Training 19
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
User role
Login TMS MongoDB mongo --host 1010660654001 --username tmsdb mdashpassword xxxx --
authenticationDatabase admin
Use DB and count show dbs (only root uesr) use TMS_CCN_1_DB dbTMS_CCN_1_140506count()
2014826 CHT TMS Training 20
Account DB Role Description
tmsdb ROOT Super admin
cht_app Read Write Can CRUD
cht_report Read Only query data
cht_cluster Cluster admin View replica status
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Field mapping
2014826 CHT TMS Training 21
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Query definition
Equal Query
dbTMS_CCN_2_140715find(MSISDN886988413631)
Regex Query
dbTMS_CCN_2_140715find(MSISDN$regex 988413631)
And Query
dbTMS_CCN_4_140804find( $and [ MSISDN886988413631rdquo
rdquoBP886905001256rdquo ] )
Project (Select feild)
dbTMS_CCN_4_140724find( MSISDN886905004094rdquo
MSISDN 1 BP 1 TT 1 DT 1)
2014826 CHT TMS Training 22
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
2014826 CHT TMS Training 23
Query by date range GMT not local timezone
dbTMS_CCN_1_140609find( $and [ MSISDN 886905001250 TT $gte new ISODate(2014-06-16 010050652Z) DT $lte new ISODate(2014-06-16 015950652Z) ] )
Distinct Query dbTMS_CCN_1_140822distinct( MSISDN
TT $gt new ISODate(2014-08-22 050000294Z) )
Sort Query dbTMS_CCN_4_140722find( ISCSVfalse )sort( OCCR8 1 )
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Check Replica set status rsstatus()
View Replica set configuration rsconf()
Set secondary node can read rsslaveOk()
2014826 CHT TMS Training 24
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
Http Rest interface httphostportport is mongod port +1000
2014826 CHT TMS Training 25
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
MongoDB monitor mongostat --host localhost27017 --username accountmdashpassword
pass --authenticationDatabase admin
Check MongoDB log Mongolog (optmongodatalog)
2014826 CHT TMS Training 26
2014826 CHT TMS Training 27
2014826 CHT TMS Training 27