Resize qcow2 image

Cloud/KVM 2013. 9. 28. 23:07
[Info]
  • e.g.) Default 8GB(orig.img) -> 20GB(test.img) any..
  • Both Single-Image and BackingType-Image 
  • Test format: qcow2
  • Tools: parted, qemu-img, qemu-nbd
  • Test Platform: Ubuntu 13.04 x86_64


[Start]


- Check Image

# qemu-img info orig.img 

image: orig.img

file format: qcow2

virtual size: 8.0G (8589934592 bytes)

disk size: 883M

cluster_size: 65536

# qemu-img create -b /home/orig.img -f qcow2 test.img

# qemu-img info test.img

image: test.img

file format: qcow2

virtual size: 8.0G (8589934592 bytes)

disk size: 196K

cluster_size: 65536

backing file: /home/orig.img


- Connect NBD & Check partitions

# modprobe nbd

# qemu-nbd -c /dev/nbd0 /home/test.img

# ls -al /dev/nbd0*

brw-rw---- 1 root disk 43, 0 Sep 28 23:18 /dev/nbd0

brw-rw---- 1 root disk 43, 1 Sep 28 23:18 /dev/nbd0p1

# parted /dev/nbd0 --script print free

Model: Unknown (unknown)

Disk /dev/nbd0: 8590MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos


Number  Start   End     Size    Type     File system  Flags

        32.3kB  1049kB  1016kB           Free Space

 1      1049kB  8589MB  8588MB  primary  ext4         boot

        8589MB  8590MB  1049kB           Free Space

- Disconnect NBD & Resize image

# qemu-nbd -d /dev/nbd0

/dev/nbd0 disconnected

# qemu-img resize test.img 20G

Image resized.


- Check image

# qemu-img info test.img

image: test.img

file format: qcow2

virtual size: 20G (21474836480 bytes)

disk size: 200K

cluster_size: 65536

backing file: /home/orig.img


Connect NBD & Check partitions

qemu-nbd -c /dev/nbd0 /home/test.img

parted /dev/nbd0 --script print free

Model: Unknown (unknown)

Disk /dev/nbd0: 21.5GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos


Number  Start   End     Size    Type     File system  Flags

        32.3kB  1049kB  1016kB           Free Space

 1      1049kB  8589MB  8588MB  primary  ext4         boot

        8589MB  21.5GB  12.9GB           Free Space


- Re-Partitioning (Remove Partition and Create Partition) ("1" is partition-number)

# parted /dev/nbd0 --script rm 1

# parted /dev/nbd0 --script print free

Model: Unknown (unknown)

Disk /dev/nbd0: 21.5GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos


Number  Start   End     Size    Type  File system  Flags

        32.3kB  21.5GB  21.5GB        Free Space


# parted -a optimal /dev/nbd0 --script mkpart primary ext4 0% 100%

# parted /dev/nbd0 --script print free

Model: Unknown (unknown)

Disk /dev/nbd0: 21.5GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos


Number  Start   End     Size    Type     File system  Flags

        32.3kB  1049kB  1016kB           Free Space

 1      1049kB  21.5GB  21.5GB  primary  ext4


- Mount image's Partition (to edit boot-script :: rc.local)

# kpartx -a /dev/nbd0

# mount /dev/mapper/nbd0p1 /mnt/


- Apply Parition to VM (by resize2fs)

# echo 'resize2fs /dev/vda1; sed -i \"/resize2fs/d\" /etc/rc.local' >> /mnt/etc/rc.local


[End]

Booting VM with new image




[Appendix]

- Disconnect kpartx & NBD

# umount /mnt

# kpartx -d /dev/nbd0

# qemu-nbd -d /dev/nbd0


Posted by 사랑줍는거지
,

EC2 & ELB Networking SockPerf TEST (Zone/Public/Private)


Edit

제반 사항

(Note)
- 부하(Load)나, 외부상황은 배제한, EC2 Instance간의 Network Latency 테스트.
- 횟수가 많아야 신뢰도가 있는 자료가 나오겠으나, 시간상 1회/10초 수행.
- "Percentile 99.99" 와 "Average" 그래프화. 




EC2-Latency.xlsx



  • Region: Tokyo
  • 인스턴스(VM): 3EA
  • 인스턴스 OS: Ubuntu Server 12.04.2 LTS (64bit)
  • 인스턴스 스펙: M1 Small (m1.small, 1.7 GiB)
  • 테스트 상세
    • 도구: sockperf_2.5.193 (https://code.google.com/p/sockperf/downloads/list)
    • 모드: ping-pong (run sockperf client for latency test in ping pong mode)
    • 방식: RTT (Round Trip Time)
    • 시간: 10sec
    • Size: 16KB (16384 Byte)
    • 단위: usec (마이크로초)
    • Command
      • Server: ./sockperf server -p 5001 {--tcp}
      • Client: ./sockperf ping-pong -i {Server-IP} -p 5001 -m 16384 -t 10 --pps=max {--tcp}
  • 예상 Case
    • 동일 Zone에 존재하는 VM to VM
      • 공인 DNS (TCP/UDP)
      • 사설 DNS (TCP/UDP)
      • ELB 경유 (TCP/UDP)
    • 다른 Zone에 존재하는 VM to VM
      • 공인 DNS (TCP/UDP)
      • 사설 DNS (TCP/UDP)
      • ELB 경유 (TCP/UDP)
Edit

VM 구성

Edit

구성도



Edit

설정 내역

  • VM-A
    • Zone: ap-northeast-1a
    • Privat DNS: 10.152.173.96 (ip-10-152-173-96.ap-northeast-1.compute.internal)
    • Public DNS: 54.249.200.29 (ec2-54-249-200-29.ap-northeast-1.compute.amazonaws.com)
  • VM-B
    • Zone: ap-northeast-1a
    • Privat DNS: 10.162.15.46 (ip-10-162-15-46.ap-northeast-1.compute.internal)
    • Public DNS: 54.250.97.46 (ec2-54-250-97-46.ap-northeast-1.compute.amazonaws.com)
  • VM-C
    • Zone: ap-northeast-1c
    • Privat DNS: 10.121.6.240 (ip-10-121-6-240.ap-northeast-1.compute.internal)
    • Public DNS: 54.250.69.124 (ec2-54-250-69-124.ap-northeast-1.compute.amazonaws.com)
  • ELB-B 정보
    • Zone: ap-northeast-1a
    • LB Protocol: TCP
    • LB Port: 5001
    • Instance Protocol: TCP
    • Instance Port: 5001
    • DNS/IP
      • 176.32.93.150 / SockPerf-1694303445.ap-northeast-1.elb.amazonaws.com (A Record)
  • ELB-C 정보
    • Zone: ap-northeast-1c
    • LB Protocol: TCP
    • LB Port: 5001
    • Instance Protocol: TCP
    • Instance Port: 5001
    • DNS/IP
      • 54.248.124.224 / sockperf-c-1386190870.ap-northeast-1.elb.amazonaws.com (A Record)
Edit

결과

첨부 엑셀/그래프 참조

Edit

동일 Zone

    A->B: 공인 DNS
    • TCP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 54.250.97.46 -p 5001 -m 16384 -t 10 --pps=max --tcp
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 54.250.97.46    PORT =  5001 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.099 sec; SentMessages=3455; ReceivedMessages=3454
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=9.998 sec; SentMessages=3417; ReceivedMessages=3417
      sockperf: ====> avg-lat=1462.875 (std-dev=1090.760)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 1462.875 usec
      sockperf: Total 3417 observations; each percentile contains 34.17 observations
      sockperf: ---> <MAX> observation = 31958.137
      sockperf: ---> percentile  99.99 = 31958.137
      sockperf: ---> percentile  99.90 = 18919.201
      sockperf: ---> percentile  99.50 = 3809.342
      sockperf: ---> percentile  99.00 = 3328.685
      sockperf: ---> percentile  95.00 = 2655.743
      sockperf: ---> percentile  90.00 = 2176.901
      sockperf: ---> percentile  75.00 = 1718.117
      sockperf: ---> percentile  50.00 = 1237.302
      sockperf: ---> percentile  25.00 = 1022.388
      sockperf: ---> <MIN> observation =  721.464
    • UDP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 54.250.97.46 -p 5001 -m 16384 -t 10 --pps=max
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 54.250.97.46    PORT =  5001 # UDP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.101 sec; SentMessages=1172; ReceivedMessages=1171
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=9.997 sec; SentMessages=1159; ReceivedMessages=1159
      sockperf: ====> avg-lat=4312.799 (std-dev=1570.727)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 4312.799 usec
      sockperf: Total 1159 observations; each percentile contains 11.59 observations
      sockperf: ---> <MAX> observation = 34023.287
      sockperf: ---> percentile  99.99 = 34023.287
      sockperf: ---> percentile  99.90 = 32017.070
      sockperf: ---> percentile  99.50 = 8009.275
      sockperf: ---> percentile  99.00 = 8002.157
      sockperf: ---> percentile  95.00 = 6002.642
      sockperf: ---> percentile  90.00 = 5995.283
      sockperf: ---> percentile  75.00 = 4005.037
      sockperf: ---> percentile  50.00 = 4000.878
      sockperf: ---> percentile  25.00 = 3997.844
      sockperf: ---> <MIN> observation = 3441.178
      
  • A->B: 사설 DNS
    • TCP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 10.162.15.46 -p 5001 -m 16384 -t 10 --pps=max --tcp
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 10.162.15.46    PORT =  5001 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.101 sec; SentMessages=3850; ReceivedMessages=3849
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=10.001 sec; SentMessages=3814; ReceivedMessages=3814
      sockperf: ====> avg-lat=1310.974 (std-dev=1300.552)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 1310.974 usec
      sockperf: Total 3814 observations; each percentile contains 38.14 observations
      sockperf: ---> <MAX> observation = 31679.585
      sockperf: ---> percentile  99.99 = 31679.585
      sockperf: ---> percentile  99.90 = 18777.097
      sockperf: ---> percentile  99.50 = 5004.997
      sockperf: ---> percentile  99.00 = 4177.719
      sockperf: ---> percentile  95.00 = 2647.471
      sockperf: ---> percentile  90.00 = 2222.535
      sockperf: ---> percentile  75.00 = 1618.295
      sockperf: ---> percentile  50.00 = 1085.067
      sockperf: ---> percentile  25.00 =  714.380
      sockperf: ---> <MIN> observation =  347.386
      
    • UDP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 10.162.15.46 -p 5001 -m 16384 -t 10 --pps=max
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 10.162.15.46    PORT =  5001 # UDP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.101 sec; SentMessages=1231; ReceivedMessages=1230
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=9.601 sec; SentMessages=1224; ReceivedMessages=1224
      sockperf: ====> avg-lat=3921.816 (std-dev=1746.140)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 3921.816 usec
      sockperf: Total 1224 observations; each percentile contains 12.24 observations
      sockperf: ---> <MAX> observation = 34020.301
      sockperf: ---> percentile  99.99 = 34020.301
      sockperf: ---> percentile  99.90 = 32013.095
      sockperf: ---> percentile  99.50 = 8008.463
      sockperf: ---> percentile  99.00 = 7998.229
      sockperf: ---> percentile  95.00 = 5999.880
      sockperf: ---> percentile  90.00 = 4990.765
      sockperf: ---> percentile  75.00 = 4005.645
      sockperf: ---> percentile  50.00 = 3999.775
      sockperf: ---> percentile  25.00 = 3990.058
      sockperf: ---> <MIN> observation = 1941.773
      
  • A->B: ELB-B 경유
    • TCP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 176.32.93.150 -p 5001 -m 16384 -t 10 --pps=max --tcp
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 176.32.93.150   PORT =  5001 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.100 sec; SentMessages=2628; ReceivedMessages=2627
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=9.955 sec; SentMessages=2605; ReceivedMessages=2605
      sockperf: ====> avg-lat=1910.550 (std-dev=948.343)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 1910.550 usec
      sockperf: Total 2605 observations; each percentile contains 26.05 observations
      sockperf: ---> <MAX> observation = 31351.928
      sockperf: ---> percentile  99.99 = 31351.928
      sockperf: ---> percentile  99.90 = 13266.080
      sockperf: ---> percentile  99.50 = 4643.678
      sockperf: ---> percentile  99.00 = 4265.762
      sockperf: ---> percentile  95.00 = 3234.758
      sockperf: ---> percentile  90.00 = 2781.928
      sockperf: ---> percentile  75.00 = 2069.907
      sockperf: ---> percentile  50.00 = 1670.907
      sockperf: ---> percentile  25.00 = 1427.325
      sockperf: ---> <MIN> observation = 1145.673
      
    • UDP
      • ELB에서 UDP 미지원으로 테스트 불가
Edit

다른 Zone

  • A->C: 공인 DNS
    • TCP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 54.250.69.124 -p 5001 -m 16384 -t 10 --pps=max --tcp
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 54.250.69.124   PORT =  5001 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.102 sec; SentMessages=1982; ReceivedMessages=1981
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=10.001 sec; SentMessages=1962; ReceivedMessages=1962
      sockperf: ====> avg-lat=2548.662 (std-dev=1832.228)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 2548.662 usec
      sockperf: Total 1962 observations; each percentile contains 19.62 observations
      sockperf: ---> <MAX> observation = 46399.863
      sockperf: ---> percentile  99.99 = 46399.863
      sockperf: ---> percentile  99.90 = 26070.326
      sockperf: ---> percentile  99.50 = 12983.683
      sockperf: ---> percentile  99.00 = 4294.068
      sockperf: ---> percentile  95.00 = 4025.450
      sockperf: ---> percentile  90.00 = 3924.323
      sockperf: ---> percentile  75.00 = 2629.824
      sockperf: ---> percentile  50.00 = 2070.109
      sockperf: ---> percentile  25.00 = 1963.635
      sockperf: ---> <MIN> observation = 1606.874
      
    • UDP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 54.250.69.124 -p 5001 -m 16384 -t 10 --pps=max
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 54.250.69.124   PORT =  5001 # UDP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.101 sec; SentMessages=1153; ReceivedMessages=1152
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=10.001 sec; SentMessages=1140; ReceivedMessages=1140
      sockperf: ====> avg-lat=4386.197 (std-dev=1533.904)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 4386.197 usec
      sockperf: Total 1140 observations; each percentile contains 11.40 observations
      sockperf: ---> <MAX> observation = 28006.313
      sockperf: ---> percentile  99.99 = 28006.313
      sockperf: ---> percentile  99.90 = 26138.757
      sockperf: ---> percentile  99.50 = 12003.960
      sockperf: ---> percentile  99.00 = 10006.633
      sockperf: ---> percentile  95.00 = 6004.485
      sockperf: ---> percentile  90.00 = 5995.108
      sockperf: ---> percentile  75.00 = 4007.216
      sockperf: ---> percentile  50.00 = 4001.184
      sockperf: ---> percentile  25.00 = 3996.925
      sockperf: ---> <MIN> observation = 3253.957
      
  • A->C: 사설 DNS
    • TCP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 10.121.6.240 -p 5001 -m 16384 -t 10 --pps=max --tcp
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 10.121.6.240    PORT =  5001 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.100 sec; SentMessages=2316; ReceivedMessages=2315
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=10.003 sec; SentMessages=2297; ReceivedMessages=2297
      sockperf: ====> avg-lat=2177.273 (std-dev=1583.329)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 2177.273 usec
      sockperf: Total 2297 observations; each percentile contains 22.97 observations
      sockperf: ---> <MAX> observation = 26539.603
      sockperf: ---> percentile  99.99 = 26539.603
      sockperf: ---> percentile  99.90 = 24238.810
      sockperf: ---> percentile  99.50 = 12957.637
      sockperf: ---> percentile  99.00 = 11637.611
      sockperf: ---> percentile  95.00 = 2913.860
      sockperf: ---> percentile  90.00 = 2579.413
      sockperf: ---> percentile  75.00 = 2088.335
      sockperf: ---> percentile  50.00 = 1997.917
      sockperf: ---> percentile  25.00 = 1768.126
      sockperf: ---> <MIN> observation = 1274.989
      
    • UDP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 10.121.6.240 -p 5001 -m 16384 -t 10 --pps=max
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 10.121.6.240    PORT =  5001 # UDP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.101 sec; SentMessages=934; ReceivedMessages=933
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=9.997 sec; SentMessages=924; ReceivedMessages=924
      sockperf: ====> avg-lat=5409.573 (std-dev=1625.872)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 5409.573 usec
      sockperf: Total 924 observations; each percentile contains 9.24 observations
      sockperf: ---> <MAX> observation = 25542.427
      sockperf: ---> percentile  99.99 = 25542.427
      sockperf: ---> percentile  99.90 = 20010.379
      sockperf: ---> percentile  99.50 = 12113.971
      sockperf: ---> percentile  99.00 = 8020.686
      sockperf: ---> percentile  95.00 = 7988.814
      sockperf: ---> percentile  90.00 = 6012.314
      sockperf: ---> percentile  75.00 = 6003.931
      sockperf: ---> percentile  50.00 = 5994.757
      sockperf: ---> percentile  25.00 = 4001.799
      sockperf: ---> <MIN> observation = 1996.650
      
  • A->C: ELB-C 경유
    • TCP
      root@ip-10-152-173-96:/usr/local/sockperf/bin# ./sockperf ping-pong -i 54.248.124.224 -p 5001 -m 16384 -t 10 --pps=max --tcp
      sockperf:  == version #2.5. == 
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 54.248.124.224  PORT =  5001 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=10.099 sec; SentMessages=1579; ReceivedMessages=1578
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=10.000 sec; SentMessages=1562; ReceivedMessages=1562
      sockperf: ====> avg-lat=3200.865 (std-dev=1955.397)
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 3200.865 usec
      sockperf: Total 1562 observations; each percentile contains 15.62 observations
      sockperf: ---> <MAX> observation = 25292.453
      sockperf: ---> percentile  99.99 = 25292.453
      sockperf: ---> percentile  99.90 = 24183.071
      sockperf: ---> percentile  99.50 = 19981.548
      sockperf: ---> percentile  99.00 = 14068.981
      sockperf: ---> percentile  95.00 = 4114.684
      sockperf: ---> percentile  90.00 = 4015.404
      sockperf: ---> percentile  75.00 = 3850.997
      sockperf: ---> percentile  50.00 = 2928.466
      sockperf: ---> percentile  25.00 = 2218.596
      sockperf: ---> <MIN> observation = 1889.028
      
    • UDP
      • ELB에서 UDP 미지원으로 테스트 불가


(그외 유사 구글 검색 자료): http://orensol.com/2009/05/24/network-latency-inside-and-across-amazon-ec2-availability-zones/


Posted by 사랑줍는거지
,

http://redmine.nehome.net/redmine/projects/chef/wiki/Install_Chef-Server_010x_on_Ubuntu_1204


Install Chef-Server 010x on Ubuntu 11.04/12.04

Edit

apt 저장소 등록

  • Chef는 현재 세부 기능의 차이로 0.9.x와 0.10.x 2종류로 나뉜다.
  • 본 문서에서는 0.10.x를 사용하는 것으로 한다.
Edit

apt source.list 등록

  • Ubuntu for Chef 0.9.x
    echo "deb http://apt.opscode.com/ `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/opscode.list
    
  • Ubuntu for Chef 0.10.x
    echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
    
Edit

GPG Key 등록

  • 패키지의 무결성 보장을 위해 Opscode GPG키 등록
    sudo mkdir -p /etc/apt/trusted.gpg.d
    gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
    gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
    
  • (Note) keyserver timeout 에러 발생시 아래 방법을 통해 Opscode로부터 직접 Key를 다운로드.
    gpg --fetch-key http://apt.opscode.com/packages@opscode.com.gpg.key
    gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
    
Edit

저장소 목록 update 및 Opscode-keyring 설치

sudo apt-get update
sudo apt-get install opscode-keyring
Edit

Chef의 원활한 설치를 위해, 라이브러리들을 비롯해 배포본을 최신으로 upgrade

sudo apt-get upgrade
Edit

chef-server 패키지 설치

  • chef와 chef-server 패키지만으로도 충분하나, web-ui를 필요로 한다면, 확장 패키지들이 필요하다.
  • 설치 중, 하기와 같은 입력값을 요구 받을 수 있다.
Edit

chef-server 설치

  • chef-server core 설치
    sudo apt-get install chef chef-server
    
    • 상세 수행 내역
      • Install all the dependencies for Chef Server, including Merb, CouchDB, RabbitMQ, etc.
      • Starts CouchDB (via the couchdb package).
      • Starts RabbitMQ (via the rabbitmq-server package).
      • Start chef-server-api via /etc/init.d/chef-server, running a merb worker on port 4000
      • Start chef-server-webui via /etc/init.d/chef-server-webui, running a merb worker on port 4040
      • Start chef-solr-indexer via /etc/init.d/chef-solr-indexer, connecting to the rabbitmq-server
      • Start chef-solr via /etc/init.d/chef-solr, using the distro package for solr-jetty
      • Start chef-client via /etc/init.d/chef-client
      • Add configuration files in /etc/chef for the client, server, solr/solr-indexer and solo
      • Create all the correct directory paths per the configuration files
  • web-ui 설치
    sudo apt-get install chef chef-server-api chef-expander
    
Edit

설치 상태 확인

  • 설치가 끝나면 하기 표에 열거된 프로세스들의 작동 상태를 확인 해야 한다.
Edit

Chef Server 구성요소 및 응답포트 안내

  • Chef Server WebUI는 Chef시스템 운영에서 필수 요소는 아니다. (Optional)
  • 혹, Chef Server WebUI가 작동되지 않는다면, /var/run/chef/server-webui.main.pid 파일이 이미 존재해서 일 가능성이 있다. 해당 파일을 삭제하고 다시 Start시도를 해본다.
NameListen Portps 수행결과 출력 샘플
Chef Server4000merb : chef-server (api) : worker (port 4000)
Chef Server WebUI(Optional)4040merb : chef-server-webui : worker (port 4040)
CouchDB5984beam.smp -Bd -K true – -root /usr/local/lib/erlang -progname erl – -noshell -noinput -couch_ini /usr/local/etc/couchdb/default.ini /usr/local/etc/couchdb/local.ini -s couch
RabbitMQ5672{{beam.smp -W w -K true -A30 – -root /usr/local/lib/erlang -progname erl – -noshell -noinput -s rabbit -sname rabbit -rabbit tcp_listeners [{"0.0.0.0", 5672}]}}
Chef Solr8983/usr/bin/java -Xmx250M -Xms250M -Dsolr.data.dir=/opscode/chef/features/data/solr/data -Dsolr.solr.home=/opscode/chef/features/data/solr/home -jar /opscode/chef/features/data/solr/jetty/start.jar
Chef Expandernoneruby ./chef-solr/bin/chef-expander -c /etc/chef/solr.rb -l debug
Edit

설정/구성

  • 이제부터는 Chef 시스템에서 가장 중요한 "설정/구성"단계로서, Client와 Server간의 식별을 위한 인증서/인증키 생성 및 Chef Server에 대한 설정을 수행해야 한다.
  • knife라는 도구를 통해 필요한 값을 입력함으로 자동으로 구성해주는 방법과, 설정 파일을 수동으로 기술하는 방법 2가지 모두 가능.
  • 본 가이드에서는 Opscode에서 권장하는 knife 도구를 이용한 정석적 방법으로 설명한다.
Edit

Chef 환경 디렉토리 생성

  • (Note) Certificates Read Only
mkdir -p ~/.chef
sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
sudo chown -R $USER ~/.chef
Edit

knife 도구를 이용한 Chef Server 환경 구성

  • knife : Chef-Server의 API 호출을 지원하는 CLI.
  • 처음 접하면 난해한 면이 있다.
  • Chef-Server입장에서 아무 Client나 Chef-Server의 Role/Recipe를 적용하도록 허용되어서도 안되고, Chef-Client입장에서도 아무 Chef-Server에서 제공되는 Role/Recipe를 받아서도 안되기 때문에 인증 체계가 중요하다.
  • 설치후, knife.rb파일에 cookbooks 디렉토리 경로를 지정하는 설정을 추가한다.
    • cookbook_path [ "/var/lib/chef/cookbooks" ]
knife configure -i
> WARNING: No knife configuration file found
> Where should I put the config file? [/root/.chef/knife.rb] 
> Please enter the chef server URL: [http://ubuntu:4000] http://localhost:4000
> Please enter a clientname for the new client: [root] 
> Please enter the existing admin clientname: [chef-webui] 
> Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] /root/.chef/webui.pem
> Please enter the validation clientname: [chef-validator] 
> Please enter the location of the validation key: [/etc/chef/validation.pem] /root/.chef/validation.pem
> Please enter the path to a chef repository (or leave blank): 
> Creating initial API user...
> Created client[root]
> Configuration file written to /root/.chef/knife.rb
  • WARNING: No knife configuration file found
    • 최초 구성시 Chef Server 설정 파일(knife.rb)이 없어서 생기는 경고.(무시)
  • Where should I put the config file? [/root/.chef/knife.rb]
    • knife.rb 파일의 위치 입력
  • Please enter the chef server URL: [http://ubuntu:4000]
    • Chef Server 호출 URI 입력
  • Please enter a clientname for the new client: [root]
    • 새로운 Client 하나를 생성. (불필요하면 추후 삭제 가능할 듯...)
  • Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem]
    • 이미 존재하는 관리용(admin) Client의 pem 파일 위치 입력
  • Please enter the validation clientname: [chef-validator]
    • chef-validator라는 client는 특별한 계정으로서, 신규 노드의 자동등록을 위해 사용된다.
  • Please enter the location of the validation key: [/etc/chef/validation.pem]
    • chef-validation client용도의 pem 파일 위치 입력
  • Please enter the path to a chef repository (or leave blank):
    • Chef 저장소에 대한 위치 입력 (Defautl 유지)
Edit

설정/구성 상태 확인 테스트

  • 복수의 Client를 생성(개별 인증/pem 운영)하여 Chef시스템을 운영 할 수도 있다. 관련 내용은 도입부의 참조 문서 내용에 상세히 기술되어 있음.
  • 본 문서는 chef-validation.pem 하나로 Chef-Client를 등록/식별하는 용도로 작성되었으므로, Client 에게 배포할 인증서는 validation.pem이다. (보안 문제가 있을 수 있다. 검토중...)
  • Client 목록 조회 테스트
    knife client list
    > chef-validator
    > chef-webui
    > root
    > ubuntu
    
  • Node 목록 조회 테스트
    knife node list
    > ubuntu
    
Edit

[END] Chef-Sever 구축 완료.

Posted by 사랑줍는거지
,