Tuesday, March 8, 2011

Solaris Containers

  • How to create Zones
  • Create a root directory for zones with rwx permission for user.
    • mkdir /zones1
    • chmod 700 /zones1
  • Create a zone configuration file as under:
    • create
    • set zonepath=/zones1
    • set autoboot=true
    • Add network (exclusive IP or default shared IP):
      • Setting exclusive IP
    If you are setting up exclusive IP: (do not set address attribute for exclusive IP)
      set ip-type=exclusive
      add net
      set physical=e1000g2
      end

      Additional info about exclsive IP setup:
      http://download.oracle.com/docs/cd/E19082-01/819-6990/gicom/index.html

        • Setting default shared IP
      If you are setting default shared IPadd net
      set physical=e1000g2
      set address=<ip address of container>
      end

      • Add Raw devices
      To add raw devices to the containers configuration

      add device
      set match=/dev/rdsk/c6t20030003BACCC902*
      end
      add device
      set match=/dev/rdsk/c6t20030003BACCC8FA*
      end

      On Solaris 11:
      zonecfg:rac4Zone> add device
      zonecfg:rac4Zone:device> set match=/dev/rdsk/c1t0d0s0
      zonecfg:rac4Zone:device> set allow-partition=true
      zonecfg:rac4Zone:device> set allow-raw-io=true
      zonecfg:rac4Zone:device> end


      • Add FS
      To add fs refer to
      • http://docs.oracle.com/cd/E23824_01/html/821-1460/z.admin.task-11.html

      To mount a global directory as lofs to container

      zonecfg -z zones1
      add fs
      set dir=/oracle11gR2
      set special=/oracle11gR2
      set type=lofs
      set options=nodevices
      end

      • Set shared memory :
        global# zonecfg -z myzone
        zonecfg:myzone> set max-shm-memory=50G
        • Add dedicated CPU 
          Adding dedicated -cpu is a simpler form of creating a pool and attaching it to the container. Add dedicated-cpu command creates a temporary pool and assigns it to the container

          add dedicated-cpu
          set ncpus=32
          end

          • Remove dedicated CPU

          To remove the dedicated-cpu, issue the following command
          remove dedicated-cpu

          • Add resource pool
            • set pool=rac1pool
          • Remove pool
            • On Solaris 11
              •  clear pool
            • On Solaris 10 Update 3 and below
              • set pool=""

          • Steps to create and configure a container

          1. Invoke zonecfg command to configure the zone
            1. zonecfg -z zones1 -f test.cfg
          2.  Install the configured zone
            1. zoneadm -z zones1 install
          3.  Use the list subcommand of zoneadm to list the installed zones and verify their status. The status of the zone is "Installed"
            1. zoneadm list -iv
          4. Boot the zone
            1. zoneadm -z zones1 boot
          5.  Verify that status of the zone is "running"
            1. zoneadm list -v
          6.  Log in to Zone console to perform the internal zone configuration
            1. zlogin -C zone1
          7.  Optionally edit /etc/sysidcfg file to perfom the inital zone configuration
            1. Go to /etc/ directory of the local zone
              1. cd /export/home/zones/root/etc
            2. Create sysidcfg file in this directory

          • Steps to delete a container
            • zoneadm -z myzone halt
            • zoneadm -z myzone uninstall
            • zonecfg -z myzone delete -F

          • List a container and info about it

          • List all zones from global zone
            • zoneadm list -v
          • Login to local zone from global zone:
            • zlogin <zonename>
          • In the zone , issue zonename to print its name
          • Get info about the zone
            • zonecfg -z myzone info
          • To verify if /dev/rdsk/c6 is accessible in local container
            • ls /my_zone/root/dev/rdsk/.....

          • Initial zone configuration

          • Hostname and ip address: 
            • The hostname can be resolved through DNS or NIS
              • Verify if it is resolved through DNS
                • nslookup isve-111-212 
              • Verify if it resolves through NIS
                • ypcat hosts | grep isve-111-212
              • If hostname is resolved through dns /etc/nsswitch.conf should have the following 
                • ipnodes:        files dns
              • else it should be as under:
                • ipnodes:        files nis
          • netmask: /etc/inet/netmasks
          • Router IP : /etc/defaultrouter
          • Dominname : exec domainname command
          • Name service : Check /etc/nsswitch.conf to confirm it is NIS
          • Name server: output of ypwhich command
          • Ip addres of name server : ping -s <nameserver>
          • DNS name server ip address from /etc/resolv.conf

          • Modify exisiting zone

          • Change net settings {removing address or physical attribute of the net will delete both network parameters
            • zonecfg -z zone1 info
            • remove net address=<value> {or remove net physical=<value>}
            • add net
            •    set physical
            •     set address
            • end
          • Some changes need the zone to be rebooted to take effect
            • zoneadm -z zone1 reboot


          If you want to restart initial zone configuration
          • zlogin -S zonename /usr/sbin/sys-unconfig
          • or login to zones (zlogin zonename) , issue sys-unconfig and reboot
          • On Solaris 11, you can configure using the following commnd
            • /usr/sbin/sysconfig unconfigure
          How to specify netmask in containers:
          Why is zone booting command failing as under:

           zoneadm -z zones2 boot
          zoneadm: zone 'zones2': These file-systems are mounted on subdirectories of /zones2/root:
          zoneadm: zone 'zones2':   /zones2/root/var/sadm/install/.door
          zoneadm: zone 'zones2': call to zoneadmd failed
          You do not have the right zones patch installed..... Wait for 10 minutes and issue the command and it will work if you do not want  to install the updated patches


          If you see the following error, login in to the console to view the SCI ....


          root@unknown:~# sysconfig configure
          This program will re-configure your system.
          Do you want to continue (y/[n])? y
          Interactive configuration requested.
          System Configuration Interactive (SCI) tool will be launched on console.
          Since you are currently not logged on console,
          you may not be able to navigate SCI tool.
          Would you like to proceed with re-configuration (y/[n])? y

          No comments:

          Post a Comment