Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog
8 janvier 2013 2 08 /01 /janvier /2013 20:54

 

Comment réduire efficacement les coûts d'une infrastructure de serveurs sous Solaris 10 ? En les consolidant !! Cela va de soi, la forte utilisation des zones en est un très bonne exemple. Oui mais... Pourquoi ne pas utiliser les nouvelles possibilités qui s'offrent à nous : Un serveur sous Solaris 11 et des brandZ Solaris 10.

 

Je vous présente deux exemples rapides de migration d'environnements Solaris 10 physique (P2V) et Solaris 10 zone (V2V) sur un serveur Solaris 11.

 

Quelques prérequis sont obligatoires sur le serveur source :

  •           Patch kernel 142909-17 (SPARC) ou 142910-17 (x86 et x64)
  •           Patch 119254-75, 119534-24 et 140914-02 (SPARC)
  •           Patch 119255-75, 119535-24 et 140915-02 (x86/x64)
  •           Systèmes de fichiers racine en ZFS uniquement pour la migration P2V

 

 

Exemple de Migration P2V

 

Les actions ci-dessous sont à réaliser sur le serveur source Solaris 10

 

J'utilise l'utilitaire (disponible via MOS) SUNWzonep2vchk pour valider rapidement ma migration.

 

# ls
SUNWzonep2vchk.zip

 

# unzip SUNWzonep2vchk.zip
Archive:  SUNWzonep2vchk.zip
   creating: SUNWzonep2vchk/
[...]

 

# pkgadd -d . SUNWzonep2vchk   
[...]

/opt/SUNWzonep2vchk/bin/zonep2vchk
/opt/SUNWzonep2vchk/man/man1/zonep2vchk.1m

[...]
Installation of <SUNWzonep2vchk> was successful.

 

 

Quelques checks rapides pour paramétrer au mieux mon futur environnement.    

 

# cd /opt/SUNWzonep2vchk/bin
# ./zonep2vchk -T S11

 

-- Executing Version: 1.0.5-11-16135 

 

  - Source System: myserver10

 

      Solaris Version: Solaris 10 8/07 s10s_u4wos_12b SPARC
      Solaris Kernel:  5.10 Generic_147440-23
      Platform:        sun4u SUNW,Sun-Fire-V210

 

   - Target System:

 

      Solaris_Version: Solaris 11
      Zone Brand:      solaris10 (Solaris 10 Container)
      IP type:         exclusive 

 

-- Executing basic checks 

 

  - The following /etc/system tunables exist.  These tunables will not
    function inside a zone.  The /etc/system tunable may be transfered to
    the target global zone, but it will affect the entire system,
    including all zones and the global zone.  If there is an
    alternate tunable that can be configured from within the zone,
    this tunable is described: 

 

        set noexec_user_stack=1
            zonep2vchk has no information on tunable                    

 

        set noexec_user_stack_log=1
            zonep2vchk has no information on tunable                    

 

        set tod_validate_enable=0
            zonep2vchk has no information on tunable                    

 

        set c2audit:audit_load = 1
            Replacement tunable exists on target host:
                utility auditconfig(1m) 

 

        set rlim_fd_cur = 1024
            Alternate tunable exists inside a non-global zone:
                rctl process.max-file-descriptor 

 

  - The following boot environments will not be usable.  Only the active
    boot environment will be usable in the target non-global zone: 

 

        newBE

 

  - The following ntp client service is enabled.  This service updates
    the system clock.  Since all zones share the same system clock, this
    service is disabled automatically during p2v.  If it is desired
    that the zone update the system clock on the target host, the
    zone will need the privilege "sys_time", and the service will
    need to be enabled inside the zone after p2v.  See the description
    of the "limitpriv" property in zonecfg(1m): 

 

        svc:/network/ntp:default

 

   Basic checks compete, 7 issue(s) detected

 

-- Total issue(s) detected: 7

 

 

Pour obtenir facilement le fichier template nécessaire à la création de la brandZ Solaris 10, j'utilise encore l'utilitaire zonep2vcheck.

 

# ./zonep2vchk -T S11 -c
create -b
set zonepath=/zones/myserver10
set brand=solaris10
add attr
        set name="zonep2vchk-info"
        set type=string
        set value="p2v of host myserver10"
        end
set ip-type=exclusive
# Uncomment the following to retain original host hostid:
# set hostid=845b7f42
# Max procs and lwps based on max_uproc/v_proc
set max-processes=20000
set max-lwps=40000
add attr
        set name=num-cpus
        set type=string
        set value="original system had 2 cpus"
        end

# Only one of dedicated or capped cpu can be used.
# Uncomment the following to use cpu caps:
# add capped-cpu
#       set ncpus=2.0
#       end

# Uncomment the following to use dedicated cpu:
# add dedicated-cpu
#       set ncpus=2
#       end

# Uncomment the following to use memory caps.
# Values based on physical memory plus swap devices:
# add capped-memory
#       set physical=4096M
#       set swap=20099M
#       end

# Original bge1 interface configuration:
#    Statically defined 10.30.228.92 (myzone10)
#    Factory assigned MAC address 0:14:4f:5b:7f:42

add anet
        set linkname=bge1
        set lower-link=change-me
        # Uncomment the following to retain original link configuration:
        # set mac-address=0:14:4f:5b:7f:42
        end
exit 

 

 

Pour obtenir facilement une image cohérente, je reboote en single le serveur source. J'utilise ici un serveur nfs pour héberger temporairement mon image flar.

 

# init 0
Creating boot_archive for /a
updating /a/platform/sun4u/boot_archive
# syncing file systems... done
Program terminated

 

{0} ok boot -s

 

Boot device: /pci@1c,600000/scsi@2/disk@1,0:a  File and args: -s
SunOS Release 5.10 Version Generic_147440-23 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
Hardware watchdog enabled
Booting to milestone "milestone/single-user:default".
Hostname: myserver10
Requesting System Maintenance Mode
SINGLE USER MODE

 

Root password for system maintenance (control-d to bypass):
single-user privilege assigned to /dev/console.
Entering System Maintenance Mode

 

Jan  2 18:16:22 su: 'su root' succeeded for root on /dev/console
Sun Microsystems Inc.      SunOS 5.10   Generic      January 2005

 

# mount –F nfs nfsserver:/myshare /mnt
# zfs mount -a
# flarcreate -n myserver10 -c /mnt/myserver10.flar

Full Flash
Checking integrity...
Integrity OK.
Running precreation scripts...
Precreation scripts done.
Determining the size of the archive...
The archive will be approximately 9.05GB.
Creating the archive...
Archive creation complete.
Running postcreation scripts...
Postcreation scripts done.

 

Running pre-exit scripts...
Pre-exit scripts done.   

 

 

J'utilise plusieurs autres datasets ZFS attachés directement au dataset rpool. Du coup lors de la création du flar, ces datasets ne sont pas pris en compte. J'utilise donc des petits snapshots ZFS pour pouvoir recopier mes données sur la future brandZ Solaris 10.

 

# zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
rpool                 50.7G  16.2G  33.5K  /rpool
rpool/ROOT            24.4G  16.2G    23K  legacy
rpool/ROOT/zfsBE      24.4G  16.2G  19.9G  /
rpool/ROOT/zfsBE/var  4.54G  16.2G  4.54G  /var
rpool/apps            8.05G  16.2G  8.05G  /apps
rpool/dump            2.00G  16.2G  2.00G  -
rpool/export          1.39G   629M  1.39G  /export
rpool/swap            14.9G  16.2G  14.9G  -

 

# zfs snapshot rpool/export@now
# zfs snapshot rpool/apps@now
# zfs send rpool/export@now > /mnt/export
# zfs send rpool/apps@now > /mnt/apps    

 

 

Les actions ci-dessous sont à réaliser sur le serveur destination Solaris 11

 

La première étape est de créer la brandZ Solaris 10 sur le serveur Solaris 11.

 

# zpool create myserver10 cXtYdZ
# zfs set mountpoint=/zones/myserver10
# chmod 700 /zones/myserver10

 

# cat /var/tmp/myserver10
create -b
set zonepath=/zones/myserver10
set brand=solaris10
set ip-type=shared
add net
       set address=192.xx.xx.xx/xx
       set physical=ipmp0
end
set hostid=845b7f42
exit

 

 

Comme vous pouvez le constater, j'ai réduit consiérablement le fichier template pour la création de la zone. J'ai apporté notamment la modification suivante : ip-type=shared. En fait j'ai configuré un groupe ipmp sur mon serveur Solaris 11, il m'est alors impossible de créer des vnic via l'interface ipmp. Du coup je préfére utiliser le mode shared.

 

# zonecfg –z myserver10 –f /var/tmp/myserver10
# zoneadm list –cv
  ID NAME           STATUS     PATH                 BRAND    IP   
   0 global         running    /                    solaris  shared
   - myserver10     configured /zones/myserver10    solaris10 shared    

 

 

Je lance maintenant le chargement des données dans ma brandZ Solaris 10.

 

# mount –F nfs nfsserver:/myshare /mnt
# zoneadm -z myserver10 install -p -a /tools/myserver10.flar

Progress being logged to /var/log/zones/zoneadm.20130103T135726Z.myserver10.install
    Installing: This may take several minutes... 

 

Postprocessing: This may take a while...
   Postprocess: Updating the image to run within a zone

 

         Result: Installation completed successfully.


Log saved in non-global zone as /zones/myzone10/root/var/log/zones/zoneadm.20130103T135726Z.myserver10.install

 

# zoneadm list -cv
  ID NAME           STATUS     PATH                 BRAND    IP   
   0 global         running    /                    solaris  shared
   - myserver10     installed  /zones/myserver10    solaris10 shared

 

 

L'installation s'est correctement déroulée. Reste encore quelques modifications à faire pour finaliser complétement la migration P2V. Il nous manque les données contenues dans les différents snapshots.

 

# zfs list -r myserver10
NAME                              USED   AVAIL  REFER  MOUNTPOINT
myserver10                        24.5G  42.0G    33K  /zones/myserver10
myserver10/rpool                  24.5G  42.0G    31K  /rpool
myserver10/rpool/ROOT             24.5G  42.0G    31K  legacy
myserver10/rpool/ROOT/zbe-0       24.5G  42.0G  19.6G  /zones/myserver10/root
myserver10/rpool/ROOT/zbe-0/var   4.55G  42.0G  4.54G  /zones/myserver10/root/var

 

# zfs receive myserver10/rpool/ROOT/zbe-0/apps < /mnt/apps
# zfs receive myserver10/rpool/ROOT/zbe-0/export < /mnt/export

 

# zfs list -r myserver10
NAME                                USED   AVAIL  REFER  MOUNTPOINT
myserver10                          33.9G  32.5G    33K  /zones/myserver10
myserver10/rpool                    33.9G  32.5G    31K  /rpool
myserver10/rpool/ROOT               33.9G  32.5G    31K  legacy
myserver10/rpool/ROOT/zbe-0         33.9G  32.5G  19.6G  /zones/myserver10/root
myserver10/rpool/ROOT/zbe-0/apps    8.05G  32.5G  8.05G  /apps
myserver10/rpool/ROOT/zbe-0/export  1.39G  32.5G  1.39G  /export
myserver10/rpool/ROOT/zbe-0/var     4.55G  32.5G  4.54G  /zones/myserver10/root/var

 

 

Et voilà notre migration P2V est terminée. N'oublier pas de modifier les quelques paramètres obtenus lors de votre check : comme par exemple désactiver le ntp, le nombre de file descriptor, etc.

 

# zoneadm -z myserver10 boot

 

 

 

Migration V2V

 

Les actions ci-dessous sont à réaliser sur le serveur source Solaris 10 hébergeant la zone à migrer

 

Il faut stopper la zone Solaris 10 et l'activer dans un mode particulier pour créer l'archive. J'utilise toujours un serveur nfs pour stocker mon archive flar.

 

# mount -F nfs nfsserver:/myshare /mnt

 

# zoneadm –z myzone10 halt
# zoneadm –z myzone10 ready
# zonecfg –z myzone10 info | grep zonepatch
zonepath: /zones/myzone10

 

# cd /zones/myzone10
# find root -print | cpio –oH crc -oP@ | gzip >/mnt/myzone10.cpio.gz

 

 

Je récupére les infos nécessaires à la création du template de la futur brandZ Solaris 10.

 

# zonecfg -z myzone10 info
zonename: myzone10
zonepath: /zones/myzone10
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
       dir: /lib
inherit-pkg-dir:
       dir: /platform
inherit-pkg-dir:
       dir: /sbin
inherit-pkg-dir:
       dir: /usr
fs:
       dir: /sources
       special: /datas/myzone10/source
       raw not specified
       type: lofs
       options: []
fs:
       dir: /appli
       special: /datas/myzone10/appli
       raw not specified
       type: lofs
       options: []
net:
       address: 192.xx.xx.xx
       physical: ce0
       defrouter not specified 

 

 

J'utilise ici deux montages lofs pour stocker les données utilisateurs de ma zone solaris 10. Il ne faut oublier de les récupérer lors de la migration.

 

# zfs list -r myzone10
NAME               USED  AVAIL  REFER  MOUNTPOINT
myzone10           105G  17.2G  10.9G  /zones/myzone10
myzone10/appli     83.6G 17.2G  83.6G  /datas/myzone10/appli
myzone10/source    10.3G 17.2G  10.3G  /datas/myzone10/source

 

# zfs snapshot myzone10/appli@now
# zfs snapshot myzone10/source@now
# zfs send myzone10/appli@now > /mnt/appli
# zfs send myzone10/source@now > /mnt/source

 

 

Les actions ci-dessous sont à réaliser sur le serveur destination Solaris 11 

 

La première étape est de créer la brandZ Solaris 10 sur le serveur Solaris 11.

 

# zpool create myzone10 cXtYdZ
# zfs set mountpoint=/zones/myzone10
# chmod 700 /zones/myzone10

 

# cat /var/tmp/myzone10
create -b
set zonepath=/zones/myzone10
set brand=solaris10
set ip-type=shared
add net
       set address=192.xx.xx.xx/xx
       set physical=ipmp0
end
exit

 

# zonecfg –z myzone10 –f /var/tmp/myzone10
# zoneadm list –cv
  ID NAME           STATUS     PATH                 BRAND    IP   
   0 global         running    /                    solaris  shared
   - myzone10       configured /zones/myzone10      solaris10 shared    

 

 

Je lance maintenant le chargement des données dans ma brandZ Solaris 10.

 

# mount –F nfs nfsserver:/myshare /mnt 
# zoneadm -z myzone10 install -p -a /tools/myzone10.cpio.gz
Progress being logged to /var/log/zones/zoneadm.20130105T011129Z.myzone10.install
    Installing: This may take several minutes...
Postprocessing: This may take a while...
   Postprocess: Updating the image to run within a zone
   Postprocess: Migrating data
       from: myzone10/rpool/ROOT/zbe-0
         to: myzone10/rpool/export

 

   Postprocess: A backup copy of /export is stored at /export.backup.20130105T012820Z.
It can be deleted after verifying it was migrated correctly.

 

        Result: Installation completed successfully.
Log saved in non-global zone as /zones/myzone10/root/var/log/zones/zoneadm.20130105T011129Z.myzone10.install 

 

 

L'installation s'est correctement déroulée. Reste encore quelques modifications à faire pour la finaliser complétement : il nous manque notamment les données contenues dans les différents snapshots.

 

# zfs list -r myzone10
NAME                          USED   AVAIL  REFER  MOUNTPOINT
myzone10                      34.5G  40.0G    33K  /zones/myzone10
myzone10/rpool                34.5G  40.0G    31K  /rpool
myzone10/rpool/ROOT           34.5G  40.0G    31K  legacy
myzone10/rpool/ROOT/zbe-0     34.5G  40.0G  19.5G  /zones/myzone10/root
myzone10/rpool/export         34.5G  40.0G   1.0G  /zones/myzone10/root/export
myzone10/rpool/export/home    34.5G  40.0G  14.0G  /zones/myzone10/root/export/home 

 

# zfs receive myzone10/rpool/ROOT/zbe-0/appli < /mnt/appli
# zfs receive myzone10/rpool/ROOT/zbe-0/source < /mnt/source

 

# zfs list -r myserver10
NAME                             USED   AVAIL  REFER  MOUNTPOINT
myzone10                         64.5G  10.0G    33K  /zones/myzone10
myzone10/rpool                   64.5G  10.0G    31K  /rpool
myzone10/rpool/ROOT              64.5G  10.0G    31K  legacy
myzone10/rpool/ROOT/zbe-0        64.5G  10.0G  19.5G  /zones/myzone10/root
myzone10/rpool/ROOT/zbe-0/appli  64.5G  10.0G  20.0G  /appli
myzone10/rpool/ROOT/zbe-0/source 64.5G  10.0G  10.0G  /source
myzone10/rpool/export            64.5G  10.0G   1.0G  /zones/myzone10/root/export
myzone10/rpool/export/home       64.5G  10.0G  14.0G  /zones/myzone10/root/export/home

 

 

Et voilà notre migration V2V est terminée. Reste plus que l'activation de la brandZ Solaris 10.

 

# zoneadm -z myzone10 boot

 

 

J'espère que cet article vous incitera aux migrations de vos environnements Solaris 10 dans des brandZ Solaris 10. Sans parler des aspects de consolidation, il existe plusieurs avantages à utiliser un chassis Solaris 11 pour héberger vos zones ou brandZ. En effet vous bénéficier de tous les optimisations kernel présentent dans Solaris 11. Un vrai plus, je vous l'assure...

 

 

Pour aller plus loin :

 

Partager cet article

commentaires