SlideShare a Scribd company logo
MongoDBEurope2016
Old Billingsgate, London
15th November
mongodb.com/europe
Registratevi con il codice massimobrignoli20
per il 20% di sconto
Massimo Brignoli
Principal Solution Architect, EMEA
@massimobrignoli
Back to Basics 2016 : Webinar 6
Messa in Esercizio
Riassunto
• Webinar 1 – Introduzione a NoSQL
– I diversi tipi di database NoSQL
– MongoDB come document database
• Webinar 2 – La nostra prima applicazione
– Creazione di database e collectione
– CRUD, indici e explain
• Webinar 3 – Schema Design
– Schema dinamico
– Approcci all’Embedding
• Webinar 4 –Indici Full-Text e geospaziali
• Webinar 5 – Aggregation Framework
Perché la Replicazione?
• Quanto spesso avete avuto dei fermi di server?
• Quanti sono stati svegliati dal sonno per fare un failover?
• Quanti hanno avuto problemi a causa della rete lenta?
• Differenziare il workload
– Normal processing
– Analytics
Replica Set – Creazione
Replica Set – Inizializzazione
Replica Set – Rottura
Replica Set – Failover
Replica Set – Recovery
Replica Set – Recovered
Scaling
Working Set Eccede la Memoria Fisica
Quando Considerare lo Sharding?
• Quando una risorsa specifica diventa un collo di bottoglia su
una macchina singola o su un replica set
• RAM
• Disk IO
• Storage
• Concurrency
Scalabilità Verticale (Scale Up)
Scalabilità Orizzontale (Scale Out)
Partizionamento
• L’utente definisce una chiave di sharding
• La chiave di sharding definisce un intervallo di dati
• Lo spazio delle chiavi è come I punti di una linea
• Un intervallo è un segmento di quella linea
Distribuzione dei Dati
• Inizialmente 1 chunk
• Gradezza dei chunk di default: 64MB
• MongoDB divide e migra i chunk automaticamente
Che cosa è un Shard?
• Shard è un elemento del cluster
• Shard può essere un singolo mongod o un replica set
Meta Data Storage
• Config Server
– Memorizza gli intervalli dei chunk e il posizionamento
– Può avere 1 o 3 membri (in produzione sono 3)
– E’- un replica set
Indirizzare e Gestire I Dati
• Mongos
– Si comporta come un router/balancer
– Non ha dati locali (che persistono nel database di config)
– Possono essercene 1 o tanti
Sharding infrastructure
Backup & Restore
Tools & Tecniche
• mongodump & mongorestore
• Copia del Files system
• Files system snapshot
• Non usate mongoimport & mongoexport!
//mongodump Example
server> mongodump -h myhost -d cms -c articles
Mongodump
• Crea un .bson file
– (e un file json di metadati)
– Sulla rete o sul file system.
>mongodump –h myhost -d cms -c articles
connected to: myhost
2014-04-16T12:54:56.758+0100 DATABASE: cms to dump/cms
2014-04-16T12:54:56.759+0100 cms.articles to
dump/cms/articles.bson
2014-04-16T12:54:56.816+0100 7 documents
2014-04-16T12:54:56.817+0100 Metadata for cms.articles to
dump/cms/articles.metadata.json
Da dove posso fare i backup?
• Sulla rete può introdurre dei page faults
• I nodi Primary e Secondary sono identici
– A parte la latenza
• Usate secondary per backup
– Oppure hidden secondary
mongodump
Consistenza dei Dati di Backup
• I dati potenzialmente possono essere inconsistenti
– mongodump legge i file del database sequenziale
– Per esempio, fate update di oggetti uno prima e uno dopo il backup
• Due opzioni per mantenere l’integrità dei dati
– Usate il parametro –oplog switch sul mongodump.
– Lockate il database in scrittura durante il backup
Esempi di --oplog e --oplogReplay
//Backup with –oplog
//--oplog richiede di effettuare il backup di tutti I
database/collection di quel server
>mongodump –h myhost –oplog
//Per fare il restore usate mongorestore con il parametro
--oplogRelay switch
>mongorestore –h myhost –oplogReplay ./cms/dump
Lock del Database in Scrittura
• Sia per I nodi primari che secondari
– Fa il flish dei dati su disco e fa il lock di tutte le scritture
– Usate db.fsyncLock() & db.fsyncUnlock()
//use fsync and lock from the mongo shell
> db.fsyncLock()
{
"info" : "now locked against writes, use db.fsyncUnlock() to
unlock",
"seeAlso" : "http://dochub.mongodb.org/core/fsynccommand",
"ok" : 1
}
//Perform file system backup… then unlock with… unlocked
secondaries will catchup.
> db.fsyncUnlock()
{ "ok" : 1, "info" : "unlock completed" }
Backup a livello di Storage-level
• Copiate I file della vostra directory dei dati (e.g. /data/db)
– Da usare assieme a fsync+lock
• File system or block storage snapshot
– Ad esempio snapshot LVM
• Metodo più veloce di backup/restore
• Considerazioni
– Journal, Consistenza
– Granularità del Backup (whole file system back up?)
– Esperienza di Ops
– Dove memorizzare I backup o gli snapshopt?
Backup di un Cluster Sharded
• Fermate il processo di bilanciamento
– Aspettate le fine delle migrazioni in corso
– Fate il backup di ogni shard
– Non dimenticate di fare il backup del config!
//Switch the balancer off…
mongos> sh.setBalancerState(false)
//Check to see if the balance is currently doing any migrations.
mongos> sh.isBalancerRunning()
Recovery
• In caso di una failure
– Restore dal backup
• Snapshot / mongodump etc.
• Restart del nodo
– Re-sync da un altro nodo
• I file possono essere copiato da un membro di un replica set all’altro.
• O I dati se non sono troppo grandi possono essere sincronizzati via network
Monitoring Tools
Tools
• I Tool chiave di MongoDB
– Mongostat
– Mongo shell
– Mongo Management Service mms
• Mtools
– Logs
• OS
– iostat
Architettura di Ops/Cloud Manager
Collezione di Metriche e Reportistica
Mongostat
• Accesso alle statistiche chiave
– Collegare a un mongod o un mongos fot I cluster in shardind
– Viualizza operazione al secondo/ memoria usate, page faults, code ecc.
>mongostat -h localhost --port 27017
connected to: localhost:27017
insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:24
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:25
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:26
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:27
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:28
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:29
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:30
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:31
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.1% 0 0|0 0|0 62b 5k 2 09:08:32
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:33
Mongo shell
• Comandi per accedere alle metriche
– db.serverStatus()
//to access a subset of serverStatus output specify the sub
document
>db.serverStatus().mem
{
"bits" : 64,
"resident" : 266,
"virtual" : 5920,
"supported" : true,
"mapped" : 1712,
"mappedWithJournal" : 3424
}
Logs
Definite il livello di log
• Aumentate il livello di log
– Per vedere maggior informazioni sulle performance delle operazioni
– Efficienza degli indici
– Spostamenti di documenti
– Tempo di esecuzione delle operazioni
//Increase log level verbosity from the shell
> db.adminCommand( { setParameter:1, logLevel:1 } )
{ "was" : 0, "ok" : 1 }
>
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
Esempio di output del Log
• Problemi di Pinpoint
– In questo esempio possiamo vedere che c’è stato uno spostamento del
documento
2014-05-02T13:55:02.047+0100 [conn7] update cms.articles query: { _id:
ObjectId('532198379fb5ba99a6bd4063') } update: { $inc: { comment_count: 1 }, $push: {
comments: { $each: [ { date: new Date(1399035302013), text: "Data locality provides an
amazing performance boost over relational" } ], $slice: -10, $sort: { date: 1 } } } }
nscanned:1 nscannedObjects:1 nmoved:1 nMatched:1 nModified:1 keyUpdates:0
numYields:0 locks(micros) w:33529 33ms
Visual Query Profiler
New Relic Integration
Saturazione del Disco
Tool del Sistema Operativo
• iostat
– Utilizzo dell’IO dei dischi
– Controllate la % di utilizzo del disco
– Un’alta percentuale
• Se è sostenuta, dovresti aumentare l’IO del disco
– Sharding
– RAID 1+0
– Partizionare su dischi differenti
– Provisioned IOPS
prompt> iostat –xmt 1
Sommario
• Dimensione in modo opportuno sul vostro working set
• Shard solo quando ne avete bisogno, non prima
• Attenzione a scegliere la shard key!
• Scegliere la soluzione di backup giusta per voi
• Attenzione al livello di integrità dei dati richiesto
• Recovery
– Dal Backup o da un altro secondary
• Cloud/Ops Manager Backup disponibile
Questions?
Back to Basics, webinar 6: Messa in esercizio

More Related Content

What's hot

Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning
Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance TuningWebinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning
Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning
MongoDB
 
Database NoSql Document Oriented - MongoDB
Database NoSql Document Oriented - MongoDBDatabase NoSql Document Oriented - MongoDB
Database NoSql Document Oriented - MongoDB
Matteo Merola
 
SaaS con Symfony2
SaaS con Symfony2SaaS con Symfony2
SaaS con Symfony2
Matteo Moretti
 
PostgreSQL: Prima configurazione
PostgreSQL: Prima configurazionePostgreSQL: Prima configurazione
PostgreSQL: Prima configurazione
Enrico Pirozzi
 
How to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no JavascriptHow to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no Javascript
Andrea Tosato
 
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterMySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
Par-Tec S.p.A.
 
PostgreSQL : Tuning
PostgreSQL : TuningPostgreSQL : Tuning
PostgreSQL : Tuning
Enrico Pirozzi
 
The Google File System
The Google File SystemThe Google File System
The Google File System
Alessandra Zullo
 
Web performance & Http2
Web performance & Http2Web performance & Http2
Web performance & Http2
Giacomo Zinetti
 
2014 it - app dev series - 04 - indicizzazione
2014   it - app dev series - 04 - indicizzazione2014   it - app dev series - 04 - indicizzazione
2014 it - app dev series - 04 - indicizzazioneMongoDB
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009
Massimiliano Dessì
 
Php concetti chiave di base
Php concetti chiave di basePhp concetti chiave di base
Php concetti chiave di baseWalter Liguori
 
SQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with SparkSQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with Spark
Alessio Biasiutti
 
20140311 app dev series - 01 - introduction - italian
20140311   app dev series - 01 - introduction - italian20140311   app dev series - 01 - introduction - italian
20140311 app dev series - 01 - introduction - italianMongoDB
 
Cloud storage in azienda: perche` Riak ci e` piaciuto
Cloud storage in azienda: perche` Riak ci e` piaciutoCloud storage in azienda: perche` Riak ci e` piaciuto
Cloud storage in azienda: perche` Riak ci e` piaciuto
BioDec
 
node.js e Postgresql
node.js e Postgresqlnode.js e Postgresql
node.js e Postgresql
Lucio Grenzi
 
Session 02 - schema design e architettura
Session 02 - schema design e architetturaSession 02 - schema design e architettura
Session 02 - schema design e architetturaMongoDB
 

What's hot (20)

Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning
Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance TuningWebinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning
Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning
 
MongoDB
MongoDBMongoDB
MongoDB
 
Database NoSql Document Oriented - MongoDB
Database NoSql Document Oriented - MongoDBDatabase NoSql Document Oriented - MongoDB
Database NoSql Document Oriented - MongoDB
 
SaaS con Symfony2
SaaS con Symfony2SaaS con Symfony2
SaaS con Symfony2
 
PostgreSQL: Prima configurazione
PostgreSQL: Prima configurazionePostgreSQL: Prima configurazione
PostgreSQL: Prima configurazione
 
How to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no JavascriptHow to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no Javascript
 
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterMySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
 
PostgreSQL : Tuning
PostgreSQL : TuningPostgreSQL : Tuning
PostgreSQL : Tuning
 
The Google File System
The Google File SystemThe Google File System
The Google File System
 
Web performance & Http2
Web performance & Http2Web performance & Http2
Web performance & Http2
 
2014 it - app dev series - 04 - indicizzazione
2014   it - app dev series - 04 - indicizzazione2014   it - app dev series - 04 - indicizzazione
2014 it - app dev series - 04 - indicizzazione
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009
 
Php concetti chiave di base
Php concetti chiave di basePhp concetti chiave di base
Php concetti chiave di base
 
SQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with SparkSQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with Spark
 
20140311 app dev series - 01 - introduction - italian
20140311   app dev series - 01 - introduction - italian20140311   app dev series - 01 - introduction - italian
20140311 app dev series - 01 - introduction - italian
 
Cloud storage in azienda: perche` Riak ci e` piaciuto
Cloud storage in azienda: perche` Riak ci e` piaciutoCloud storage in azienda: perche` Riak ci e` piaciuto
Cloud storage in azienda: perche` Riak ci e` piaciuto
 
Apache Parte 2
Apache Parte 2Apache Parte 2
Apache Parte 2
 
Apache Parte 1
Apache Parte 1Apache Parte 1
Apache Parte 1
 
node.js e Postgresql
node.js e Postgresqlnode.js e Postgresql
node.js e Postgresql
 
Session 02 - schema design e architettura
Session 02 - schema design e architetturaSession 02 - schema design e architettura
Session 02 - schema design e architettura
 

Similar to Back to Basics, webinar 6: Messa in esercizio

Implementazione DAOS in ambienti enterprise
Implementazione DAOS in ambienti enterpriseImplementazione DAOS in ambienti enterprise
Implementazione DAOS in ambienti enterprise
Luca Arcara
 
Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...
Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...
Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...
Fulvio Corno
 
Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...
MariaDB plc
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
Emanuele Zanchettin
 
Jvm performance Tuning
Jvm performance TuningJvm performance Tuning
Jvm performance Tuning
Marco Sabatini
 
Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...
Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...
Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...
Codemotion
 
Codemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi Cluster
Codemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi ClusterCodemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi Cluster
Codemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi Cluster
Matteo Baccan
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
Emanuele Zanchettin
 
Richiami su Linux - Webmin - Reti di calcolatori
Richiami su Linux - Webmin - Reti di calcolatoriRichiami su Linux - Webmin - Reti di calcolatori
Richiami su Linux - Webmin - Reti di calcolatori
Fulvio Corno
 
PostgrSQL 9.3&9.4 - DjangoVillage
PostgrSQL 9.3&9.4 - DjangoVillagePostgrSQL 9.3&9.4 - DjangoVillage
PostgrSQL 9.3&9.4 - DjangoVillage
Miriade Spa
 
Working between the clouds (versione completa)
Working between the clouds (versione completa)Working between the clouds (versione completa)
Working between the clouds (versione completa)
Davide Cerbo
 
Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2Emanuele Zanchettin
 
Introduzione User Mode Linux
Introduzione User Mode LinuxIntroduzione User Mode Linux
Introduzione User Mode LinuxMajong DevJfu
 
Linux Capabilities - ita - v2.1.5 - compatta
Linux Capabilities - ita - v2.1.5 - compattaLinux Capabilities - ita - v2.1.5 - compatta
Linux Capabilities - ita - v2.1.5 - compatta
Alessandro Selli
 
Performance e Drupal
Performance e DrupalPerformance e Drupal
Performance e Drupal
Vincenzo Di Biaggio
 
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDBPolyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Steve Maraspin
 
TYPO3 CMS 7.6 - Le novita
TYPO3 CMS 7.6 - Le novitaTYPO3 CMS 7.6 - Le novita
TYPO3 CMS 7.6 - Le novita
Roberto Torresani
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
Par-Tec S.p.A.
 
TYPO3 CMS 8.1 - Le novità
TYPO3 CMS 8.1 - Le novitàTYPO3 CMS 8.1 - Le novità
TYPO3 CMS 8.1 - Le novità
Roberto Torresani
 

Similar to Back to Basics, webinar 6: Messa in esercizio (20)

Implementazione DAOS in ambienti enterprise
Implementazione DAOS in ambienti enterpriseImplementazione DAOS in ambienti enterprise
Implementazione DAOS in ambienti enterprise
 
Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...
Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...
Componenti dello stack LAMP - PHP, il linguaggio, l'installazione - MySQL, in...
 
Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...
 
Quickr In Real Life - casi di successo di QuickR
 Quickr In Real Life - casi di successo di QuickR Quickr In Real Life - casi di successo di QuickR
Quickr In Real Life - casi di successo di QuickR
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
 
Jvm performance Tuning
Jvm performance TuningJvm performance Tuning
Jvm performance Tuning
 
Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...
Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...
Succo di lampone: come ottimizzare JAVA e PHP su un'architettura Raspberry Pi...
 
Codemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi Cluster
Codemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi ClusterCodemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi Cluster
Codemotion 2014 : ottimizzare JAVA e PHP su un’architettura Raspberry Pi Cluster
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
 
Richiami su Linux - Webmin - Reti di calcolatori
Richiami su Linux - Webmin - Reti di calcolatoriRichiami su Linux - Webmin - Reti di calcolatori
Richiami su Linux - Webmin - Reti di calcolatori
 
PostgrSQL 9.3&9.4 - DjangoVillage
PostgrSQL 9.3&9.4 - DjangoVillagePostgrSQL 9.3&9.4 - DjangoVillage
PostgrSQL 9.3&9.4 - DjangoVillage
 
Working between the clouds (versione completa)
Working between the clouds (versione completa)Working between the clouds (versione completa)
Working between the clouds (versione completa)
 
Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2
 
Introduzione User Mode Linux
Introduzione User Mode LinuxIntroduzione User Mode Linux
Introduzione User Mode Linux
 
Linux Capabilities - ita - v2.1.5 - compatta
Linux Capabilities - ita - v2.1.5 - compattaLinux Capabilities - ita - v2.1.5 - compatta
Linux Capabilities - ita - v2.1.5 - compatta
 
Performance e Drupal
Performance e DrupalPerformance e Drupal
Performance e Drupal
 
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDBPolyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
 
TYPO3 CMS 7.6 - Le novita
TYPO3 CMS 7.6 - Le novitaTYPO3 CMS 7.6 - Le novita
TYPO3 CMS 7.6 - Le novita
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
 
TYPO3 CMS 8.1 - Le novità
TYPO3 CMS 8.1 - Le novitàTYPO3 CMS 8.1 - Le novità
TYPO3 CMS 8.1 - Le novità
 

More from MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB
 

More from MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Back to Basics, webinar 6: Messa in esercizio

  • 1. MongoDBEurope2016 Old Billingsgate, London 15th November mongodb.com/europe Registratevi con il codice massimobrignoli20 per il 20% di sconto
  • 2. Massimo Brignoli Principal Solution Architect, EMEA @massimobrignoli Back to Basics 2016 : Webinar 6 Messa in Esercizio
  • 3. Riassunto • Webinar 1 – Introduzione a NoSQL – I diversi tipi di database NoSQL – MongoDB come document database • Webinar 2 – La nostra prima applicazione – Creazione di database e collectione – CRUD, indici e explain • Webinar 3 – Schema Design – Schema dinamico – Approcci all’Embedding • Webinar 4 –Indici Full-Text e geospaziali • Webinar 5 – Aggregation Framework
  • 4. Perché la Replicazione? • Quanto spesso avete avuto dei fermi di server? • Quanti sono stati svegliati dal sonno per fare un failover? • Quanti hanno avuto problemi a causa della rete lenta? • Differenziare il workload – Normal processing – Analytics
  • 5. Replica Set – Creazione
  • 6. Replica Set – Inizializzazione
  • 7. Replica Set – Rottura
  • 8. Replica Set – Failover
  • 9. Replica Set – Recovery
  • 10. Replica Set – Recovered
  • 12. Working Set Eccede la Memoria Fisica
  • 13. Quando Considerare lo Sharding? • Quando una risorsa specifica diventa un collo di bottoglia su una macchina singola o su un replica set • RAM • Disk IO • Storage • Concurrency
  • 16. Partizionamento • L’utente definisce una chiave di sharding • La chiave di sharding definisce un intervallo di dati • Lo spazio delle chiavi è come I punti di una linea • Un intervallo è un segmento di quella linea
  • 17. Distribuzione dei Dati • Inizialmente 1 chunk • Gradezza dei chunk di default: 64MB • MongoDB divide e migra i chunk automaticamente
  • 18. Che cosa è un Shard? • Shard è un elemento del cluster • Shard può essere un singolo mongod o un replica set
  • 19. Meta Data Storage • Config Server – Memorizza gli intervalli dei chunk e il posizionamento – Può avere 1 o 3 membri (in produzione sono 3) – E’- un replica set
  • 20. Indirizzare e Gestire I Dati • Mongos – Si comporta come un router/balancer – Non ha dati locali (che persistono nel database di config) – Possono essercene 1 o tanti
  • 23. Tools & Tecniche • mongodump & mongorestore • Copia del Files system • Files system snapshot • Non usate mongoimport & mongoexport! //mongodump Example server> mongodump -h myhost -d cms -c articles
  • 24. Mongodump • Crea un .bson file – (e un file json di metadati) – Sulla rete o sul file system. >mongodump –h myhost -d cms -c articles connected to: myhost 2014-04-16T12:54:56.758+0100 DATABASE: cms to dump/cms 2014-04-16T12:54:56.759+0100 cms.articles to dump/cms/articles.bson 2014-04-16T12:54:56.816+0100 7 documents 2014-04-16T12:54:56.817+0100 Metadata for cms.articles to dump/cms/articles.metadata.json
  • 25. Da dove posso fare i backup? • Sulla rete può introdurre dei page faults • I nodi Primary e Secondary sono identici – A parte la latenza • Usate secondary per backup – Oppure hidden secondary mongodump
  • 26. Consistenza dei Dati di Backup • I dati potenzialmente possono essere inconsistenti – mongodump legge i file del database sequenziale – Per esempio, fate update di oggetti uno prima e uno dopo il backup • Due opzioni per mantenere l’integrità dei dati – Usate il parametro –oplog switch sul mongodump. – Lockate il database in scrittura durante il backup
  • 27. Esempi di --oplog e --oplogReplay //Backup with –oplog //--oplog richiede di effettuare il backup di tutti I database/collection di quel server >mongodump –h myhost –oplog //Per fare il restore usate mongorestore con il parametro --oplogRelay switch >mongorestore –h myhost –oplogReplay ./cms/dump
  • 28. Lock del Database in Scrittura • Sia per I nodi primari che secondari – Fa il flish dei dati su disco e fa il lock di tutte le scritture – Usate db.fsyncLock() & db.fsyncUnlock() //use fsync and lock from the mongo shell > db.fsyncLock() { "info" : "now locked against writes, use db.fsyncUnlock() to unlock", "seeAlso" : "http://dochub.mongodb.org/core/fsynccommand", "ok" : 1 } //Perform file system backup… then unlock with… unlocked secondaries will catchup. > db.fsyncUnlock() { "ok" : 1, "info" : "unlock completed" }
  • 29. Backup a livello di Storage-level • Copiate I file della vostra directory dei dati (e.g. /data/db) – Da usare assieme a fsync+lock • File system or block storage snapshot – Ad esempio snapshot LVM • Metodo più veloce di backup/restore • Considerazioni – Journal, Consistenza – Granularità del Backup (whole file system back up?) – Esperienza di Ops – Dove memorizzare I backup o gli snapshopt?
  • 30. Backup di un Cluster Sharded • Fermate il processo di bilanciamento – Aspettate le fine delle migrazioni in corso – Fate il backup di ogni shard – Non dimenticate di fare il backup del config! //Switch the balancer off… mongos> sh.setBalancerState(false) //Check to see if the balance is currently doing any migrations. mongos> sh.isBalancerRunning()
  • 31. Recovery • In caso di una failure – Restore dal backup • Snapshot / mongodump etc. • Restart del nodo – Re-sync da un altro nodo • I file possono essere copiato da un membro di un replica set all’altro. • O I dati se non sono troppo grandi possono essere sincronizzati via network
  • 33. Tools • I Tool chiave di MongoDB – Mongostat – Mongo shell – Mongo Management Service mms • Mtools – Logs • OS – iostat
  • 35. Collezione di Metriche e Reportistica
  • 36. Mongostat • Accesso alle statistiche chiave – Collegare a un mongod o un mongos fot I cluster in shardind – Viualizza operazione al secondo/ memoria usate, page faults, code ecc. >mongostat -h localhost --port 27017 connected to: localhost:27017 insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw netIn netOut conn time *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:24 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:25 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:26 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:27 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:28 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:29 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:30 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:31 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.1% 0 0|0 0|0 62b 5k 2 09:08:32 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:33
  • 37. Mongo shell • Comandi per accedere alle metriche – db.serverStatus() //to access a subset of serverStatus output specify the sub document >db.serverStatus().mem { "bits" : 64, "resident" : 266, "virtual" : 5920, "supported" : true, "mapped" : 1712, "mappedWithJournal" : 3424 }
  • 38. Logs
  • 39. Definite il livello di log • Aumentate il livello di log – Per vedere maggior informazioni sulle performance delle operazioni – Efficienza degli indici – Spostamenti di documenti – Tempo di esecuzione delle operazioni //Increase log level verbosity from the shell > db.adminCommand( { setParameter:1, logLevel:1 } ) { "was" : 0, "ok" : 1 } > -v [ --verbose ] be more verbose (include multiple times for more verbosity e.g. -vvvvv)
  • 40. Esempio di output del Log • Problemi di Pinpoint – In questo esempio possiamo vedere che c’è stato uno spostamento del documento 2014-05-02T13:55:02.047+0100 [conn7] update cms.articles query: { _id: ObjectId('532198379fb5ba99a6bd4063') } update: { $inc: { comment_count: 1 }, $push: { comments: { $each: [ { date: new Date(1399035302013), text: "Data locality provides an amazing performance boost over relational" } ], $slice: -10, $sort: { date: 1 } } } } nscanned:1 nscannedObjects:1 nmoved:1 nMatched:1 nModified:1 keyUpdates:0 numYields:0 locks(micros) w:33529 33ms
  • 44. Tool del Sistema Operativo • iostat – Utilizzo dell’IO dei dischi – Controllate la % di utilizzo del disco – Un’alta percentuale • Se è sostenuta, dovresti aumentare l’IO del disco – Sharding – RAID 1+0 – Partizionare su dischi differenti – Provisioned IOPS prompt> iostat –xmt 1
  • 45. Sommario • Dimensione in modo opportuno sul vostro working set • Shard solo quando ne avete bisogno, non prima • Attenzione a scegliere la shard key! • Scegliere la soluzione di backup giusta per voi • Attenzione al livello di integrità dei dati richiesto • Recovery – Dal Backup o da un altro secondary • Cloud/Ops Manager Backup disponibile

Editor's Notes

  1. Who I am, how long have I been at MongoDB.
  2. Basic explanation 2 or more nodes form the set Quorum
  3. Initialize -> Election Primary + data replication from primary to secondary
  4. Primary down/network failure Automatic election of new primary if majority exists
  5. New primary elected Replication established from new primary
  6. Down node comes up Rejoins sets Recovery and then secondary
  7. Indexes should be contained in working set.
  8. From mainframes, to RAC Oracle servers... People solved problems by adding more resources to a single machine.
  9. Large scale operation can be combined with high performance on commodity hardware through horizontal scaling Build - Document oriented database maps perfectly to object oriented languages Scale - MongoDB presents clear path to scalability that isn't ops intensive - Provides same interface for sharded cluster as single instance
  10. mongodump -d cms -c articles connected to: myhost 2014-04-16T12:54:56.758+0100 DATABASE: cms to dump/cms 2014-04-16T12:54:56.759+0100 cms.articles to dump/cms/articles.bson 2014-04-16T12:54:56.816+0100 7 documents 2014-04-16T12:54:56.817+0100 Metadata for cms.articles to dump/cms/articles.metadata.json
  11. mongodump -d cms -c articles connected to: myhost 2014-04-16T12:54:56.758+0100 DATABASE: cms to dump/cms 2014-04-16T12:54:56.759+0100 cms.articles to dump/cms/articles.bson 2014-04-16T12:54:56.816+0100 7 documents 2014-04-16T12:54:56.817+0100 Metadata for cms.articles to dump/cms/articles.metadata.json