Hosting MongoDB & our experience with database as a service

Post on 09-Jan-2017

37 views 2 download

transcript

HOSTING MONGO DB & OUR EXPERIENCE WITH DBAAS

Greg Gwozdz, CTOggwozdz@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 DSome 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 CVM 2

Service B

Service C

Amazon S3

NOW (CONTAINERS + SERVICE)

Database Service

Database A

Database B

Database CContainer 3 Service C

Container 1 Service A

Container 2 Service B

HOSTING MONGO DB - OPTIONS

DATABASE HOSTING

own server

server lease

cloud

dockerDatabase-as-a-

service

self hosting cloud platform/serviceDBMShardwareadminmonitoringbackup

DBMSadminmonitoringbackup

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

CONSPROSusually/sometimes works expensive

requires highly skilled personnel

large backup granularity

scales terribly

poor data safety

lengthy setup & recovery

no API

EVERYONE THINKS THEY'RE GOOGLE

CLOUD: COMPONENTS

VM1 monitoring service

logs & metrics

backup

VM2

VM3

backup

Amazon S3

ELK stackmongodb replica set

durable storage service

CLOUD: ESTIMATES

1GB 10GB 100GB

3 * database VM (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

CONSPROSscales 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

CONSPROSscales 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

costyou don’t need

an army for bigger

deployments

16MB = content of „Pride & Prejudice”

SETUP TIME

0

10

20

30

40

SETUP TIME [HOURS]

self-hosted cloud dbaas

BIG PICTURE

DBAAS IS NOT JUST DATABASE

DATABASE SERVICE

API

Alerts

Monitoring

Ops Tools

JenkinsDev Env Deploy Test Env Deploy Prod Env Deploy

1. [delete database]2. create database3. create user

1. backup db2. migrate & test

1. backup db2. migrate

API #1 (CREATE TOKEN)

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