Qemu & kvm guide #1 (intro & basic)

View more documents from JungIn Jung


Posted by 사랑줍는거지
,

http://redmine.nehome.net/redmine/projects/nosql/wiki/Cassandra_-_Replica-Strategy_and_Snitch-Strategy_and_Partitioner-Strategy



Replica-Strategy

  • Keyspace 생성시 설정한다.
    [default@unknown] CREATE KEYSPACE score with placement_strategy='org.apache.cassandra.locator.NetworkTopologyStrategy' and strategy_options={0:3};
    
  • Cluster내에서 Replica들을 어떻게 분산 시킬지를 결정
  • Type에는 2가지 지원
    • SimpleStrategy
    • NetworkTopologyStrategy

SimpleStrategy

  • Row키에 대한 MD5 Hash결과에 의해 Data저장 노드가 결정되면, 무조건 Ring에서 시계방향으로 바로 다음(Next) 노드들에게 Replica를 배치 시키는 방식.
  • 뒤에 나올 내용인 Snitch-Strategy의 설정은 모두 무시된다. 단순히 Ring의 시계방향만 고려됨.

NetworkTopologyStrategy

  • 먼저 Cassandra에서 말하는 "DataCenter"란?
    Replication-Group(복제 그룹)을 의미 하며, 복제를 목적으로 클러스트 내에서 묶여진 논리적인 그룹이다.주의할 것은 물리적인 DataCenter을 의미하는 것이 아님.
    
  • DataCenter/Rack에 걸쳐 정확하게 Replica를 배치 하기위해 Snitch정보에 의존적이다.
  • SimpleSnitch 모드가 아닌 Snitch-Strategy에 의해 정의된 Replication-Group(or Each DataCenter)정보를 기준으로 Replica를 적절히 배치.
  • Replica 배치는 각각의 DataCenter별로 독립적으로 설정한다.(비대칭 Replica 수 운영 가능)
    DC1에는 3개, DC2에는 2개 이런식으로...
    
  • 첫 Replica들은 각각의 DataCenter들에 우선적으로 하나씩 결정(배치)된다.(by Partitioner)
  • 나머지 Replica들은 각각의 DataCenter들에 지정된 갯수만큼 배치되는데, 이때 Snitch정보인 Replication-Group정보(Rack)를 참조해서, 각 DataCenter의 Ring정보에서 시계방향으로 돌면서, 이전 Replica와 비교해 동일 Replication-Group이 아닌 Rack이 나올때까지 검색해서 배치한다.
  • 단, 분리 배치 할 노드가 부족할 경우에는 동일 Rack이라도 배치하게 된다.
  • 얼마나 많은 Replica를 사용할지를 결정할 때 고려해야 할 것
    • DataCenter간의 지연시간을 투자하지 않고, 로컬의 데이타(Local-Data)를 읽을 수 있게 한다.
    • 여러가지 장애 상황에 대한 대처가 가능해야 한다.
  • Multi-DataCenter구조하에서 아래와 같은 2가지 방법이 추천된다.
    • 각각에 DataCenter에 2개의 Replica를 두는 것.
      • Replication-Group당 하나의 노드장애를 커버 가능하고, 장애상황하에서 "Consistency-Level ONE"으로 Local-Data 읽기가 가능.
    • 각각의 DataCenter에 3개의 Replica를 두는 것.
      • "Strong Consistency Level Local_QUORUM"모드에서, Replication-Group당 하나의 노드장애를 커버 가능하거나, "Consistency-Level ONE"모드에서는 Replication-Group당 다중(2대) 노드의 장애가 커버 가능.
  • Snitch는 복제 범위 내에서 효율적으로 노드간 통신을 하며, 클라이언트 응용프로그램과 카산드라 사이의 요청처리에는 여향을 미치지 않는다.
  • Cluster의 모든 노드는 동일한 Snitch를 사용해야 한다.(cassandra.yaml)

Snitch-Strategy

  • Snitch ??
    노드가 전체 네트워크 토플로지에서 그룹화 되는 방법을 정의 하는 역할
    

SimpleSnitch

  • cassandra.yaml 에서 설정.
  • DataCenter/Rack에 대한 구분이 없다.
  • Partitioner에 의해 저장될 노드가 정해지면, Replica에 대해서는 무조건 시계방향으로 나머지 Replica개수 만큼 Next(다음) 노드들에게 순차적으로 배치 시킨다.

RackInferringSnitch

  • 클러스트 내에서, 노드의 IP정보를 기반으로 그룹화 한다. (옥텟 기반)
  • IP가 10.DDD.RRR.NNN 이라고 한다면,
    • DDD값은, DataCenter를 의미, 동일하면 같은 DataCenter로 간주.
    • RRR값은, Rack을 의미, 동일하면 같은 Rack으로 간주.
    • NNN값은, 노드를 구분.
  • DDD와, RRR 값이 중요하다.
  • NetworkTopologyStrategy와 사용하면 유리.

PropertyFileSnitch

  • 클러스트 내에서, 노드들의 그룹화를 특정 속성파일(cassandra-topology.properties)을 통해 정의 한다.
  • 모든 노드정보를 속성파일에 기술해야 한다. (관리의 번잡)
  • 모든 노드는 동일 속성파일을 유지 해야 한다.
  • 관리 정보는 RackInferringSnitch와 유사
    • 노드별 DataCenter/Rack 정보 정의

Partitioner

  • cassandra.yaml 에서 설정.
  • Data(Replica가 아님)가 저장될 노드를 결정하는 방식 정의.

RandomPartitioner (RP)

  • Data의 Row-Key에 대해 MD5 Hash값을 기준으로, 저장할 노드 결정.
  • Data가 어느 노드에 저장될지 예측 불가.
  • 저장과 동시에 정렬 불가.
    • Full-Text Search 불가.
    • Range Scan 불가.
    • 부하 분산 유리.
    • 확장성/Data재분배 유리(가능)

ByteOrderedPartitioner (BOP)

  • Data의 Row-Key 자체가 노드가 된다.
  • Row-Key값으로 노드가 결정되므로, 저장과 동시에 정렬이 된다.
    • Full-Text Search 가능.
    • Range Scan 가능.
    • 부하 분산 불균형
    • 확장성/Data재분배 불리(어려움)

Posted by 사랑줍는거지
,

Xen - How I/O-Ring Works (between Domain-0 and Domain-U)

Xen에서 FrontEnd 드라이버와 BackEnd 드라이버 사이에 I/O 작업이 어떻게 이루어지는지 살펴 본다.


사전 정보

  • Native-Device-Driver(Physical-Driver)는 Domain-0에 있다.
  • 아래 그림과 같은 I/O Ring은 Xen-Hypervisor레벨에 하나가 존재 한다. 이 Ring이 모든 I/O에 대한 중계 역할.

Xen's I/O Ring 구성도

I/O 요청 Flow

  1. Domain-U의 App이 I/O 요청을 발생시키면 FrontEnd-Driver가 이를 받아, Xen-Hypervisor에 있는 I/O Ring에 요청 이벤트로 등록.
  2. 이벤트 등록이 완료되면, I/O를 발생시킨 vCPU는 블록상태로 전이 및 응답 대기. (I/O 부하 상태)
  3. Domain-0의 BackEnd-Driver는 Xen-Hypervisor의 I/O Ring에 등록된 I/O요청 이벤트를 읽어, Native-Device-Driver를 통해 실제 물리적 Device로부터 I/O를 수행.

I/O 응답 Flow

  1. Domain-0는 물리적 Device로부터 I/O를 수행한 결과를, 다시 Xen-Hypervisor의 I/O Ring에 응답 이벤트로 등록.
  2. 이벤트 등록이 완료되면, Xen-Hypervisor은 블록상태로 대기중이던 vCPU를 최고 우선순위로 다시 활성화 시킨다.
  3. 블록상태에서 벗어난 vCPU는 FrontEnd-Driver을 통해, I/O 응답 결과를 받아 이후 작업을 처리.

I/O Ring의 권한 중재자 Grant-Table

  • Domain-0, Domain-U, Xen-Hypervisor 모두가 공유하는데, 이 때 제어 권한 처리는 Grant-Table에서 관리 된다.

Posted by 사랑줍는거지
,





Migration

Introduction

KVM currently supports savevm/loadvm and offline or live migration Migration commands are given when in qemu-monitor (Alt-Ctrl-2). Upon successful completion, the migrated VM continues to run on the destination host.

Note

You can migrate a guest between an AMD host to an Intel host and back. Naturally, a 64-bit guest can only be migrated to a 64-bit host, but a 32-bit guest can be migrated at will.

There are some older Intel processors which don't support NX (or XD), which may cause problems in a cluster which includes NX-supporting hosts. To disable NX for a given guest, start it with such a parameter: -cpu qemu64,-nx

Requirements

  • The VM image is accessible on both source and destination hosts (located on a shared storage, e.g. using nfs).
  • It is recommended an images-directory would be found on the same path on both hosts (for migrations of a copy-on-write image -- an image created on top of a base-image using "qemu-image create -b ...")
  • The src and dst hosts must be on the same subnet (keeping guest's network when tap is used).
  • Do not use -snapshot qemu command line option.
  • For tcp: migration protocol
  • the guest on the destination must be started the same way it was started on the source.

highlights / merits

  • Almost unnoticeable guest down time
  • Guest is not involved (unique to KVM Live Migration [#1 1])
  • Capability to tunnel VM state through an external program (unique to KVM Live Migration [#1 1])
  • ssh/gzip/bzip2/gpg/your own
  • Upon success guest continues to run on destination host, upon failure guest continues to run on source host (with one exception)
  • Short and Simple
  • Easy to enhance
  • Hardware independence (almost).
  • Support for migration of stopped (paused) VMs.
  • Open

Anchor(1) 1 These features are unique to KVM Live Migration as far as I know. If you know of other hypervisor that support any of them please update this page or let me (Uri) know.

User Interface

The user interface is through the qemu monitor (alt-ctrl-2 on the SDL window)

Management

migrate [-d] <URI>
migrate_cancel    

The '-d' will let you query the status of the migration.

With no '-d' the monitor prompt returns when the migration completes. URI can be one of 'exec:<command>' or tcp:<ip:port>

Status

info migrate 

Migration Parameters

migrate_set_speed <speed>   set bandwidth control parameters (max transfer rate per second)

Example / HOWTO

A is the source host, B is the destination host:

TCP example:

1. Start the VM on B with the exact same parameters as the VM on A, in migration-listen mode:

B: <qemu-command-line> -incoming tcp:0:4444 (or other PORT))

2. Start the migration (always on the source host):

A: migrate -d tcp:B:4444 (or other PORT)

3. Check the status (on A only):

A: (qemu) info migrate                   

Offline example:

1. unlimit bandwidth used for migration:

A: migrate_set_speed 1g                

2. stop the guest:

A: stop                                

3. continue with either TCP or exec migration as described above.

Problems / Todo

  • TSC offset on the new host must be set in such a way that the guest sees a monotonically increasing TSC, otherwise the guest may hang indefinitely after migration.
  • usbdevice tablet complains after migration.
  • handle migration completion better (especially when network problems occur).
  • More informative status.
  • Migration does not work while CPU real-mode/protected mode are still changing.

savevm/loadvm to an external state file (using pseudo-migration)

  • To be supported directly by Migration Protocols, but until then...
  • Save VM state into a compressed file
    • Save
stop                                                               
migrate_set_speed 4095m                                            
migrate "exec:gzip -c > STATEFILE.gz"                              
    • Load
gzip -c -d STATEFILE.gz | <qemu-command-line> -incoming "exec: cat"   or
<qemu-command-line> -incoming "exec: gzip -c -d STATEFILE.gz"
  • Save VM State into an encrypted file (assumes KEY has already been generated)
    • Save
stop                                                                          
migrate_set_speed 4095m
migrate "exec:gpg -q -e -r KEY -o STATFILE.gpg"
  • Load VM state from an encrypted file
gpg -q -d -r KEY STATEFILE.gpg | <qemu-command-line> -incoming "exec:cat"

more exec: options

  • Send encrypted VM state from host A to host B (Note: ssh is probably better, this is just for show)
    • on host A
migrate "exec:gpg -q -e -r KEY | nc B 4444"
    • on host B
nc -l 4444 | gpg -q -d -r KEY | <qemu-command-line> -incoming "exec:cat"

Algorithm (the short version)

1. Setup

  • Start guest on destination, connect, enable dirty page logging and more

2. Transfer Memory

  • Guest continues to run
  • Bandwidth limitation (controlled by the user)
  • First transfer the whole memory
  • Iteratively transfer all dirty pages (pages that were written to by the guest).

3. Stop the guest

  • And sync VM image(s) (guest's hard drives).

4. Transfer State

  • As fast as possible (no bandwidth limitation)
  • All VM devices' state and dirty pages yet to be transferred

5. Continue the guest

  • On destination upon success
    • Broadcast "I'm over here" Ethernet packet to announce new location of NIC(s).
  • On source upon failure (with one exception).


Instructions for kvm-13 and below: MigrationQemu0.8.2.


Posted by 사랑줍는거지
,


Virtualization - Full vs Para (Appendix Pass-Through)(20120.pdf










Posted by 사랑줍는거지
,

[PDF] - MIgration Xen to KVM

Cloud 2012. 5. 12. 22:19

Xen에서 KVM으로 VM 마이그레이션 처리에 관한 문서... 


Migration_Xen_to_KVM (Summit_2010_Xen_KVM).pdf


Posted by 사랑줍는거지
,

[동영상] TCP/IP의 원리

OS 2012. 5. 12. 13:56



'OS' 카테고리의 다른 글

About Amanda Backup  (0) 2014.09.25
Posted by 사랑줍는거지
,

후기랄것도 없다...


뭐가 이렇게 간단해??!!!!!!


2.x대의 그 애매모호성이 대폭 없어진 느낌... (물론 Zone이니, Pod니, Cluster, Host 등의 개념을 처음 접하면 역시나 난해함이 있을수도 있겠지만...)


그러나, 결론은 2.x에 비하자면 매우 만족!!!!!!!!!! 장비만 너끈하다면, 1시간이면 뚝딱 IaaS 인프라 구축이 완료될듯...


한마디로 요약하자면, Windows에서 프로그램 설치 하듯... 위자드(설치 마법사) 수준으로 쉬움~~ 강추~~!!


* 설치 메뉴얼은 따로 작성안한다... 왜? CloudStack공식 가이드 문서인 Quick-Installation 문서가 너무 잘 되어 있기때문에~ 굳이~ 사족달 필요 없다....


링크 : Quick Install Guide (English)

http://download.cloud.com/releases/3.0.0/CloudStack3.0QuickInstallGuide.pdf


Posted by 사랑줍는거지
,

‎"Why Is Citrix Moving CloudStack to the Apache Foundation?"
"Why Align CloudStack with the AWS APIs?"



원문 : http://gevaperry.typepad.com/main/2012/04/is-citrix-opening-a-three-front-war-with-cloudstack.html





In the Game of Clouds, You Win Or You Die: CloudStack

Citrix is making a big announcement today. It has two parts. First, it's moving its CloudStack framework, which was owned by Citrix and distributed at CloudStack.org through a GPL license, to the Apache Foundation. Second, it is aligning CloudStack withAmazon Web Services' architecture and APIs.

This is big news that's sure to ruffle some feathers in the cloud computing space. So the questions I have are:

  • Why are they doing this?
  • What are the implications?

Why Is Citrix Moving CloudStack to the Apache Foundation?

The move appears straightforward. Citrix acquired CloudStack through its $200 millionacquisition of Cloud.com in July 2011. From what I'm hearing, it has had good success with enterprise and provider adoption of the product, but it was far from being accepted as an industry de facto standard, which is what, I assume, they had hoped for. So it would make sense for them to move it to a respected open source foundation like Apache.

But wait. There was already a OpenStack vying for that de facto standard open source platform status, and Citrix announced its support for it two months before the Cloud.comacquisition. The company said it would continue to support both platforms after the acquisition, so what happened?

Citrix claims that the OpenStack foundation wasn't run well: it was dominated by Rackspace and had a "pay-to-play" model. The result was that the APIs were poorly designed and the product lacked stability and maturity (a claim I have heard from others). At the same time, while OpenStack is getting support from the likes of Cisco and HP, the community is somewhat fragmenting, with multiple distributions and extensions from the likes of startups Cloudscaling and Piston Cloud. This started creating a problem for enterprise customers and providers who were getting confused and having a bad experience with OpenStack.

In the meantime, Citrix is feeling competitive pressure from the company it views as its primary rival for actual customers (as opposed to winning the hearts and minds of the "community"): VMWare.

It simply couldn't wait and had to go on the attack with a bold move. This is it -- and it's a pretty good one.

Why Align CloudStack with the AWS APIs?

The final piece in making CloudStack the de facto standard cloud platform is the API. By aligning with the Amazon APIs, CloudStack gains a hghly-adopted, proven API with a massive ecosystem of integrated tools and services around it. They tell me they will have 100% compatibility by the end of this year.

But the catch is this comes on the heels of Eucalyptus's announcement that it is aligning with the AWS APIs. Eucalyptus, just a reminder, is another open source cloud platform that has been vying for leadership among enterprise customers.

Game of Clouds

With this move complete, Citrix has a production-proven stable product, which is now an open source platform managed by the widely-respected Apache Foundation, using a popular API with a massive ecosystem around it. Pretty clever, I think.

On the other hand, CloudStack is fighting on three fronts now: its traditional arch-enemy VMWare, the OpenStack camp with the dozens of vendors -- large and small -- behind it, and Eucalyptus. A regular game of thrones. And to paraphrase Game of Thrones: In the Game of Clouds, you either win or you die.

'Cloud' 카테고리의 다른 글

[PDF] - MIgration Xen to KVM  (0) 2012.05.12
CloudStack 3.0 설치 후기....  (0) 2012.05.06
CloudStack + SDN  (0) 2012.05.01
Install OpenNebula-2.2-1 with Xen  (0) 2012.03.18
Install - CloudStack CE 2.1.x ManagementComputing Node  (0) 2012.03.18
Posted by 사랑줍는거지
,

CloudStack + SDN

Cloud 2012. 5. 1. 16:43


  • 특징
    • VLAN의 제한을 벗어남 (예: VLAN 개수가 4k 이상 운영 불가 등등)
    • GRE 터널링을 활용해서, L3위에서 L2에 대한 Overlay 네트워크 실현 (IDC간에서도 Network 통합)
      • 기존의 임기응변 격이었던 VPN을 통한 L2 Overlay 네트워크 흉내내던 것에 대한 대안...
    • VLAN개수 제한 대신 테넌트키(Tanant-Key)라는 것을 통해 계정별 트래픽 격리
      • Tanant-Key가 기존의 VLAN에서 VLAN-Tag(ID) 속성에 매칭되는 듯...
  • 걱정거리...
    • GRE 터널링에서 Tanant-Key활용은 분명 기존의 VPN에 비해 복잡성을 많이 제거 했으나, 터널링이라는 것에 의한 속도 문제는....
    • SDN과는 별개의 이야기지만, RouteVM이라는 병목 구간에 대한 개선점은 잘 보이지 않음....


이상, 간략히 훌터본 바로는 이상과 같다... 자세한 것은 실제로 테스트 정도는 해봐야 윤곽이 나올듯...

Posted by 사랑줍는거지
,