Code Monkey home page Code Monkey logo

masakari-deploy's Introduction

Vagrant project with devstack and Chef recipes for Masakari

What is masakari-deploy ?

It contains Vagrantfile and chef recipes to deploy three VMs including OpenStack and Masakari. You will be able to test and demonstrate the way how Masakari works on your laptop.

How to use ?

Prerequisites

  • vagrant

  • vagrant box of ubuntu/trusty64 (or centos/7 for cent OS)

    For Ubuntu,

    $ vagrant box add ubuntu/trusty64

    For CentOS,

    $ vagrant box add centos/7

Deployment

  • creating three VMs consisting of Controller, Compute1 and Compute2.

    Default Vagrant file use the ubuntu/trusty64 box.

    Change config.vm.box = "centos/7" to build masakari with centOS.

    To successfully build centos environment, you might need to install vagrant-vbguest plugin

    $ vagrant plugin install vagrant-vbguest
    $ vagrant up
    $ vagrant status
    Current machine states:
    
    controller                running (virtualbox)
    compute1                  running (virtualbox)
    compute2                  running (virtualbox)
  • deploy OpenStack in Controller

    $ vagrant ssh controller
    vagrant@controller:~$ sudo -i
    root@controller:~# su - stack
    stack@controller:~$ cd devstack/
    stack@controller:~/devstack$ ./stack.sh
  • prepare masakari-controller database in Controller

    stack@controller:~/devstack$ cd ~/masakari/
    stack@controller:~/masakari$ ./masakari_database_setting.sh
  • start masakari-controller in Controller

    In Ubuntu,

    stack@controller:~/masakari$ sudo service masakari-controller start

    In CentOS,

    stack@compute1:~/devstack$ sudo systemctl enable masakari-controller.service
    • deploy OpenStack in Compute1 and Compute2 (execute respectively)
    $ vagrant ssh compute1
    vagrant@compute1:~$ sudo -i
    root@compute1:~# su - stack
    stack@compute1:~$ cd devstack/
    stack@compute1:~/devstack$ ./stack.sh
  • start masakari monitors in Compute1 and Compute2 (execute respectively)

    In Ubuntu,

    stack@compute1:~/devstack$ sudo service masakari-hostmonitor start
    stack@compute1:~/devstack$ sudo service masakari-instancemonitor start
    stack@compute1:~/devstack$ sudo service masakari-processmonitor start

    In CentOS,

    stack@compute1:~/devstack$ sudo systemctl enable masakari-hostmonitor.service
    stack@compute1:~/devstack$ sudo systemctl enable masakari-instancemonitor.service
    stack@compute1:~/devstack$ sudo systemctl enable masakari-processmonitor.service

Demonstration of Failover

  • set Compute2 as a reserved host of masakari, in Controller

    stack@controller:~/devstack$ cd ~/masakari
    stack@controller:~/masakari$ ./reserved_host_add.sh compute2
  • disable Compute2 from nova scheduler

    stack@controller:~/masakari$ cd ~/devstack/
    stack@controller:~/devstack$ . openrc admin admin
    stack@controller:~/devstack$ nova service-disable compute2 nova-compute
  • create a server instance

    stack@controller:~/devstack$ . openrc demo demo
    stack@controller:~/devstack$ nova boot --image cirros-0.3.4-x86_64-uec --flavor m1.nano vm1
  • check if the instance is running on Compute1

    stack@controller:~/devstack$ . openrc admin admin
    stack@controller:~/devstack$ nova hypervisor-servers compute1
    stack@controller:~/devstack$ nova hypervisor-servers compute2
  • stop Compute1 suddenly, emulating Compute1 failure

    $ vagrant halt compute1 --force
    or
    $ vagrant destroy compute1 --force
  • check if the instance is evacuated to Compute2 and running (Masakari automatically move the instance. It takes about 5 minutes until it moves.)

    stack@controller:~/devstack$ nova hypervisor-servers compute1
    stack@controller:~/devstack$ nova hypervisor-servers compute2
    $ nova --os-tenant-name demo instance-action-list vm2

Recovery of Failed Host

  • restart(recreate) a failed host with provisioner, Compute1

    $ vagrant up compute1 --provision
  • deploy OpenStack in Compute1 (see above)

  • start masakari monitors in Compute1 (see above)

  • set Compute1 as a reserved host of masakari, in Controller

    stack@controller:~/devstack$ cd ~/masakari
    stack@controller:~/masakari$ ./reserved_host_add.sh compute1
  • Compute1 was already disabled from nova scheduler by masakari at the time of a host failure

  • enable Compute2 from nova scheduler

    stack@controller:~/masakari$ cd ~/devstack/
    stack@controller:~/devstack$ . openrc admin admin
    stack@controller:~/devstack$ nova service-enable compute2 nova-compute
  • Compute2 was already excluded from reserved hosts of masakari at the time of a instance evacuation

  • Now, the instance is ready for another host failure of Compute2

Tips to hold this environment

  • store the whole VMs state to resume your work instantly in future

    $ vagrant suspend
    • resume the stored state
    $ vagrant up

Copyright

Copyright (C) 2015 Nippon Telegraph and Telephone Corporation. Released under Apache License 2.0.

masakari-deploy's People

Contributors

sampathp avatar toshikazu0314 avatar tybritten avatar muroi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.