d61772gc20_toc

10
Oracle Solaris Containers Administration Student Guide D61772GC20 Edition 2.0 October 2010 D69209

Upload: gyan1

Post on 02-Oct-2015

4 views

Category:

Documents


0 download

TRANSCRIPT

  • Oracle Solaris Containers Administration Student Guide

    D61772GC20 Edition 2.0 October 2010 D69209

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved. Disclaimer This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way. Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Restricted Rights Notice If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS The U.S. Governments rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract. Trademark Notice Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

    Author Enzo Silva

    Technical Contributors and Reviewers David Maxwell, Duncan Hardie, Penny Cotten, Jeff McMeekin, Stephen Lawrence, John Powell

    This book was published using: Oracle Tutor

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents i

    Table of Contents

    Oracle Solaris Containers Administration Introduction ...............................................................................1-1 Oracle Solaris Containers Administration Introduction ..................................................................................1-2 Overview ........................................................................................................................................................1-3 Goals ..............................................................................................................................................................1-4 Agenda ...........................................................................................................................................................1-5 Introductions ..................................................................................................................................................1-13 Housekeeping ................................................................................................................................................1-14

    Virtualization Trends in the Data Center ........................................................................................................2-1 Virtualization Trends in the Data Center ........................................................................................................2-2 Objectives ......................................................................................................................................................2-3 Lesson Agenda ..............................................................................................................................................2-4 Introduction to Server Virtualization ...............................................................................................................2-5 What Is Server Virtualization? ........................................................................................................................2-7 Lesson Agenda ..............................................................................................................................................2-9 Virtualization Benefits: The Dynamic Data Center .........................................................................................2-10 Lesson Agenda ..............................................................................................................................................2-12 Virtualization Technologies by Oracle ............................................................................................................2-13 Summary ........................................................................................................................................................2-15

    Describing Oracle Solaris Zones and Containers .........................................................................................3-1 Describing Oracle Solaris Zones and Containers ...........................................................................................3-2 Objectives ......................................................................................................................................................3-3 Lesson Agenda ..............................................................................................................................................3-4 Oracle Solaris Zones ......................................................................................................................................3-5 Lesson Agenda ..............................................................................................................................................3-7 Zone Features ................................................................................................................................................3-8 Lesson Agenda ..............................................................................................................................................3-10 When to Use Solaris Zones ...........................................................................................................................3-11 Lesson Agenda ..............................................................................................................................................3-17 Solaris Containers ..........................................................................................................................................3-18 Guidelines for Deploying Solaris Containers ..................................................................................................3-19 Lesson Agenda ..............................................................................................................................................3-23 Zone Concepts ...............................................................................................................................................3-24 Zone Types ....................................................................................................................................................3-25 Zone Types: The Global Zone........................................................................................................................3-26 Zone Types: The Non-Global Zone ................................................................................................................3-28 Zone Daemons ...............................................................................................................................................3-30 Zone Models ..................................................................................................................................................3-31 Zone Models: Sparse Root Model ..................................................................................................................3-32 Zone Models: Whole Root Model ...................................................................................................................3-34 Zone Networking ............................................................................................................................................3-35 Zone Networking: Shared-IP Non-Global Zones ............................................................................................3-36 Zone Networking: Exclusive-IP Non-Global Zones ........................................................................................3-37 Zone States ....................................................................................................................................................3-38 Lesson Agenda ..............................................................................................................................................3-40 Using DTrace to Monitor Zone State Changes ..............................................................................................3-41 Using Dtrace to Monitor Zone State Changes ................................................................................................3-42 Quiz ................................................................................................................................................................3-44

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents ii

    Summary ........................................................................................................................................................3-47

    Creating, Installing, and Booting Zones ........................................................................................................4-1 Creating, Installing, and Booting Zones .........................................................................................................4-2 Objectives ......................................................................................................................................................4-3 Lesson Agenda ..............................................................................................................................................4-4 Configuring Zones ..........................................................................................................................................4-5 Lesson Agenda ..............................................................................................................................................4-7 Using the zonecfg Command to Configure Zones .........................................................................................4-8 Identifying the zonecfg Command Scope ......................................................................................................4-9 Using zonecfg Subcommands........................................................................................................................4-10 Using zonecfg Resource and Property Parameters ......................................................................................4-12 Lesson Agenda ..............................................................................................................................................4-19 Zone Configuration Walk-Through .................................................................................................................4-20 Viewing the Zone Configuration .....................................................................................................................4-24 Exporting the Zone Configuration ...................................................................................................................4-26 Lesson Agenda ..............................................................................................................................................4-28 Using the zoneadm Command .......................................................................................................................4-29 Verifying a Configured Zone ..........................................................................................................................4-30 Installing a Configured Zone ..........................................................................................................................4-32 Booting a Zone ...............................................................................................................................................4-34 Rebooting a Zone ...........................................................................................................................................4-35 Halting a Zone ................................................................................................................................................4-36 Lesson Agenda ..............................................................................................................................................4-37 Using the zlogin Command ............................................................................................................................4-38 Modes of Operation ........................................................................................................................................4-39 Logging In to the Zone's Virtual Console: First Time ......................................................................................4-41 Using Fail-Safe Mode to Enter a Zone ...........................................................................................................4-43 Using the init Command .................................................................................................................................4-44 Using the shutdown Command ......................................................................................................................4-45 Using an /etc/sysidcfg File to Perform the Initial Zone Configuration .............................................................4-46 Quiz ................................................................................................................................................................4-49 Summary ........................................................................................................................................................4-52 Practice 4 Overview: Creating, Installing, and Booting Zones .......................................................................4-53

    Connecting Storage to Zones .........................................................................................................................5-1 Connecting Storage to Zones ........................................................................................................................5-2 Objectives ......................................................................................................................................................5-3 Lesson Agenda ..............................................................................................................................................5-4 Storage in Non-Global Zones .........................................................................................................................5-5 Lesson Agenda ..............................................................................................................................................5-7 Assigning File Systems to Zones ...................................................................................................................5-8 Unmounting File Systems from Zones ...........................................................................................................5-10 Working with Loopback File Systems .............................................................................................................5-11 Working with Solaris ZFS File Systems .........................................................................................................5-17 Working with UNIX File Systems ....................................................................................................................5-23 Working with Network File Systems ...............................................................................................................5-25 Lesson Agenda ..............................................................................................................................................5-27 Security Restrictions and File System Behavior .............................................................................................5-28 Lesson Agenda ..............................................................................................................................................5-30 Additional File System Considerations ...........................................................................................................5-31

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents iii

    Accessing Direct Devices ...............................................................................................................................5-32 Using the -o nosuid mount option ...................................................................................................................5-34 Mounting Read-Only File Systems .................................................................................................................5-35 Sharing File Systems .....................................................................................................................................5-36 Protecting Data by Using Zones .....................................................................................................................5-37 Using Shared File Systems as Primitive IPC .................................................................................................5-39 Additional Files System Considerations .........................................................................................................5-40 Quiz ................................................................................................................................................................5-42 Summary ........................................................................................................................................................5-45 Practice 5 Overview: Connecting Storage to Zones ......................................................................................5-46

    Managing Packages and Patches Within Zones ...........................................................................................6-1 Managing Packages and Patches Within Zones ...........................................................................................6-2 Objectives ......................................................................................................................................................6-3 Lesson Agenda ..............................................................................................................................................6-4 Package Management and Oracle Solaris Zones Technology ......................................................................6-5 How Zone State Affects Patch and Package Operations ..............................................................................6-8 Package Parameters for Zones ......................................................................................................................6-10 Lesson Agenda ..............................................................................................................................................6-19 Adding Packages in Zones ............................................................................................................................6-20 Using pkgadd in the Global Zone ...................................................................................................................6-21 Using the -G Option With pkgadd in the Global Zone ...................................................................................6-27 Using pkgadd in a Non-Global Zone ..............................................................................................................6-28 Using the -G Option with pkgadd in a Non-Global Zone ...............................................................................6-29 Lesson Agenda ..............................................................................................................................................6-30 Removing Packages from Zones ...................................................................................................................6-31 Using pkgrm in the Global Zone .....................................................................................................................6-34 Using pkgrm in a Non-Global Zone ................................................................................................................6-36 Lesson Agenda ..............................................................................................................................................6-37 Adding Patches in Zones ...............................................................................................................................6-38 Using patchadd in the Global Zone ................................................................................................................6-39 Using the G Option With patchadd in the Global Zone ................................................................................6-44 Using patchadd in a Non-Global Zone ...........................................................................................................6-46 Using Zones Parallel Patching to Reduce Patching Time ..............................................................................6-48 Lesson Agenda ..............................................................................................................................................6-50 Removing Patches from Zones ......................................................................................................................6-51 Using patchrm in the Global Zone ..................................................................................................................6-52 Using patchrm in a Non-Global Zone .............................................................................................................6-53 Lesson Agenda ..............................................................................................................................................6-54 Upgrading Systems with Non-Global Zones Installed ...................................................................................6-55 Quiz ................................................................................................................................................................6-56 Summary ........................................................................................................................................................6-59 Practice 6 Overview: Managing Packages and Patches Within Zones .........................................................6-60

    Configuring Persistent Resource Pools ........................................................................................................7-1 Configuring Persistent Resource Pools ..........................................................................................................7-2 Objectives ......................................................................................................................................................7-3 Lesson Agenda ..............................................................................................................................................7-4 Introducing Resource Management ...............................................................................................................7-5 Resource Containment ..................................................................................................................................7-6 Resource Management Control Mechanisms ................................................................................................7-8

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents iv

    Managing Workloads .....................................................................................................................................7-10 Defining Workloads ........................................................................................................................................7-13 Lesson Agenda ..............................................................................................................................................7-15 Introducing Resource Pools ...........................................................................................................................7-16 When to Use Pools ........................................................................................................................................7-19 Lesson Agenda ..............................................................................................................................................7-21 Resource Pools Framework ...........................................................................................................................7-22 The Pool Daemon ..........................................................................................................................................7-24 The /etc/pooladm.conf Configuration File .......................................................................................................7-26 Lesson Agenda ..............................................................................................................................................7-29 Implementing Pools on a System ...................................................................................................................7-30 Lesson Agenda ..............................................................................................................................................7-31 Configuring Resource Pools ..........................................................................................................................7-32 Enabling and Disabling the Resource Pools Service ....................................................................................7-34 Pool Configuration Walk-Through ..................................................................................................................7-40 Create the Initial Configuration .......................................................................................................................7-41 Modify the Configuration ................................................................................................................................7-44 Associate a Pool with a Scheduling Class .....................................................................................................7-47 Set Configuration Constraints ........................................................................................................................7-49 Define Configuration wt-load and locality Objectives ....................................................................................7-50 Set the poold Logging Level ...........................................................................................................................7-53 Moving Between Processor Sets ...................................................................................................................7-54 Validating a Configuration ..............................................................................................................................7-55 Lesson Agenda ..............................................................................................................................................7-56 Binding to a Resource Pool ............................................................................................................................7-57 Lesson Agenda ..............................................................................................................................................7-61 Monitoring Statistics for Pool-Related Resources .........................................................................................7-62 Lesson Agenda ..............................................................................................................................................7-66 Removing an Active Pools Configuration .......................................................................................................7-67 Quiz ................................................................................................................................................................7-68 Summary ........................................................................................................................................................7-71 Practice 7 Overview: Configuring Persistent Resource Pools .......................................................................7-72

    Configuring Resource Management with Zones ...........................................................................................8-1 Configuring Resource Management with Zones ...........................................................................................8-2 Objectives ......................................................................................................................................................8-3 Lesson Agenda ..............................................................................................................................................8-4 Introducing Resource Management with Zones ............................................................................................8-5 Enhancing Solaris Containers with Important Features .................................................................................8-6 Lesson Agenda ..............................................................................................................................................8-8 Managing Scheduling Classes and the Fair Share Scheduler .......................................................................8-9 Describing CPU Shares .................................................................................................................................8-11 Combining FSS with Other Scheduling Classes ...........................................................................................8-13 Lesson Agenda ..............................................................................................................................................8-19 Configuring FSS .............................................................................................................................................8-20 Making FSS the Default Scheduling Class .....................................................................................................8-21 Manually Move Processes from the TS Class into the FSS Class .................................................................8-23 Manually Move Processes from All User Classes into the FSS Class ...........................................................8-24 Setting the Scheduling Class for a Zone ........................................................................................................8-25 Lesson Agenda ..............................................................................................................................................8-27

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents v

    Monitoring FSS ..............................................................................................................................................8-28 Lesson Agenda ..............................................................................................................................................8-29 Configuring CPU Shares for Zones ................................................................................................................8-30 Using the cpu-shares Zone Property ..............................................................................................................8-31 Booting a Zone with cpu-shares Configured ..................................................................................................8-36 Removing the cpu-shares Zone Property .......................................................................................................8-38 Using prctl to Configure CPU Shares .............................................................................................................8-41 Monitoring the Effect of CPU Shares by Using prstat ....................................................................................8-43 Lesson Agenda ..............................................................................................................................................8-45 Configuring Temporary Resource Pools ........................................................................................................8-46 Using the dedicated-cpu Zone Resource .......................................................................................................8-47 Removing a dedicated-cpu Resource ............................................................................................................8-49 Creating Compatible Zone Configurations with CPU Shares and Resource Pools ........................................8-50 Displaying Temporary Resource Pool Configurations ....................................................................................8-51 Lesson Agenda ..............................................................................................................................................8-54 Configuring the capped-cpu Resource for Zones ...........................................................................................8-55 Lesson Agenda ..............................................................................................................................................8-56 Configuring Memory Capping for Zones ........................................................................................................8-57 How Resource Capping Works ......................................................................................................................8-58 Resource Capping Guidelines .......................................................................................................................8-60 Resource-Capping Guidelines .......................................................................................................................8-62 Enabling and Disabling the rcap Service ........................................................................................................8-63 Using zonecfg to Configure Memory Caps ....................................................................................................8-65 Using rcapadm to Configure Memory Caps ..................................................................................................8-69 Monitoring the Effect of Memory Caps Using rcapstat ...................................................................................8-70 Setting the Memory Cap Enforcement Threshold .........................................................................................8-71 Quiz ................................................................................................................................................................8-72 Summary ........................................................................................................................................................8-75 Practice 8 Overview: Configuring Resource Management with Zones ..........................................................8-76

    Performing Zone Advanced Networ Management ........................................................................................9-1 Performing Zone Advanced Network Management ........................................................................................9-2 Objectives ......................................................................................................................................................9-3 Lesson Agenda ..............................................................................................................................................9-4 Introducing IPMP ............................................................................................................................................9-5 Lesson Agenda ..............................................................................................................................................9-7 IPMP Configuration Schemes ........................................................................................................................9-8 Lesson Agenda ..............................................................................................................................................9-9 Using IPMP on a System with Zones Installed ...............................................................................................9-10 IPMP in Shared-IP Zones ..............................................................................................................................9-11 Probe-Based IPMP Configuration Walk-Through ..........................................................................................9-12 IPMP in Exclusive-IP Non-Global Zones ........................................................................................................9-21 Configuring Exclusive-IP Non-Global Zones ..................................................................................................9-22 Supported Network Adapters .........................................................................................................................9-24 Viewing Network Interface Assignments to Zones by Using dladm................................................................9-26 Assigning Network Interfaces to Running Zones by Using dladm ..................................................................9-28 Quiz ................................................................................................................................................................9-30 Summary ........................................................................................................................................................9-33 Practice 9 Overview: Performing Zone Advanced Network Management .....................................................9-34

    Renaming, Moving, Cloning, and Migrating Zones .......................................................................................10-1

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents vi

    Renaming, Moving, Cloning, and Migrating Zones .........................................................................................10-2 Objectives ......................................................................................................................................................10-3 Lesson Agenda ..............................................................................................................................................10-4 Renaming a Zone ...........................................................................................................................................10-5 Lesson Agenda ..............................................................................................................................................10-6 Moving a Zone ...............................................................................................................................................10-7 Lesson Agenda ..............................................................................................................................................10-8 Cloning a Zone ...............................................................................................................................................10-9 Cloning a Zone Walk-Through .......................................................................................................................10-11 Lesson Agenda ..............................................................................................................................................10-14 Migrating a Zone ............................................................................................................................................10-15 Migrating a Non-Global Zone Walk-Through ..................................................................................................10-18 How to Validate a Zone Migration Before the Migration Is Performed ............................................................10-25 Quiz ................................................................................................................................................................10-28 Summary ........................................................................................................................................................10-31 Practice 10 Overview: Renaming, Moving, Cloning, and Migrating Zones ....................................................10-32

    Performing Zone Backups and Restores .......................................................................................................11-1 Performing Zone Backups and Restores .......................................................................................................11-2 Objectives ......................................................................................................................................................11-3 Lesson Agenda ..............................................................................................................................................11-4 Creating Backups on Systems with Installed Zones ......................................................................................11-5 Lesson Agenda ..............................................................................................................................................11-6 Relating Non-Global Zone Configurations to Backup and Recovery Requirements.......................................11-7 Example 1: Backing Up One Root File System ..............................................................................................11-9 Example 2: Backing Up Separate Root File System and Data File Systems .................................................11-11 Lesson Agenda ..............................................................................................................................................11-15 Making Zone Backups from the Global Zone .................................................................................................11-16 Using ufsdump to Back Up a Non-Global Zone..............................................................................................11-17 Using fssnap and ufsdump to Back Up a Non-Global Zone ...........................................................................11-26 Lesson Agenda ..............................................................................................................................................11-30 Making Backups from Within a Non-Global Zone ..........................................................................................11-31 Backing Up Loopback File System Directories..............................................................................................11-32 Saving and Restoring Non-Global Zone Configuration Information................................................................11-33 Lesson Agenda ..............................................................................................................................................11-34 Saving and Restoring Non-Global Zone Configuration Information................................................................11-35 Lesson Agenda ..............................................................................................................................................11-37 Recovering Individual Non-Global Zones .......................................................................................................11-38 Recovering Individual Non-Global Zones Walk-Through ..............................................................................11-40 Quiz ................................................................................................................................................................11-46 Summary ........................................................................................................................................................11-49 Practice 11 Overview: Performing Zone Backups and Restores ...................................................................11-50

    Migrating a Physical Solaris System into a Zone ..........................................................................................12-1 Migrating a Physical Solaris System into a Zone ..........................................................................................12-2 Objectives ......................................................................................................................................................12-3 Lesson Agenda ..............................................................................................................................................12-4 When to Perform a P2V Migration ..................................................................................................................12-5 Lesson Agenda ..............................................................................................................................................12-6 Preparing a System for Migration ...................................................................................................................12-7 Assessing the System to Be Migrated ............................................................................................................12-8

  • Copyright 2010, Oracle and/or its affiliates. All rights reserved.

    Oracle Solaris Containers Administration Table of Contents vii

    Lesson Agenda ..............................................................................................................................................12-16 Creating the Image of the Source Solaris System ..........................................................................................12-17 Creating and Transferring the Source System Image ...................................................................................12-18 Other Archive Creation Methods ....................................................................................................................12-21 Lesson Agenda ..............................................................................................................................................12-22 Configuring the Zone ......................................................................................................................................12-23 Installing and Booting the Zone ......................................................................................................................12-24 Lesson Agenda ..............................................................................................................................................12-26 Host ID Emulation ..........................................................................................................................................12-27 Quiz ................................................................................................................................................................12-28 Summary ........................................................................................................................................................12-31 Practice 12 Overview: Migrating a Physical Solaris System into a Zone .......................................................12-32

    Configuring the lx Branded Zone ...................................................................................................................13-1 Configuring the lx Branded Zone ....................................................................................................................13-2 Objectives ......................................................................................................................................................13-3 Lesson Agenda ..............................................................................................................................................13-4 Branded Zones Technology ...........................................................................................................................13-5 Lesson Agenda ..............................................................................................................................................13-7 Linux Distribution Support ..............................................................................................................................13-8 Lesson Agenda ..............................................................................................................................................13-9 Planning the lx Branded Zone Configuration ..................................................................................................13-10 System and Space Requirements ..................................................................................................................13-11 Branded Zone Network Address ....................................................................................................................13-13 Managing the lx Branded Zone Resources ....................................................................................................13-14 Determining the Zone Name and Zonepath ...................................................................................................13-15 Lesson Agenda ..............................................................................................................................................13-16 Configuring the lx Branded Zone Configuration .............................................................................................13-17 Configuring the lx Branded Zone Walk-Through ...........................................................................................13-18 Displaying the Configuration of the Branded Zone .........................................................................................13-25 Lesson Agenda ..............................................................................................................................................13-27 Installing the lx Branded Zone ........................................................................................................................13-28 Obtaining the Linux Archives .........................................................................................................................13-29 Installing a Linux Zone by Using zoneadm .....................................................................................................13-31 lx Branded Zone Software Installation Walk-Through ....................................................................................13-33 Lesson Agenda ..............................................................................................................................................13-35 Booting the lx Branded Zone ..........................................................................................................................13-36 Lesson Agenda ..............................................................................................................................................13-39 Enable Networking in an lx Branded Zone .....................................................................................................13-40 Lesson Agenda ..............................................................................................................................................13-41 Administering Applications in lx Branded Zones ...........................................................................................13-42 Quiz ................................................................................................................................................................13-44 Summary ........................................................................................................................................................13-47

  • Oracle Solaris Containers Administration (SG)Table of Contents