Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SmartOS Primer

2,398 views

Published on

An introduction to SmartOS that will get you started

Published in: Technology
  • Be the first to comment

SmartOS Primer

  1. 1. SmartOS Primer Daniele Stroppa, ZHAW strp@zhaw.ch, @moviolone www.cloudcomp.ch
  2. 2. Agenda ■ Getting Started ■ Disk Administration ■ Images Administration ■ Virtual Machines Administration ■ Network Administration www.cloudcomp.ch
  3. 3. Getting Started - Requirements ■ System Requirements ○ Minimum 1GB RAM* ○ 64-bit x86 CPU ■ To use KVM SmartOS requires an Intel CPU with VT-x extensions ○ http://ark.intel.com/Products/VirtualizationTechnology * Since SmartOS is a live OS, the more RAM the better www.cloudcomp.ch
  4. 4. Getting Started - USB boot ■ Get the latest USB image from http://wiki. smartos. org/display/DOC/Download+SmartOS ■ Create a bootable USB drive from the image ○ e.g.: on Linux, dd if=smartos-$RELEASE-usb.img of=/dev/sdb bs=1024 ■ Stick the USB drive in a port and boot www.cloudcomp.ch
  5. 5. Getting Started - PXE boot ■ Get the latest Platform image from http://wiki. smartos. org/display/DOC/Download+SmartOS and unpack it in your netboot env ○ Make sure the kernel and the boot archive have the following path: (prefix) /platform/i86pc/kernel/amd64/unix for the kernel and (prefix)/platform/i86pc/amd64/boot_archive for the boot archive. (prefix) can be any path, e.g. /tftpboot/smartos/20130724 www.cloudcomp.ch
  6. 6. Getting Started - PXE boot ■ Get a PXE client, e.g. iPXE, configure DHCP for PXE chainloading, e.g. http://ipxe. org/howto/dhcpd ■ Create a PXE boot script, e.g. #!ipxe kernel /smartos/20130724/platform/i86pc/kernel/amd64/unix initrd /smartos/20130724/platform/i86pc/amd64/boot_archive boot www.cloudcomp.ch
  7. 7. Getting Started - Gotcha's ■ Basic configuration is stored in /usbkey/config ○ This is limited to networking, DNS, and NTP ○ Root password and SSH config are also in /usbkey ■ /etc is non-persistent, /opt and /var are. www.cloudcomp.ch
  8. 8. Disk Administration - Intro ■ ZFS is default in SmartOS ■ Pools and datasets ○ Pool: a collection of one or more virtual devices, e.g. disks, files,.. ○ Dataset: a control point for a volume or file system ■ Two commands: zpool and zfs www.cloudcomp.ch
  9. 9. Disk Administration - Pools ■ Create a pool # zpool create data c0t0d0 c0t1d0 ■ Grow a pool # zpool add data c0t2d0 ○ Note: as of today, pools cannot shrink. www.cloudcomp.ch
  10. 10. Disk Administration - Datasets ■ Create a pool # zfs create data/db ■ Create a snapshot # zfs snapshot -r data/db@20130724 ■ Rollback a snapshot # zfs rollback data/db@20130724 ■ Clone a snapshot # zfs clone data/db@20130724 data/db2 www.cloudcomp.ch
  11. 11. Images Administration - Intro ■ Images are templates that contain data (ZFS dataset) and metadata (JSON) ■ Images are used in SmartOS when creating Virtual Machines ■ Default image server is datasets.joyent.com ○ found in /var/db/imgadm/sources.list ■ One tool: imgadm www.cloudcomp.ch
  12. 12. Images Administration - imgadm ■ Get images www.cloudcomp.ch # imgadm update updating local images database... Get https://datasets.joyent.com/datasets... done # imgadm avail UUID OS PUBLISHED URN 6bf31ce2-f384-11e1-a338-e39c2fe4ab59 smartos 2012-08-31 sdc:sdc:mongodb:1.3.2 a0f8cf30-f2ea-11e1-8a51-5793736be67c smartos 2012-08-30 sdc:sdc:standard64:1.0.7 3390ca7c-f2e7-11e1-8818-c36e0b12e58b smartos 2012-08-30 sdc:sdc:standard:1.0.7 9604da58-f1ee-11e1-aba1-dbda3337ec46 smartos 2012-08-29 sdc:sdc:mongodb:1.3.1 [...]
  13. 13. Images Administration - imgadm ■ Get images www.cloudcomp.ch # imgadm import 9eac5c0c-a941-11e2-a7dc-57a6b041988f 9eac5c0c-a941-11e2-a7dc-57a6b041988f doesnt exist. continuing with install 9eac5c0c-a941-11e2-a7dc-57a6b041988f successfully installed image 9eac5c0c-a941-11e2-a7dc-57a6b041988f successfully imported # imgadm list UUID OS PUBLISHED URN 9eac5c0c-a941-11e2-a7dc-57a6b041988f smartos 2013-04-26 sdc:sdc:base64:13.1.0
  14. 14. Virtual Machines Administration - Intro ■ Two flavours: zone ("joyent" brand) and KVM ("kvm" brand) ○ KVM VMs still run in a zone though ■ VM = Image + manifest (JSON) ■ One tool: vmadm www.cloudcomp.ch
  15. 15. Virtual Machines Administration - Creating a Zone ■ Get a zone image ○ Use imgadm avail. Images with the OS type smar are zone images ■ Zone manifest { "brand": "joyent", "image_uuid": " 9eac5c0c-a941-11e2-a7dc-57a6b041988f ", "alias": "zone01", "hostname": "zone01", "max_physical_memory": 1024, "quota": 20, "nics": [ { "nic_tag": "admin", "ip": "10.20.50.24", "netmask": "255.255.255.0", "gateway": "10.20.50.1" } ] www.cloudcomp.ch
  16. 16. Virtual Machines Administration - Creating a KVM ■ Get a KVM image ○ Use imgadm avail. Images with the OS type linux are KVM images ■ KVM manifest { "brand": "kvm", "resolvers": [ "208.67.222.222", "8.8.4.4" ], "default-gateway": "10.20.50.1", "ram": "2048", "vcpus": "1", ... www.cloudcomp.ch
  17. 17. Virtual Machines Administration - Creating a KVM ■ KVM manifest "nics": [ { "nic_tag": "admin", "ip": "10.20.50.48", "netmask": "255.255.255.0", "gateway": "10.20.50.1", "model": "virtio", "primary": true } ], "disks": [ { "image_uuid": "e42f8c84-bbea-11e2-b920-078fab2aab1f", "boot": true, "model": "virtio", "image_size": 10240 } ] } www.cloudcomp.ch
  18. 18. Virtual Machines Administration - vmadm ■ Create the VM # vmadm create -f zone01.json Successfully created 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 ■ Zone login # vmadm console 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 ■ VM listing # vmadm list UUID TYPE RAM STATE ALIAS 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 OS 1024 running zone01 f144656f-41d4-460f-75ab-26f38d8f9fc6 KVM 2048 running fedora01 www.cloudcomp.ch
  19. 19. Virtual Machines Administration - vmadm ■ VM start/stop/reboot/delete # vmadm start UUID # vmadm stop UUID # vmadm reboot UUID # vmadm delete UUID ■ VM update, e.g. increase disk size # vmadm update 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 quota=40 ■ VM migration (experimental) # vmadm send 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 |ssh 10.0.1.2 vmadm receive Password: Succesfully sent VM 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 Succesfully received VM 4aac2fb2-f30a-49ef-08d2-41e6af10bde1 www.cloudcomp.ch
  20. 20. Network Administration - Intro ■ Each VM can get up to 32 VNICs ■ VRRP, Link aggregation ■ One tool: dladm www.cloudcomp.ch
  21. 21. Network Administration - dladm ■ Create and configure the VNIC # dladm create-vnic -l e1000g0 -v 128 backup0 # ifconfig backup0 plumb # ifconfig backup0 inet 10.30.50.7 netmask 255.255.255.0 up ■ To persist a VNIC across reboot store the configuration in /usbkey/config www.cloudcomp.ch
  22. 22. Network Administration - Link Aggregation ■ Get available physical NICs # dladm show-phys -m LINK SLOT ADDRESS INUSE CLIENT e1000g0 primary 0:11:45:4f:a6:f5 yes e1000g0 e1000g1 primary 0:11:45:47:90:aa yes e1000g1 ■ Add a <name>_aggr config in /usbkey/config # List MAC address in the aggregation backup_aggr=0:11:45:4f:a6:f5,0:11:45:47:90:aa # VM nics with backup nic_tags will now have # their vnics created on the aggregation admin_nic=e1000g0 backup_nic=backup ■ Reboot and verify # dladm show-aggr LINK POLICY ADDRPOLICY LACPACTIVITY LACPTIMER FLAGS backup L4 auto active short ----- www.cloudcomp.ch
  23. 23. Q&A? strp@zhaw.ch, @moviolone Thank you! www.cloudcomp.ch
  24. 24. References ■ http://wiki.smartos.org ■ http://smartos.org/2012/08/22/smartos-an-sa-primer/ www.cloudcomp.ch

×