1. 程式人生 > >How to set up live-migration environment for Openstack with devstack

How to set up live-migration environment for Openstack with devstack

1) Install OS
   1.1) Install Ubuntu 12.04
        
[email protected]:~# cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

    1.2) Prepare at least 2 hosts for live migration, the README is using 3 hosts, one nova-controller node and two nova-compute node
    1.3) Suppose the host name for the README are as following:
        1.3.1) nova-controller: devstack12/172.17.27.12
        1.3.2) nova-compute1: devstack13/172.17.27.13
        1.3.3) nova-compute2: devstack14/172.17.27.14
    1.4) Make sure the three hosts are DNS resolvable by each other.

2) Install required packages for all hosts
   2.1)  apt-get update
   2.2) apt-get install openssh-server
   2.3) apt-get install -y git
   2.4) apt-get install libxml2-dev -y libxslt-dev
   2.5) apt-get install -y libmysqlclient-dev

3) Check out devstack with the version of Essex
   2.1) cd /root
   2.2) git clone -b "stable/essex" git://github.com/openstack-dev/devstack.git
   2.3) A folder named as devstack will be created under /root/devstack

4) Configure localrc for both nova-controller and nova-compute node
    4.1) nova-controller node
        4.1.1) Logon to nova-controller node
        4.1.2) cd /root/devstack
        4.1.3) vim localrc
           
HOST_IP=172.17.27.12 (Your nova-controller IP)
FLAT_INTERFACE=eth0
FIXED_RANGE=10.4.128.0/20
FIXED_NETWORK_SIZE=4096
FLOATING_RANGE=172.17.27.255/24
MULTI_HOST=1
LOGFILE=/opt/stack/logs/stack.sh.log
MYSQL_PASS=supersecret
RABBIT_PASS=supersecrete
SERVICE_TOKEN=xyzpdqlazydog
ADMIN_PASSWORD=nova
MYSQL_PASSWORD=nova
RABBIT_PASSWORD=nova
SERVICE_PASSWORD=nova
STATE_PATH=/export
LOCK_PATH=/tmp

    4.2) nova-compute node
        4.2.1) Logon to nova-compute node (Need to configure for both of the two nova-compute nodes)
        4.2.2) cd /root/devstack
        4.2.3) vim localrc
HOST_IP=172.17.27.13 (Your nova-compute node IP)
FLAT_INTERFACE=eth0
FIXED_RANGE=10.4.128.0/20
FIXED_NETWORK_SIZE=4096
FLOATING_RANGE=172.17.27.255/24
MULTI_HOST=1
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD=nova
MYSQL_PASS=supersecret
RABBIT_PASS=supersecrete
MYSQL_PASSWORD=nova
RABBIT_PASSWORD=nova
SERVICE_PASSWORD=nova
SERVICE_TOKEN=xyzpdqlazydog
MYSQL_HOST=172.17.27.12 (Your nova-controller IP)
RABBIT_HOST=172.17.27.12
GLANCE_HOSTPORT=172.17.27.12:9292
ENABLED_SERVICES=n-cpu,n-net,n-api,n-vol
STATE_PATH=/export
LOCK_PATH=/tmp

5) Install devstack on both nova-controller node and nova-compute node

6) Once install finished for both nova-controller node and nova-compute node, check if all nova service are happy face.
[email protected]:~# nova-manage  service list
2012-08-15 15:22:34 DEBUG nova.utils [req-ac296f2f-cf31-43b3-8b2c-bc140cc81b9b None None] backend <module 'nova.db.sqlalchemy.api' from '/opt/stack/nova/nova/db/sqlalchemy/api.pyc'> from (pid=21252) __get_backend /opt/stack/nova/nova/utils.py:658
Binary           Host                                 Zone             Status     State Updated_At
nova-compute     devstack12                           nova             enabled    :-)   2012-08-16 02:10:00
nova-cert        devstack12                           nova             enabled    :-)   2012-08-16 02:09:58
nova-volume      devstack12                           nova             enabled    :-)   2012-08-16 02:09:58
nova-network     devstack12                           nova             enabled    :-)   2012-08-16 02:09:58
nova-scheduler   devstack12                           nova             enabled    :-)   2012-08-16 02:10:05
nova-consoleauth devstack12                           nova             enabled    :-)   2012-08-16 02:10:02
nova-compute     devstack14                           nova             enabled    :-)   2012-08-16 02:09:47
nova-volume      devstack14                           nova             enabled    :-)   2012-08-16 02:09:52
nova-network     devstack14                           nova             enabled    :-)   2012-08-16 02:09:46
nova-compute     devstack13                           nova             enabled    :-)   2012-08-16 02:09:49
nova-volume      devstack13                           nova             enabled    :-)   2012-08-16 02:09:50
nova-network     devstack13                           nova             enabled    :-)   2012-08-16 02:09:49

7) Configure NFS for live migration, you can create the NFS server anywhere as you like, for this README, we are creagting it on nova-controller node.
   7.1) Condfigure nova-controller node as NFS server
       7.1.1) apt-get install -y nfs-kernel-server
       7.1.2) mkdir -p  /export/instances/
       7.1.3) chmod 777 -R /export/
       7.1.4) mkdir -p /dev/md1
       7.1.5) mkdir -p /raid1-1

       7.1.6)

vim /etc/fstab
/dev/md1                /raid1-1        ext3            data=journal,relatime,nosuid,noexec,nodev       1 2
/raid1-1/instances           /export/instances   none            bind            0 0

       7.1.7) vim /etc/default/nfs-kernel-server
             NEED_SVCGSSD=no # no is default
       7.1.8) vim /etc/default/nfs-common
              NEED_IDMAPD=yes
              NEED_GSSD=no # no is default
       7.1.9) vim /etc/idmapd.conf
              [Mapping]
              Nobody-User = nobody
              Nobody-Group = nogroup
       7.1.10) vim /etc/idmapd.conf -- only for JNDI
              [Translation]
              Method = nsswitch
       7.1.11) sudo vim /etc/exports
               /export            172.17.27.0/255.255.255.0(rw,sync,fsid=0,crossmnt,no_subtree_check)
               /export/instances  172.17.27.0/255.255.255.0(rw,sync,no_subtree_check)
       7.1.12) exportfs -ra
       7.1.13) /etc/init.d/nfs-kernel-server restart
       7.1.14) /etc/init.d/idmapd restart
    
    7.2) Configure each nova-compute node as NFS client
        7.2.1) apt-get install -y nfs-common
        7.2.2) vim /etc/default/nfs-common
               NEED_IDMAPD=yes
               NEED_GSSD=no # no is default
        7.2.3) modprobe nfs
        7.2.4) mkdir -p /export/instances
        7.2.5) vim /etc/fstab
               172.17.27.12:/instances          /export/instances                   nfs4    rw,hard,intr,rsize=32768,wsize=32768,nosuid,nodev               0 0
        7.2.6) vim /etc/hosts.deny  
               rpcbind : ALL
        7.2.7) vim /etc/hosts.allow
               rpcbind : 172.17.27.12
        7.2.8) mount -a -v
        7.2.9) df -k
        7.2.10) mount -t nfs4 172.17.27.12:/instances /export/instances

8) Config libvirt for nova-compute, this configure need to apply to all nova-compute nodes
    8.1) vim /etc/libvirt/libvirtd.conf
        8.1.1) Change "#listen_tls = 0" to "listen_tls = 0"
        8.1.2) Change "#listen_tcp = 1" to "listen_tcp = 1"
        8.1.3) Add "auth_tcp = "none""

    8.2) vim /etc/init/libvirt-bin.conf
       8.2.1) Change "env libvirtd_opts="-d"" to "env libvirtd_opts="-d -l""

    8.3) vim /etc/default/libvirt-bin
       8.3.1) Change "libvirtd_opts="-d"" to "libvirtd_opts="-d -l""

    8.4) vim /etc/libvirt/qemu.conf
        8.4.1) Change "#user = "root"" to "user = "root""
        8.4.2) Change "#group = "root"" to "group = "root""

    8.5) Restart libvirtd
       stop libvirt-bin && start libvirt-bin

9) Update configuration for nova-compute nodes
    9.1) copy /opt/stack/nova/etc/policy.json to /root
    9.2) Add "state_path=/export" to /etc/nova/nova.conf

10) Restart nova-compute service for all nova-compute service.
    10.1) ps -ef | gerp nova-compute
    10.2) kill nova-compute

    10.3) Start up nova-compute:  (You can put "setsid" at the begining of the command to make it run as a daemon)

python /opt/stack/nova/bin/nova-compute --flagfile=/etc/nova/nova.conf
11) Test
    11.1) Create a new instance
[email protected]:/export/instances# euca-run-instances  -t m1.tiny ami-00000003 --availability-zone xxx:devstack13
RESERVATION     r-xpwbbzlv      9a2f4355c3b94cfe9a37ad2e8d6cc60d        default
INSTANCE        i-00000006      ami-00000003    server-6        server-6        pending None (9a2f4355c3b94cfe9a37ad2e8d6cc60d, None)   0               m1.tiny 2012-08-15T19:43:33.000Z        unknown zone        aki-00000001    ari-00000002            monitoring-disabled                                     instance-store
[email protected]:/export/instances# euca-describe-instances
RESERVATION     r-xpwbbzlv      9a2f4355c3b94cfe9a37ad2e8d6cc60d        default
INSTANCE        i-00000006      ami-00000003    server-6        server-6        running None (9a2f4355c3b94cfe9a37ad2e8d6cc60d, devstack13)     0               m1.tiny 2012-08-15T19:43:33.000Z   nova     aki-00000001    ari-00000002            monitoring-disabled     10.4.128.2      10.4.128.2                      instance-store
[email protected]:/export/instances# nova list
+--------------------------------------+----------+--------+--------------------+
|                  ID                  |   Name   | Status |      Networks      |
+--------------------------------------+----------+--------+--------------------+
| f3a44421-39a3-477a-9b6d-819d98557953 | Server 6 | ACTIVE | private=10.4.128.2 |
+--------------------------------------+----------+--------+--------------------+
[email protected]:/export/instances# nova show f3a44421-39a3-477a-9b6d-819d98557953
+-------------------------------------+----------------------------------------------------------+
|               Property              |                          Value                           |
+-------------------------------------+----------------------------------------------------------+
|          OS-DCF:diskConfig          |                          MANUAL                          |
|         OS-EXT-SRV-ATTR:host        |                        devstack13                        |
| OS-EXT-SRV-ATTR:hypervisor_hostname |                           None                           |
|    OS-EXT-SRV-ATTR:instance_name    |                    instance-00000006                     |
|        OS-EXT-STS:power_state       |                            1                             |
|        OS-EXT-STS:task_state        |                           None                           |
|         OS-EXT-STS:vm_state         |                          active                          |
|              accessIPv4             |                                                          |
|              accessIPv6             |                                                          |
|             config_drive            |                                                          |
|               created               |                   2012-08-15T19:43:33Z                   |
|                flavor               |                         m1.tiny                          |
|                hostId               | 2a2355e6f881cedd4e638be9b32970b804bd1f05db4582de2ae2730f |
|                  id                 |           f3a44421-39a3-477a-9b6d-819d98557953           |
|                image                |                 cirros-0.3.0-x86_64-uec                  |
|               key_name              |                                                          |
|               metadata              |                            {}                            |
|                 name                |                         Server 6                         |
|           private network           |                        10.4.128.2                        |
|               progress              |                            0                             |
|                status               |                          ACTIVE                          |
|              tenant_id              |             9a2f4355c3b94cfe9a37ad2e8d6cc60d             |
|               updated               |                   2012-08-15T19:43:32Z                   |
|               user_id               |             c604b35cce7e4b53a24cb3828c4b197c             |
+-------------------------------------+----------------------------------------------------------+

    11.2) Migrate the instance
[email protected]:/export/instances# nova live-migration f3a44421-39a3-477a-9b6d-819d98557953 devstack14

    11.3) Check the instance

[email protected]:/export/instances# nova show f3a44421-39a3-477a-9b6d-819d98557953
+-------------------------------------+----------------------------------------------------------+
|               Property              |                          Value                           |
+-------------------------------------+----------------------------------------------------------+
|          OS-DCF:diskConfig          |                          MANUAL                          |
|         OS-EXT-SRV-ATTR:host        |                        devstack14                        |
| OS-EXT-SRV-ATTR:hypervisor_hostname |                           None                           |
|    OS-EXT-SRV-ATTR:instance_name    |                    instance-00000006                     |
|        OS-EXT-STS:power_state       |                            1                             |
|        OS-EXT-STS:task_state        |                           None                           |
|         OS-EXT-STS:vm_state         |                          active                          |
|              accessIPv4             |                                                          |
|              accessIPv6             |                                                          |
|             config_drive            |                                                          |
|               created               |                   2012-08-15T19:43:33Z                   |
|                flavor               |                         m1.tiny                          |
|                hostId               | 6a4b39673a99492bd2c461e5d0f616181d77fa83c9d3b3f44a890ff6 |
|                  id                 |           f3a44421-39a3-477a-9b6d-819d98557953           |
|                image                |                 cirros-0.3.0-x86_64-uec                  |
|               key_name              |                                                          |
|               metadata              |                            {}                            |
|                 name                |                         Server 6                         |
|           private network           |                        10.4.128.2                        |
|               progress              |                            0                             |
|                status               |                          ACTIVE                          |
|              tenant_id              |             9a2f4355c3b94cfe9a37ad2e8d6cc60d             |
|               updated               |                   2012-08-15T19:44:23Z                   |
|               user_id               |             c604b35cce7e4b53a24cb3828c4b197c             |
+-------------------------------------+----------------------------------------------------------+


相關推薦

How to set up live-migration environment for Openstack with devstack

1) Install OS    1.1) Install Ubuntu 12.04          [email protected]:~# cat /etc/*release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04

[Fastai] How to set up fastai library on windows 10? Windows 10如何安裝fastai庫

According to Jeremy’s post: (assume you have gpu with cuda, conda and git installed) clone the git repo git clone https://github.com/

Ethereum 69: how to set up a fully synced blockchain node in 10 mins

Wait for few hours until the blockchain is fully synced.The current block number as of 24th of September is: 3039786. On my AMD Ryzen 5 2600, 3.4Ghz, the s

How to Set Up a Compliant Archive

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

How to set up a Continuous Integration and Delivery (CI/CD) Pipeline

In this project, you will learn how to set up a continuous integration and continuous delivery (CI/CD) pipeline on AWS. A pipeline helps you

How to set up a continuous deployment pipeline

In this step, you will revise the sample code and commit the change to your repository. CodePipeline will detect your updated sample code an

How to Set Up a Direct Connect Gateway

An AWS Direct Connect gateway is a grouping of virtual private gateways and private virtual interfaces that belong to the same AWS account.

How to set up "lldb_codesign" certificate!

system log creating mes iss sys for ase switch To use the in-tree debug server on macOS, lldb needs to be code signed. TheDebug, DebugCla

Factor Authentication And How To Set It Up

What is 2-Factor Authentication and Why Should You Care?In the digital world that we live in, our virtual identity has become as important as the real one.

Ask HN: I set up my own domain for my email and it's all going to SPAM

Have you implemented DKIM/SPF/DMARC? If you have not, that is a first step.Are you sending from a "consumer" network IP block (cable modem or DSL)? If so,

怎麽給SharePoint得視圖設置多個過濾條件? How to set multiple complex filter conditions to the SharePoint list view ?

repo 多個 lte com tst 方案 ren filter current 平時會很容易遇到需要給視圖設置復雜得過濾條件,如果是一兩個條件還好多,如果條件超過四個,會比較麻煩,很容易會出現邏輯不清,或者沒有按照你得意願來過濾數據得問題。 解決方案: 設置計算列,

[轉]SQL - Create XML - How to set Unicode UTF-8

ref unicode per AR tro IE lar -c AS 本文轉自:https://stackoverflow.com/questions/44754356/sql-create-xml-how-to-set-unicode-utf-8 I found

how to set the core dump file location(and name)?

1、如何長期開啟core dump功能?         編輯 /etc/profile,在末尾加上命令: ulimit -c unlimited >/dev/null 2>&1  &

How to Reset the root's Password for MySQL(MariaDB)

Unfortunately, I had forgotten the root's password of MySQL. Here, one of the methods is introduced, which works on my RasberryPi 3B+. K

How To Train an Object Detection Classifier for Multiple Objects Using TensorFlow (GPU) on Windows10

本文主要是記錄和簡義這個github專案的練習 裝置windows10 tensorflow1.10.0 原文github:點這裡 偶然發現的和我類似的文章還沒看 點這裡 首先我們知道,tensorflow官方是有一個物體檢測的API介面的。而我們今天要練習的專案就

How to set connection timeout with OkHttp

OkHttp 用起來真的很方便。 As of OkHttp3 can now do this through the Builder like so client = new OkHttpClient.Builder() .connectTimeout(10, TimeUnit.SEC

How to Enable the GD Image Library for WordPress?

很久以前還在用 php5 + wordpress 時,文章的縮圖都有自動被產生,某一次升級之後,縮圖功能就不見了。花了2小時Google 終於找到原因。 解法如下: apt-get install php7.0-gd phpenmod gd /etc/init.d/php7.0-fpm restart p

How to set tab bar item title programmatically in objective c?

I want to set title to tab item programatically You can set all the UITabBar icons in an easy way. You can do this in your viewWillAppear:method: [[self.

[ionic] How to set Value Input field

設定變數值的範例1: You can do it like that: page.html <ion-input id="amount" type="number" [(ngModel)]="value"></ion-input> <button (click)="setIn

How to Develop and Evaluate Naive Methods for Forecasting Household Electricity Consumption

Tweet Share Share Google Plus Given the rise of smart electricity meters and the wide adoption o