如何创建和配置Solaris10 zones (ZT)
http://thegeekdiary.com/how-to-create-and-configure-solaris-10-zones/
Solaris zones enables a software partitioning of solaris 10 OS to support multiple independent, secure OS environments to run in the same OS. Each environment has separate process space, resource allocation and users. Zones is widely used in production environments as it is easy to setup and doesn’t require any special hardware like ldoms does.
Zone types
Global zone – every installed OS acts like a global zone, which is present by default. All non-global zones can only be intalled, configured and administered from global zone.
Non-global zone – They share the functioning of the kernel booted under the global zone. All the software and other resources are inherited from the global zone.
Whole Root zone (Big zone) – It gets their own writable copy of all the file systems like /opt, /usr. It takes more disk space.
Sparse root zone (Small zone) – File systems like /opt, /usr are shared from global zone as loopback file-system (you only have a read-only access to these directories in non-global zone). It takes very less disk space.
Branded zones – These are solaris 8 or solaris 9 zones on the solaris 10 global zones.
Configuring a zone with minimal settings
Let us create a new zone with a minimal resources and settings required to get it up and running. We’ll see how to add other resources like cpu, memory, file system etc later in this post.We would be creating a sparse root zone in this case. To create a whole root zone we just have to use create -b instead of just create in the configuration prompt.
global# mkdir -p /zones/zone01
global# chmod 700 /zones/zone01
global# zonecfg -z zone01
zone01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone01> create
zonecfg:zone01> set zonepath=/zones/zone01
zonecfg:zone01> set autoboot=true
zonecfg:zone01> verify
zonecfg:zone01> commit
zonecfg:zone01> exit
Install and boot the zone
Now install the zone and boot it. Upon booting we can login into the console of the zoen to configure it.
global# zoneadm -z zone01 verify
global# zoneadm -z my-zone install
global# zoneadm -z my-zone list -ivc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
- zone01 installed /zones/zone01 native shared
global# zoneadm -z my-zone boot
global# zoneadm list -v
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 my-zone running /zones/zone01 native shared
global# zlogin -C zone01
global # zlogin zone01
-C here connects you to the console of the zone. This has to be done only once to get the zone configured with hostname, timezone and other basic settings.
Resource configuration examples
Below are some most commonly used examples of resource configuration in a zone.
CPU
1. Dedicated CPU
To see the CPU information in the global zone you can use
global# psrinfo -v
global# psrinfo -vp
After you have confirmed the CPUs you want to use, you can add a fixed no of CPUs to the zone.
zonecfg:zone01> add dedicated-cpu
zonecfg:zone01:dedicated-cpu> set ncpus=1-2
zonecfg:zone01:dedicated-cpu> set importance=10 (optional, default is 1)
zonecfg:zone01:dedicated-cpu> end
Memory
Capped Memory
zonecfg:my-zone> add capped-memory
zonecfg:zone01:capped-memory> set physical=50m [max memory that can be used by this zone]
zonecfg:zone01:capped-memory> set swap=100m
zonecfg:zone01:capped-memory> set locked=30m [memory locked for use by this zone]
zonecfg:zone01:capped-memory> end
File system
a. Loopback FS
zonecfg:zone01> add fs
zonecfg:zone01:fs> set dir=/usr/local
zonecfg:zone01:fs> set special=/opt/zones/my-zone/local
zonecfg:zone01:fs> set type=lofs
zonecfg:zone01:fs> end
here /usr/local will be readable and writable in non-global zone
b. Normal file system
zonecfg:zone01> add fs
zonecfg:zone01:fs> set dir=/data01
zonecfg:my-zone01:fs> set special=/dev/dsk/c1t1d0s0
zonecfg:my-zone01:fs> set raw=/dev/rdsk/c1t1d0s0
zonecfg:my-zone01:fs> add options [logging, nosuid] (optional)
zonecfg:my-zone01:fs> end
ZFS dataset
When we delegate a dataset to a non-global zone we can do any operation on that dataset inside of the zone without requiring global zone to configure it all the time.
zonecfg:zone01> add dataset
zonecfg:zone01> set name=tank/sales
zonecfg:zone01> end
Inherit package (sparse root zone only)
Now in case of sparse root zone we can inherit some of the packages from the global zone.
zonecfg:my-zone> add inherit-pkg-dir
zonecfg:my-zone:inherit-pkg-dir> set dir=/opt/sfw
zonecfg:my-zone:inherit-pkg-dir> end
NOTE: These resources can not be modified once the zone is installed
IP
We can either give an exclusive IP using a dedicated interface to a non-global zone or use an existing interface in the global zone to share it with the non-global zone. When we configure an exclusive IP we have to configure IP address inside of the non-global zone and not during the configuration.
a. Exclusive IP
zonecfg:my-zone> set ip-type=exclusive
zonecfg:zone01> add net
zonecfg:zone01:net> set physical=hme0
NOTE: No need to specify IP here you can control everything from inside of the non-global zone
b. Shared IP
In this case zone uses a shared interface which is already plumbed and being used in the global zone.
zonecfg:zone01> add net
zonecfg:zone01:net> set address=192.168.1.2
zonecfg:zone01:net> set physical=hme0
zonecfg:zone01:net> set defrouter=10.0.0.1 [optional]
zonecfg:zone01:net> end
Device
We can also directly assign a physical device like disk to a non-global disk.
zonecfg:zone01> add device
zonecfg:zone01:device> set match=/dev/rdsk/c0t1d0
zonecfg:zone01:device> end
Comments
In case you want to add some comments like function of the non-global zone or anything else for that matter.
zonecfg:zone01> add attr
zonecfg:zone01:attr> set name=comment
zonecfg:zone01:attr> set type=string
zonecfg:zone01:attr> set value="Hello World. This is my zone"
zonecfg:zone01:attr> end
Other
Other settings like scheduling class of the CPU in the non-global zone can also be configured from the global zone.
zonecfg:zone01> set limitpriv="default,sys_time"
zonecfg:zone01> set scheduling-class=FSS
Other administrative commands
To reboot a zone : # zoneadm -z reboot
To halt a zone : # zoneadm -z zone halt
To uninstalling a zone : # zoneadm -z zone uninstall -F
To delete an uninstalled zone : # zoneadm -z zone delete -F
Get all configuration info : # zonecfg -z zone info
login into a zone in safe mode : # zlogin -S zone
prstat on all zones : # prstat -Z
prstat on a single zone : # prstat -z zone
如何创建和配置Solaris10 zones (ZT)的更多相关文章
- Servlet过滤器,Servlet过滤器创建和配置
第一:Servlet的过滤器的创建和配置,创建一个过滤器对象需要实现javax.servlet.Filter接口,同时实现Filter的3个方法. 第一方法是过滤器中的init()方法用 ...
- IIS负载均衡-Application Request Route详解第二篇:创建与配置Server Farm(转载)
IIS负载均衡-Application Request Route详解第二篇:创建与配置Server Farm 自从本系列发布之后,收到了很多的朋友的回复!非常感谢,同时很多朋友问到了一些问题,有些问 ...
- Acitivity创建与配置
•Activity的创建和配置 –Activity提供了和用户交互的可视化界面.创建一个Activity一般是继承Activity(当然也可以继承ListActivity.MapActivity等), ...
- 什么是Servlet,Servlet的作用,生命周期,如何创建、配置Servlet
什么是Servlet,作用是? servlet是一个基于java技术的WEB组件,运行在服务器端,我们利用 sevlet可以很轻松的扩展WEB服务器的功能,使它满足特定的应用需要.servlet由se ...
- ios中pch文件的创建与配置
PCH文件(Precompile Prefix Header File),也就是预编译头文件,其作用就是,方便你一次性导入在多个文件中同时用到的头文件.宏或者URL地址等(全局使用),可以有效的帮你 ...
- IDEA如何创建及配置Web项目(多图)
正文之前 在学习Java Web时,第一个遇到的问题就是如何创建或配置Web项目了,今天,就用IntelliJ IDEA 来进行Web项目配置: 创建Web项目 配置web项目 正文 创建Web项目 ...
- Spring Boot 多模块项目创建与配置 (一) (转)
Spring Boot 多模块项目创建与配置 (一) 最近在负责的是一个比较复杂项目,模块很多,代码中的二级模块就有9个,部分二级模块下面还分了多个模块.代码中的多模块是用maven管理的,每个模块都 ...
- Spring Boot 多模块项目创建与配置 (一)
最近在负责的是一个比较复杂项目,模块很多,代码中的二级模块就有9个,部分二级模块下面还分了多个模块.代码中的多模块是用maven管理的,每个模块都使用spring boot框架.之前有零零散散学过一些 ...
- hyper-v 用户无法再 创建外部配置存储 0x80070005
windows server 2008R2 刚安装的hyper-v 重启过. 修改配置文件到d:\Hyper-V目录下, hyper-V 创建 服务器遇到错误 操作失败 创建外部配置存储:一般性拒绝访 ...
随机推荐
- 【转】php 操作数组(合并,拆分,追加,查找,删除等)
1. 合并数组 array_merge()函数将数组合并到一起,返回一个联合的数组.所得到的数组以第一个输入数组参数开始,按后面数组参数出现的顺序依次迫加.其形式为: array array_merg ...
- Centos 查看版本
# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
- DelphiXE
1. http://blog.csdn.net/tp26021340/article/details/45953669 2. 3. 4. 5.
- nova cell配置
Configuration option = Default value Description [cells] call_timeout = 60 (IntOpt) Seconds to wait ...
- mysql数据简单去重
我有一个 foo 表,定义了如下几个字段:id / a / b,其中 id 是主键,a,b 原本应该具有唯一性, 但因为程序 bug 导致 a,b 内容有重复,现在我要在 a,b 上加唯一索引,请问如 ...
- Redis源码分析:serverCron - redis源码笔记
[redis源码分析]http://blog.csdn.net/column/details/redis-source.html Redis源代码重要目录 dict.c:也是很重要的两个文件,主要 ...
- Postman工具——请求与响应
两个内容: Request 请求和 Response 响应,下面就开始了. 一.Request 请求 Request 请求,我们只介绍常用的四种:GET.POST.PUT.DELETE,其他类型的就不 ...
- eclispe中使用 maven build启动maven项目和打包项目
1.右键项目2.点击run as按钮 3.点击run configurations 4.配置如下: =============================加油加油加油加油加油加油========= ...
- spring mvc中,如何在 Java 代码里,获取 国际化 内容
首先,在Spring的application.xml中定义 <bean id="messageSource" class="org.springframework. ...
- Element 'beans' cannot have character [children], because the type's content type is element-only
这个小问题快搞死我了,找了大半个小时. Element 'beans' cannot have character [children], because the type's content typ ...