HOSTING MONGO DB & OUR
EXPERIENCE WITH DBAAS
Greg Gwozdz, CTO
ggwozdz@neoteric.eu
+48 600 306 785
MONGO DB @ NEOTERIC
Server
INITIALLY (MULTIPLE SERVERS)
Service A (.deb)
Server B
MongoDB (.deb)
Server C
Backup
Service B (.deb)
Service C (.deb)
Database ABC
Server D
Some old stuff for monitoring no one
remembers now
VM 1
LATER (CLOUD)
Service A
VM 3,4,5
MongoDB
VM 6
ELK
Database A
Database B
Database C
VM 2
Service B
Service C
Amazon S3
NOW (CONTAINERS + SERVICE)
Database Service
Database A
Database B
Database C
Container 3 Service C
Container 1 Service A
Container 2 Service B
HOSTING MONGO DB - OPTIONS
DATABASE HOSTING
own
server
server lease
cloud
docker
Database-as-a-
service
self hosting cloud platform/service
DBMS
hardware
admin
monitoring
backup
DBMS
admin
monitoring
backup
DBMS (kind of)
ALL BY MYYYY SELF…
<background singing>
SELF-HOSTING: COMPONENTS
database
server
monitoring
server
storage
server
logs & metrics
backup backup
single mongodb
server
ELK stack
file storage
SELF-HOSTING: ESTIMATES
1GB 10GB 100GB
database server 150,00 zł 150,00 zł 450,00 zł
1 * monit service (ELK) 150,00 zł 150,00 zł 150,00 zł
1 * backup server 150,00 zł 150,00 zł 150,00 zł
admin 6 000,00 zł 6 000,00 zł 12 000,00 zł
total 6 450,00 zł 6 450,00 zł 12 750,00 zł
SELF-HOSTING: PROS & CONS
CONSPROS
usually/sometimes works expensive
requires highly skilled
personnel
large backup granularity
scales terribly
poor data safety
lengthy setup &
recovery
no API
EVERYONETHINKSTHEY'RE GOOGLE
CLOUD: COMPONENTS
VM1 monitoring
service
logs & metrics
backup
VM2
VM3
backup
Amazon S3
ELK stack
mongodb
replica set
durable storage service
CLOUD: ESTIMATES
1GB 10GB 100GB
3 * databaseVM (DO) 250,00 zł 500,00 zł 1 700,00 zł
1 * monit service (ELK) 150,00 zł 150,00 zł 150,00 zł
backup (Amazon S3) 2,00 zł 20,00 zł 300,00 zł
admin 6 000,00 zł 6 000,00 zł 6 000,00 zł
total 6 402,00 zł 6 670,00 zł 8 150,00 zł
CLOUD: PROS & CONS
CONSPROS
scales well requires skilled personnel
large backup granularity
no API for databasegood data safety
lengthy setup & recovery
not suitable for some
sensitive data
DELEGATE…
DBAAS: COMPONENTS
DATABASE SERVICE
DBAAS: ESTIMATES
1GB 10GB 100GB
compose.io MongoDB 130,00 zł 850,00 zł 7 700,00 zł
mongodb.com Atlas 260,00 zł 700,00 zł 6 700,00 zł
avg 195,00 zł 775,00 zł 7 200,00 zł
CLOUD: PROS & CONS
CONSPROS
scales extremely well not suitable for some
sensitive data
no need for additional
admin personal
API for db operations
Includes backup &
monitoring
UI is sometimes slow
COMPARISON
MONTLY COST
0
3 500
7 000
10 500
14 000
1GB 10GB 100GB
self-hosted cloud dbaas
you get heavy
discounts at
this point
extremely
hight initial
cost
you don’t need
an army for
bigger
deployments
16MB = content of „Pride & Prejudice”
SETUPTIME
0
10
20
30
40
SETUP TIME [HOURS]
self-hosted cloud dbaas
BIG PICTURE
DBAAS IS NOT JUST DATABASE
DATABASE SERVICE
API
Alerts
Monitoring
OpsTools
Jenkins
Dev Env Deploy Test Env Deploy Prod Env Deploy
1. [delete database]
2. create database
3. create user
1. backup db
2. migrate & test
1. backup db
2. migrate
API #1 (CREATETOKEN)
API #2 (SAVE IT)
Have fun! It’s already revoked ;)
API #2 (SAVE IT)
curl -X GET "https://api.compose.io/deployments/$ACCOUNT/$DEPLOYMENT" 
-H 'Content-Type: application/json' 
-H 'Accept-Version: 2014-06' 
-H "Authorization: Bearer $TOKEN"
Get info about deployment
{
"id":"5679533f06babf0f35000fa5",
"name":"development",
"current_primary":"lamppost.16.mongolayer.com:10396",
"version":"2.6.9",
"members":[
"lamppost.16.mongolayer.com:10396",
"lamppost.17.mongolayer.com:10368"
],
"ignored_members":[
],
"allow_multiple_databases":true,
"status":"running",
"location":"aws:eu-west-1",
"databases":[
{
"id":"5679533f3cf38a677f00006a",
"name":"development",
"deprovision_date":null,
"status":"running",
"deployment_id":"5679533f06babf0f35000fa5",
"plan":"mongohq:elastic"
}
],
"plan":"mongohq:elastic",
"type":"mongodb"
}
API #2 (SAVE IT)
curl -X POST "https://api.compose.io/deployments/$ACCOUNT/$DEPLOYMENT/mongodb/$DB_NAME/collections" 
-H 'Content-Type: application/json' 
-H 'Accept-Version: 2014-06' 
-H "Authorization: Bearer $TOKEN" 
-d "{"name":"${DB_NAME}_init"}"
Create DB and collections
{"error":"collection already exists"}
{"ok":1}
API #2 (SAVE IT)
curl -X POST "https://api.compose.io/deployments/$ACCOUNT/$DEPLOYMENT/mongodb/$DB_NAME/users" 
-H 'Content-Type: application/json' 
-H 'Accept-Version: 2014-06' 
-H "Authorization: Bearer $COMPOSE_TOKEN" 
-d "{"username":"$DB_USER","password":"$DB_PASS","readOnly":false}"
Create db user
{"ok":1}
QUESTIONS?
Greg Gwozdz, CTO
ggwozdz@neoteric.eu
+48 600 306 785

Hosting MongoDB & our experience with database as a service

  • 1.
    HOSTING MONGO DB& OUR EXPERIENCE WITH DBAAS Greg Gwozdz, CTO ggwozdz@neoteric.eu +48 600 306 785
  • 2.
    MONGO DB @NEOTERIC
  • 3.
    Server INITIALLY (MULTIPLE SERVERS) ServiceA (.deb) Server B MongoDB (.deb) Server C Backup Service B (.deb) Service C (.deb) Database ABC Server D Some old stuff for monitoring no one remembers now
  • 5.
    VM 1 LATER (CLOUD) ServiceA VM 3,4,5 MongoDB VM 6 ELK Database A Database B Database C VM 2 Service B Service C Amazon S3
  • 7.
    NOW (CONTAINERS +SERVICE) Database Service Database A Database B Database C Container 3 Service C Container 1 Service A Container 2 Service B
  • 9.
  • 10.
    DATABASE HOSTING own server server lease cloud docker Database-as-a- service selfhosting cloud platform/service DBMS hardware admin monitoring backup DBMS admin monitoring backup DBMS (kind of)
  • 11.
    ALL BY MYYYYSELF… <background singing>
  • 12.
    SELF-HOSTING: COMPONENTS database server monitoring server storage server logs &metrics backup backup single mongodb server ELK stack file storage
  • 13.
    SELF-HOSTING: ESTIMATES 1GB 10GB100GB database server 150,00 zł 150,00 zł 450,00 zł 1 * monit service (ELK) 150,00 zł 150,00 zł 150,00 zł 1 * backup server 150,00 zł 150,00 zł 150,00 zł admin 6 000,00 zł 6 000,00 zł 12 000,00 zł total 6 450,00 zł 6 450,00 zł 12 750,00 zł
  • 14.
    SELF-HOSTING: PROS &CONS CONSPROS usually/sometimes works expensive requires highly skilled personnel large backup granularity scales terribly poor data safety lengthy setup & recovery no API
  • 15.
  • 16.
    CLOUD: COMPONENTS VM1 monitoring service logs& metrics backup VM2 VM3 backup Amazon S3 ELK stack mongodb replica set durable storage service
  • 17.
    CLOUD: ESTIMATES 1GB 10GB100GB 3 * databaseVM (DO) 250,00 zł 500,00 zł 1 700,00 zł 1 * monit service (ELK) 150,00 zł 150,00 zł 150,00 zł backup (Amazon S3) 2,00 zł 20,00 zł 300,00 zł admin 6 000,00 zł 6 000,00 zł 6 000,00 zł total 6 402,00 zł 6 670,00 zł 8 150,00 zł
  • 18.
    CLOUD: PROS &CONS CONSPROS scales well requires skilled personnel large backup granularity no API for databasegood data safety lengthy setup & recovery not suitable for some sensitive data
  • 19.
  • 20.
  • 21.
    DBAAS: ESTIMATES 1GB 10GB100GB compose.io MongoDB 130,00 zł 850,00 zł 7 700,00 zł mongodb.com Atlas 260,00 zł 700,00 zł 6 700,00 zł avg 195,00 zł 775,00 zł 7 200,00 zł
  • 22.
    CLOUD: PROS &CONS CONSPROS scales extremely well not suitable for some sensitive data no need for additional admin personal API for db operations Includes backup & monitoring UI is sometimes slow
  • 23.
  • 24.
    MONTLY COST 0 3 500 7 000 10 500 14 000 1GB 10GB100GB self-hosted cloud dbaas you get heavy discounts at this point extremely hight initial cost you don’t need an army for bigger deployments 16MB = content of „Pride & Prejudice”
  • 25.
  • 26.
  • 27.
    DBAAS IS NOTJUST DATABASE DATABASE SERVICE API Alerts Monitoring OpsTools Jenkins Dev Env Deploy Test Env Deploy Prod Env Deploy 1. [delete database] 2. create database 3. create user 1. backup db 2. migrate & test 1. backup db 2. migrate
  • 28.
  • 29.
    API #2 (SAVEIT) Have fun! It’s already revoked ;)
  • 30.
    API #2 (SAVEIT) curl -X GET "https://api.compose.io/deployments/$ACCOUNT/$DEPLOYMENT" -H 'Content-Type: application/json' -H 'Accept-Version: 2014-06' -H "Authorization: Bearer $TOKEN" Get info about deployment { "id":"5679533f06babf0f35000fa5", "name":"development", "current_primary":"lamppost.16.mongolayer.com:10396", "version":"2.6.9", "members":[ "lamppost.16.mongolayer.com:10396", "lamppost.17.mongolayer.com:10368" ], "ignored_members":[ ], "allow_multiple_databases":true, "status":"running", "location":"aws:eu-west-1", "databases":[ { "id":"5679533f3cf38a677f00006a", "name":"development", "deprovision_date":null, "status":"running", "deployment_id":"5679533f06babf0f35000fa5", "plan":"mongohq:elastic" } ], "plan":"mongohq:elastic", "type":"mongodb" }
  • 31.
    API #2 (SAVEIT) curl -X POST "https://api.compose.io/deployments/$ACCOUNT/$DEPLOYMENT/mongodb/$DB_NAME/collections" -H 'Content-Type: application/json' -H 'Accept-Version: 2014-06' -H "Authorization: Bearer $TOKEN" -d "{"name":"${DB_NAME}_init"}" Create DB and collections {"error":"collection already exists"} {"ok":1}
  • 32.
    API #2 (SAVEIT) curl -X POST "https://api.compose.io/deployments/$ACCOUNT/$DEPLOYMENT/mongodb/$DB_NAME/users" -H 'Content-Type: application/json' -H 'Accept-Version: 2014-06' -H "Authorization: Bearer $COMPOSE_TOKEN" -d "{"username":"$DB_USER","password":"$DB_PASS","readOnly":false}" Create db user {"ok":1}
  • 33.