ehxz 发表于 2007-2-7 09:46:45

Solaris10的革命性功能之一 Solaris 10 N1 Grid Container

作者:Solaris10的革命性功能之一 Solaris 10 N1 Grid Container<br />最近刚刚发布的 Solaris 10 操作系统,号称Sun公司的真正意义上的里程碑式操作系统,带 <br />来了诸多突破性技术,如 Solaris Containers、动态跟踪 (DTrace)、预测性自我修复和ZFS动态 <br />文件系统等。 <br />比较感兴趣的是Solaris Container,也就是N1 Grid Container--网格?!现在好像比较 <br />流行这个,Oracle 10g 也是Grid的意思。。。。 <br />这个Solaris Container号称可以让每个 Solaris 10 创建多达 8192 个的安全、无故障软件 <br />分区,相对于SunFire 3800/4800/6800/4900/6900/12K/15K/25K的硬件分区好像更夸张一点,感觉 <br />有点像PC上的VMware。IBM最近的P5系列也是,好像现在各大厂商都热衷于这个,叫什么server <br />virtualization <br /><br />开始上手: <br /><br />root@b1000:/# uname -a <br />SunOS b1000 5&#46;10 s10_63 sun4u sparc SUNW,Sun-Blade-1000 <br /><br />刚装完的系统,只有一个global zone <br />root@b1000:/# zoneadm list -vc <br />ID NAME STATUS PATH <br />0 global running / <br /><br />首先创建一个目录,用来存放新的soft zone的文件。 <br />root@b1000:/# mkdir -p /zone/zone1 <br />root@b1000:/# ls -ld /zone/zone1 <br />drwxr-xr-x 2 root other 512 Dec 4 14:42 /zone/zone1 <br /><br />创建一个zone1的软分区: <br />root@b1000:/# zonecfg -z zone1 <br />zone1: No such zone configured <br />Use 'create' to begin configuring a new zone&#46; <br />zonecfg:zone1> create <br />zonecfg:zone1> set zonepath=/zone/zone1 <br />zonecfg:zone1> set autoboot=true <br />zonecfg:zone1> add net <br />zonecfg:zone1:net> set address=192&#46;168&#46;0&#46;101 <br />zonecfg:zone1:net> set physical=eri0 <br />zonecfg:zone1:net> end <br />zonecfg:zone1> info <br />zonepath: /zone/zone1 <br />autoboot: true <br />pool: <br />inherit-pkg-dir: <br />dir: /lib <br />inherit-pkg-dir: <br />dir: /platform <br />inherit-pkg-dir: <br />dir: /sbin <br />inherit-pkg-dir: <br />dir: /usr <br />net: <br />address: 192&#46;168&#46;0&#46;101 <br />physical: eri0 <br />zonecfg:zone1> verify <br />zonecfg:zone1> commit <br />zonecfg:zone1> ^D <br />root@b1000:/# <br /><br />创建完成,查看zone1的信息: <br />root@b1000:/# zonecfg -z zone1 info <br />zonepath: /zone/zone1 <br />autoboot: true <br />pool: <br />inherit-pkg-dir: <br />dir: /lib <br />inherit-pkg-dir: <br />dir: /platform <br />inherit-pkg-dir: <br />dir: /sbin <br />inherit-pkg-dir: <br />dir: /usr <br />net: <br />address: 192&#46;168&#46;0&#46;101 <br />physical: eri0 <br />root@b1000:/# zoneadm list -vc <br />ID NAME STATUS PATH <br />0 global running / <br />- zone1 configured /zone/zone1 <br /><br />安装操作系统文件刚刚配置完成的zone1: <br />root@b1000:/# zoneadm -z zone1 install <br />/zone/zone1 must not be group readable&#46; <br />/zone/zone1 must not be group executable&#46; <br />/zone/zone1 must not be world readable&#46; <br />/zone/zone1 must not be world executable&#46; <br />could not verify zonepath /zone/zone1 because of the above errors&#46; <br />zoneadm: zone zone1 failed to verify <br />root@b1000:/# ls -ld /zone/zone1 <br />drwxr-xr-x 2 root other 512 Dec 4 14:42 /zone/zone1 <br />root@b1000:/# chmod 0700 /zone/zone1 <br />root@b1000:/# ls -ld /zone/zone1 <br />drwx------ 2 root other 512 Dec 4 14:42 /zone/zone1 <br />root@b1000:/# zoneadm -z zone1 install <br />Preparing to install zone &#46; <br />Copyingfiles to the zone&#46; <br />Initializing zone product registry&#46; <br />Determining zone package initialization order&#46; <br />Preparing to initializepackages on the zone&#46; <br />Initializing packageof : percent complete: 5% <br />&#46;&#46;&#46;&#46;&#46;&#46; <br />&#46;&#46;&#46;&#46;&#46; <br />&#46;&#46;&#46; <br />这里大约需要二十分钟左右 <br />Initializedpackages on zone&#46; <br />Zoneis initialized&#46; <br />Installation of these packages generated errors:<br />Installation of these packages generated warnings:<br />The filecontains a log of the zone installation&#46; <br />root@b1000:/# zoneadm list -vc <br />ID NAME STATUS PATH <br />0 global running / <br />- zone1 installed /zone/zone1 <br /><br />启动这个zone: <br />root@b1000:/# zoneadm -z zone1 boot <br /><br />进入zone1的Console: <br />root@b1000:/# zlogin -C zone1 <br /> <br /> <br /><br />SunOS Release 5&#46;10 Version s10_63 64-bit <br />Copyright 1983-2004 Sun Microsystems, Inc&#46; All rights reserved&#46; <br />Use is subject to license terms&#46; <br />Hostname: zone1 <br />The system is coming up&#46; Please wait&#46; <br /><br /><br /><br /><br />Select a Language <br /><br />0&#46; English <br />1&#46; Simplified Chinese <br />2&#46; Traditional Chinese <br /><br />Please make a choice (0 - 2), or press h or ? for help: <br /><br />接下来的和平时安装系统一样,设置主机名,时区,域名解析方式等等, <br /><br /><br />System identification is completed&#46; <br /><br />rebooting system due to change(s) in /etc/default/init <br /><br /><br /> <br /><br /><br />SunOS Release 5&#46;10 Version s10_63 64-bit <br />Copyright 1983-2004 Sun Microsystems, Inc&#46; All rights reserved&#46; <br />Use is subject to license terms&#46; <br />Hostname: MyWeb <br />The system is coming up&#46; Please wait&#46; <br />starting rpc services: rpcbind done&#46; <br />syslog service starting&#46; <br />Dec 4 15:18:42 MyWeb sendmail: My unqualified host name (MyWeb) unknown; sleeping for retry <br />Dec 4 15:19:42 MyWeb sendmail: unable to qualify my own domain name (MyWeb) -- using short name <br />WARNING: local host name (MyWeb) is not qualified; see cf/README: WHO AM I? <br />/etc/mail/aliases: 12 aliases, longest 10 bytes, 138 bytes total <br />Dec 4 15:19:42 MyWeb sendmail: My unqualified host name (MyWeb) unknown; sleeping for retry <br />Dec 4 15:19:42 MyWeb sendmail: My unqualified host name (MyWeb) unknown; sleeping for retry <br /><br />STSF Font Server Daemon&#46; <br /><br />Standard Type Services Framework 0&#46;11&#46;1 <br />Copyright (c) 2001-2004 Sun Microsystems, Inc&#46; All Rights Reserved&#46; <br />STSF is Open Source Software&#46; http://stsf&#46;freedesktop&#46;org <br /><br />Creating new rsa public/private host key pair <br />Creating new dsa public/private host key pair <br />The system is ready&#46; <br /><br />哈哈,完成啦。。。。。。。。 <br />虚拟的主机MyWeb启动成功,登陆。。。。。 <br /><br /><br />MyWeb console login: root <br />Password: <br />Dec 4 15:21:53 MyWeb login: ROOT LOGIN /dev/console <br />Sun Microsystems Inc&#46; SunOS 5&#46;10 s10_63 May 2004 <br /># df -k <br />Filesystem kbytes used avail capacity Mounted on <br />/ 10080200 2702923 7276475 28% / <br />/dev 10080200 2702923 7276475 28% /dev <br />/lib 10080200 2702923 7276475 28% /lib <br />/platform 10080200 2702923 7276475 28% /platform <br />/sbin 10080200 2702923 7276475 28% /sbin <br />/usr 10080200 2702923 7276475 28% /usr <br />proc 0 0 0 0% /proc <br />mnttab 0 0 0 0% /etc/mnttab <br />fd 0 0 0 0% /dev/fd <br />swap 2737048 48 2737000 1% /var/run <br />swap 2737000 0 2737000 0% /tmp <br /># ifconfig -a <br />lo0:1: flags=1000849 mtu 8232 index 1 <br />inet 127&#46;0&#46;0&#46;1 netmask ff000000 <br />eri0:1: flags=1000843 mtu 1500 index 2 <br />inet 192&#46;168&#46;0&#46;101 netmask ffffff00 broadcast 192&#46;168&#46;0&#46;255 <br /># ps -ef <br />UID PID PPID C STIME TTY TIME CMD <br />root 9054 8810 0 15:20:20 ? 0:00 /usr/lib/saf/sac -t 300 <br />root 8906 8802 0 15:18:39 ? 0:00 /usr/sbin/nscd <br />root 8802 8802 0 15:18:27 ? 0:00 zsched <br />root 9055 8810 0 15:20:20 console 0:00 -sh <br />root 8810 8802 0 15:18:38 ? 0:00 init <br />root 8899 8802 0 15:18:39 ? 0:00 /usr/lib/autofs/automountd <br />daemon 8833 8802 0 15:18:39 ? 0:00 /usr/lib/crypto/kcfd <br />root 8895 8802 0 15:18:39 ? 0:00 /usr/sbin/syslogd <br />daemon 8858 8802 0 15:18:39 ? 0:00 /usr/sbin/rpcbind <br />root 8904 8802 0 15:18:39 ? 0:00 /usr/sbin/cron <br />root 8911 8802 0 15:18:40 ? 0:00 /usr/sbin/inetd -s <br />root 8967 8963 0 15:19:43 ? 0:00 /usr/sadm/lib/smc/bin/smcboot <br />root 8964 8963 0 15:19:43 ? 0:00 /usr/sadm/lib/smc/bin/smcboot <br />root 8949 8802 0 15:19:43 ? 0:00 /usr/lib/utmpd <br />root 8965 8802 0 15:19:43 ? 0:00 /usr/lib/im/htt -port 9010 -s <br />yslog -message_locale C <br />root 8963 8802 0 15:19:43 ? 0:00 /usr/sadm/lib/smc/bin/smcboot <br />root 8966 8965 0 15:19:43 ? 0:00 htt_server -port 9010 -syslog <br />-message_locale C <br />root 9030 8802 0 15:19:45 ? 0:00 /usr/lib/dmi/snmpXdmid -s MyW <br />eb <br />root 9058 8802 0 15:20:20 ? 0:00 /usr/lib/ssh/sshd <br />root 9057 9054 0 15:20:20 ? 0:00 /usr/lib/saf/ttymon <br />daemon 8974 8802 0 15:19:44 ? 0:02 /usr/lib/ST/stfontserverd <br />root 9028 8802 0 15:19:45 ? 0:00 /usr/lib/dmi/dmispd <br />root 9059 8802 0 15:20:43 ? 0:00 /usr/lib/sendmail -bd -q15m <br />root 9022 8802 0 15:19:45 ? 0:00 /usr/lib/snmp/snmpdx -y -c /e <br />tc/snmp/conf <br />root 8999 8802 0 15:19:44 ? 0:00 /usr/dt/bin/dtlogin -daemon <br />root 9042 8802 0 15:19:46 ? 0:00 /usr/sfw/sbin/snmpd <br />smmsp 9060 8802 0 15:20:43 ? 0:00 /usr/lib/sendmail -Ac -q15m <br />root 9069 9055 0 15:22:47 console 0:00 ps -ef <br />不用的Sendmail停掉 <br /># mv /etc/rc2&#46;d/S88sendmail /etc/rc2&#46;d/s88sendmail <br /># /etc/init&#46;d/sendmail stop <br /># prtdiag -v <br />prtdiag can only be run in the global zone <br />哦,prtdiag不能在zone里用 <br /><br />prtconf有信息出来: <br /># prtconf <br />System Configuration: Sun Microsystems sun4u <br />Memory size: 1024 Megabytes <br />System Peripherals (Software Nodes): <br /><br />prtconf: devinfo facility not available <br /><br /># exit <br /><br />按 ~ 然后按 &#46; 退出zone1的Console,回到global zone,也就是真正的B1000 <br />MyWeb console login: ~&#46; <br /> <br />root@b1000:/# <br />root@b1000:/# <br />root@b1000:/# zoneadm list -vc <br />ID NAME STATUS PATH <br />0 global running / <br />1 zone1 running /zone/zone1 <br /><br /><br />root@b1000:/# telnet 192&#46;168&#46;0&#46;101 <br />Trying 192&#46;168&#46;0&#46;101&#46;&#46;&#46; <br />Connected to 192&#46;168&#46;0&#46;101&#46; <br />Escape character is '^]'&#46; <br />login: root <br />Password: <br />Not on system console <br />Connection to 192&#46;168&#46;0&#46;101 closed by foreign host&#46; <br />忘改/etc/default/login了。。。。。。。。。。。 <br /><br /><br />总结: <br />1&#46; 提高了系统的利用率,可以一个当N个使唤 <br />2&#46; 应用系统可以跑在互不干扰的动态系统域里 <br />3&#46; 完全可以把一个zone的root密码告诉别人,用来练手不错,整瘫了大不了 <br />zoneadm -z zone1 uninstall再zoneadm -z zone1 install就ok了 <br />4&#46; 应该还有许多好玩的功能待发掘。。。。 <br /><br />参考资料: <br />http://www&#46;sun&#46;com/bigadmin/content/zones/<br />
页: [1]
查看完整版本: Solaris10的革命性功能之一 Solaris 10 N1 Grid Container