Code Monkey home page Code Monkey logo

haswitch's Introduction

haswitch is a Linux high availability tool to manage VM synchronization in a RAID 10 environment (machine-to-machine). Its primary goal is to switch LXC virtual machines onto LVM + DRBD. Its secondary goal is to manage the network coming with virtual machines then it manages iptables and bridges. haswitch also supports OVH's failover API which allow to switch failover ip during the migration.

Install

sudo npm install -g haswitch

Operations

Show configuration

haswitch show

Start all resources

haswitch start

Stop ha0 resource

haswitch start ha0

Start VM vm1ha0 on ha0 resource

haswitch start ha0 vm1ha0

Stop VM vm1ha0 on ha0 without execution

haswitch -e stop ha0 vm1ha0

LXC

Install LXC

sudo apt-get install lxc lxc-templates wget bridge-utils

Prepare LXC

Disable the default bridge “lxcbr0“, got created as part of LXC installation.

sudo nano /etc/default/lxc-net

Set “USE_LXC_BRIDGE” to “false“.

USE_LXC_BRIDGE="false"

DRBD

I suggest you to follow the guide from Zarafa:

The DRBD resource name must have the same name as a haswitch resource.

ISP Integration

OVH

Edit your /etc/haswitch.json and add:

ovh: {
  "me": "nsXXX.ovh.net",
  "endpoint": "ovh-eu",
  "appKey": "APP_KEY",
  "appSecret": "APP_SECRET",
}

Customer Key will come after running the credential checker.

haswitch ovh auth

A validation URL will be given You will have to follow it in order to activate the application. Once you have done that you will have the customer key:

ovh: {
  "me": "nsXXX.ovh.net",
  "endpoint": "ovh-eu",
  "appKey": "APP_KEY",
  "appSecret": "APP_SECRET",
  "consumerKey": "Given consumerKey",
}

Now you have to activate OVH failover on the LXC container

{
  "ovh": true,
  "vm": "vm1ha0",
  "public": {
    "internal": "192.168.0.6",
    "external": "1.2.3.2",
    "internal6": "fd67:d076:089a:8da3::",
    "external6": "2003:dead:beef:f80c::",
  }
}

Once you have configured you can check the OVH's failover status:

haswitch ovh check

To redirect all failover IP in every resources on Me (see ovh.me):

haswitch ovh failover

Or for a specific resource:

haswitch ovh failover ha0

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.