You are on page 1of 36

dbi DBaaS with OpenStack

About me

Soufiane Benmalek
Consultant

+41 78 706 77 25
soufiane.benmalek[at]dbi-services.com

dbi DBaaS with Openstack 9/13/2017 Page 3


Agenda

1.What is OpenStack?
2.DBaaS – Database as a Service
3.dbi DBaaS
4.Demo

dbi DBaaS with Openstack 9/13/2017 Page 4


What is OpenStack?

1
! Introduction
! History
! Architecture 2

dbi DBaaS with Openstack 9/13/2017 Page 5


What is OpenStack?
Introduction

Open source cloud platform


! Oriented Infrastructure as a Service

Built to drive both private and public clouds

dbi DBaaS with Openstack 9/13/2017 Page 6


What is OpenStack?
Introduction

Not the only open source cloud solution


! One of four open source private cloud platforms

dbi DBaaS with Openstack 9/13/2017 Page 7


What is OpenStack?
History

Project started in July 2010


! Collaboration between NASA and Rackspace

November 2010
! First OpenStack release: Austin

A 6 month release cycle


! Announced at each OpenStack Summit (twice a year)

Currently
! 16th OpenStack release: Pike

dbi DBaaS with Openstack 9/13/2017 Page 8


What is OpenStack?
History

Source: https://releases.openstack.org/
dbi DBaaS with Openstack 9/13/2017 Page 9
What is OpenStack?
Architecture

Source: https://docs.openstack.org/install-guide/_images/openstack-arch-kilo-logical-v1.png
dbi DBaaS with Openstack 9/13/2017 Page 10
What is OpenStack?
Architecture

OpenStack is not monolithic


! More than 30 components (all have a codename)
! Only core components are mandatory
! 100% Python based
! Each OpenStack component exposes an API

Dashboard Identity
(Horizon) service

Compute Block storage Networking Image service

(Nova) (Cinder) (Neutron) (Glance) (Keystone)

dbi DBaaS with Openstack 9/13/2017 Page 11


What is OpenStack?
Architecture

Keystone
Provides a token service
for validating Token
subsequent requests

Provides an Validates the identity of


Keystone any registered entities
authorization engine for Policy Identity
users, tenants, and
domains

Maintains a list of
Catalog
OpenStack service
endpoints

dbi DBaaS with Openstack 9/13/2017 Page 12


What is OpenStack?
Architecture

Nova
! Provides virtualization capabilities within the OpenStack cloud
! Supports multiple hypervisors
> KVM, vSphere, Xen, Hyper-V
! Supports containers
> LXC, Docker

root@infra01-utility-container-0262b23b:~# openstack server create --image cirros --flavor


m1.tiny --nic net-id=bdad37e3-ea63-49ea-a3ff-0e5fe2a8725b Test-Instance

root@infra01-utility-container-0262b23b:~# openstack server list


+--------------------------------------+--------------------------+---------+-----------------------------------------------------+--------------+--------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+--------------------------+---------+-----------------------------------------------------+--------------+--------+
| 284439f5-952c-4497-808f-55ab115592ff | AnsibleMaster | ACTIVE | Ext-Net=144.217.247.191, 2607:5300:201:2100::2:d534 | Centos 7 | s1-4 |
| 7e6dcd6c-7930-40ff-aeeb-e618a9272b69 | juju-71078c-default-1 | SHUTOFF | Ext-Net=142.44.164.196, 2607:5300:201:2100::2:d01b | Ubuntu 16.04 | s1-2 |
| 2a46a684-ac4d-4f02-958e-c9b823858253 | juju-9154d5-controller-0 | SHUTOFF | Ext-Net=142.44.164.130, 2607:5300:201:2100::2:d004 | Ubuntu 16.04 | s1-4 |
+--------------------------------------+--------------------------+---------+-----------------------------------------------------+--------------+--------+

dbi DBaaS with Openstack 9/13/2017 Page 13


What is OpenStack?
Architecture

Glance
! Every instance needs an OS to boot up
! Pre-made images
! OS on demand
! Supports multiple image formats (RAW, qcow2, VMDK, AMI, etc...)
! Supports multiple backends (File, Ceph, Swift, Cinder)

root@infra01-utility-container-0262b23b:~# glance image-create --name 'image_name' -


-disk-format qcow2 --container-format bare --is-public True ..

root@infra01-utility-container-0262b23b:~# glance image-list


+--------------------------------------+-----------------+
| ID | Name |
+--------------------------------------+-----------------+
| db770ecb-02e4-4b60-851d-e4265825a6f8 | cirros |
| 0ef21463-c965-410f-bd49-d0474ef566b2 | percona |
+--------------------------------------+-----------------

dbi DBaaS with Openstack 9/13/2017 Page 14


What is OpenStack?
Architecture

Cinder
! By default instances have ephemeral storage
! Provides persistent storage devices to instances
! Supports migration, backups
! Instances can boot from an volume

[centos@ansiblemaster dbaas_project]$ openstack volume create <Name of the Volume>

[centos@ansiblemaster dbaas_project]$ openstack volume list


+--------------------------------------+-------------+-----------+------+-------------+
| ID | Name | Status | Size | Attached to |
+--------------------------------------+-------------+-----------+------+-------------+
| 75b873e0-3d4f-4859-8297-a2d32a065ea9 | mdb1-backup | available | 20 | |
| 8eb8748f-2ef6-4a92-ad0c-b6901b70e161 | mdb1-data | available | 20 | |
| cbef2beb-be53-43a3-b4a5-9154f3743d5d | mdb1-bin | available | 20 | |
+--------------------------------------+-------------+-----------+------+-------------+

dbi DBaaS with Openstack 9/13/2017 Page 15


What is OpenStack?
Architecture

Neutron
! Provides network as a service between instances within the cloud
! Supports multiple technologies
> VXLAN, GRE

! Ability to create networks

$ root@infra01-utility-container-0262b23b:~# neutron net-create test-net

! Ability to create subnets

$ root@infra01-utility-container-0262b23b:~# neutron subnet-create --name test-subnet


--dns-nameserver 8.8.8.8 test-net 10.0.6.0/2

dbi DBaaS with Openstack 9/13/2017 Page 16


What is OpenStack?
Architecture

Horizon
! Codename for the OpenStack dashboard
! User friendly
! Can be customized easily

dbi DBaaS with Openstack 9/13/2017 Page 17


What is OpenStack?
Distributions

Multiple ways to install OpenStack Handles the OpenStack lifecycle


! Manually
> Not recommended at all
Bugs
! Automatically fixing
> Via distributions

Upgrades Support

Best
Security
practices

dbi DBaaS with Openstack 9/13/2017 Page 18


What is OpenStack?
Solutions

OpenStack-Ansible
! 30 companies contribute to this project
! Uses Ansible for deployment
! Isolation
> Each OpenStack service runs in a LinuxContainer (LXC)
! Supports multiple OS
> CentOS 7, RHEL 7.2, Ubuntu 14.04 & 16.04, openSUSE 42.x
! Really good documentation
! Can be deployed on one host (AIO) for testing Source: http://stackalytics.com/?module=openstack-ansible&release=pike

training@infra01:~$ sudo lxc-ls --fancy


NAME STATE AUTOSTART GROUPS IPV4
infra01_galera_container-4c7808d6 RUNNING 1 onboot, openstack 10.255.255.67, 172.29.237.108
-
infra01_galera_container-ca097d4e RUNNING 1 onboot, openstack 10.255.255.34, 172.29.239.223
-
infra01_galera_container-daa05d15 RUNNING 1 onboot, openstack 10.255.255.12, 172.29.236.191
-

dbi DBaaS with Openstack 9/13/2017 Page 19


DBaaS – Database as a service

1
! Project overview
! Market comparison
! Approach 2
! Compare automation tools
3

dbi DBaaS with Openstack 9/13/2017 Page 20


DBaaS – Database as a service
Project overview

dbi services decided to start a DBaaS project


! Using existing technologies?
! Develop our own?

Be more flexible than some existing DBaaS technologies

Project specifications
! Must run on OpenStack
! First focus is made on MySQL/MariaDB for now
! Must enable the use of dbi services best practices
! Create a turnkey solution for our customers

dbi DBaaS with Openstack 9/13/2017 Page 21


DBaaS – Database as a service
Market comparison

Trove
! OpenStack component for deploying databases as a service
! First integrated in Icehouse release
! Multiple datastores
! Supports the latest OpenStack versions
! Runs an agent on the deployed databases
! Two types of images
> Open source images (not recommended for production)
> Enterprises images
! Images built using disk-image-builder tool
training@infra01:~$ git clone https://git.openstack.org/openstack/diskimage-builder
Cloning into 'diskimage-builder'...

training@infra01:~$ export ELEMENTS_PATH=~/some_path/elements

training@infra01:~$ disk-image-create -t qcow2 -o my_image ubuntu vm

dbi DBaaS with Openstack 9/13/2017 Page 22


DBaaS – Database as a service
Market comparison

EDB Ark
! Developed by EDB enterprise
! Deploy PostgreSQL databases in OpenStack
! Web User Interface
! Available for other cloud platforms
> AWS, Azure
! Can be used for free
> Only pay for compute resources

training@infra01:~$ glance image-create --name 'image_name' --disk-format qcow2 --


container-format bare --is-public True ..

dbi DBaaS with Openstack 9/13/2017 Page 23


DBaaS – Database as a service
Market comparison

It works Well, it works also

Only “give me a database” Only PostgreSQL databases

Uses an agent on remote server Only compatible with old


OpenStack releases

Need to pay for enterprise images Not flexible

dbi DBaaS with Openstack 9/13/2017 Page 24


DBaaS – Database as a Service
Approach

No DBaaS framework matches the project specifications


! Need to develop our own

How?
! Automation tool Package Compare
> Easy to use, flexible the automation
! Packaging the solution solution tools
> Not a bunch of scripts

Project specifications
! Must run on OpenStack Choose one
! First focus is made on MySQL/MariaDB for now
! Must enable the use of dbi services best practices
! Create a turnkey solution for our customers

dbi DBaaS with Openstack 9/13/2017 Page 25


DBaaS – Database as a service
Compare automation tools

Heat resources:
my_instance:
! Comes Out of the box type: OS::Nova::Server
! Employs a template language called HOT properties:
key_name: { get_param: key_name }
> 100% YAML based image: { get_param: image }
flavor: { get_param: flavor }
! Uses OpenStack resources networks: [{network: {get_param: network} }]

heat_template_version: 2014-10-16
description: |
Sample instance
resources:
instance:
type: OS::Nova::Server
properties:
flavor: m1.small
image: ubuntu-trusty-x86_64
networks:
- network: private

root@infra01-utility-container-0262b23b:~# openstack stack create -t OIDAY2017.yml StackOIDAY

dbi DBaaS with Openstack 9/13/2017 Page 26


DBaaS – Database as a service
Compare automation tools

Juju
! Many providers
> OpenStack, AWS, Azure, vSphere
$ training@infra01:~$ juju add-cloud ovh IODAY.yaml

! Private clouds
! Public clouds
> Ask the provider to give you metadata
$ training@infra01:~$ juju metadata generate-image -d ~/simplestreams -i $IMAGE_ID -s
$OS_SERIES -r $REGION -u http://$KEYSTONE_IP:5000/v2.0/

! Deploys charms

$ training@infra01:~$ juju deploy mysql

dbi DBaaS with Openstack 9/13/2017 Page 27


DBaaS – Database as a Service
Compare automation tools

Terraform
! Developed by HashiCorp
! Tool for provisioning infrastructure in an easy and repeatable way
! Supports many providers
> OpenStack, AWS, Google Cloud Platform, VMware, Microsoft Azure, etc.
! Multiple provisioners
> Ansible (through plugin), Chef, File, Shell, etc.
# Configure the OpenStack Provider
provider "openstack" {
user_name = "admin"
tenant_name = "admin"
password = "pwd"
auth_url = "http://myauthurl:5000/v2.0"
region = "RegionOne"
}

# Create a web server


resource "openstack_compute_instance_v2" "test-server"
{
# ...
}

dbi DBaaS with Openstack 9/13/2017 Page 28


DBaaS – Database as a Service
Compare automation tools

Ansible
! Configuration tool
! 100% YAML based
! Built-in OpenStack modules (os_server, os_volume, os_auth)
> Via SHADE à OpenStack SDK
! Tasks are written in playbooks
- name: Create a new instance and attaches to a
network and passes metadata to the instance
os_server:
state: present
auth:
auth_url: https://auth_url/v2
username: admin
password: admin
project_name: admin
name: vm1
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
key_name: ansible_key
flavor: 4
nics:
- net-id: 34605f38-e52a-25d2-b6e

dbi DBaaS with Openstack 9/13/2017 Page 29


DBaaS – Database as a Service
Compare automation tools

Criteria Heat Juju Ansible Terraform


af
OpenStack Native
Full Stack Actions
Native scale-out
Customize Apps
GUI

Portable on OpenStack
Portable on any cloud

dbi DBaaS with Openstack 9/13/2017 Page 30


dbi DBaaS

1
! Architecture
! Packaging
! Demo 2

dbi DBaaS with Openstack 9/13/2017 Page 31


dbi DBaaS
Architecture

The image is
The end user The databases are
uploaded to
launches a script deployed
OpenStack (or not)

dbi DBaaS with Openstack 9/13/2017 Page 32


dbi DBaaS
Packaging

Packer
! Open source tool developed by HashiCorp
! Automate the creation of any machine images
! Runs on every major operating systems

Different output
image formats :
RAW, qcow2, ISO,
Builds on AMI

What our image contains?


! Ansible playbooks
! All databases binaries
! DMK Management Kit

dbi DBaaS with Openstack 9/13/2017 Page 33


dbi DBaaS
Packaging

Packer
$ training@infra01:~$ cat myraw.json
{
"builders":
[
{
"type": "qemu",
"iso_url": "http://mirror.raystedman.net/centos/7/isos/x86_64/CentOS-7-x86_64-
Minimal-1611.iso",
"output_directory": "output_centos_tdhtest",
"shutdown_command": "shutdown -P now",
"disk_size": 5000,
"format": "qcow2",

$ training@infra01:~$ packer build myraw.json


==> qemu: Downloading or copying ISO
http://mirror.raystedman.net/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso
==> qemu: Creating hard drive...

dbi DBaaS with Openstack 9/13/2017 Page 34


dbi DBaaS
Demo

dbi DBaaS with Openstack 9/13/2017 Page 35


Conclusion
Just a first step…

So far… Coming next…


! DBaaS server packaged ! Automated MySQL database creation
! Support for additional databases
! Full stack automation > PostgreSQL
> MongoDB
! Flexibility > …
> Multi-version support
> Multi-server support ! Graphical interface

! Does not require any OpenStack knowledge


! Additional cloud platform support

dbi DBaaS with Openstack 9/13/2017 Page 36


Basel
Delémont Zürich

Nyon

Any questions?
Please do ask!
We would love to boost
your IT-Infrastructure
How about you?
dbi DBaaS with Openstack 9/13/2017 Page 37

You might also like