- •Alexandre Borges
- •Credits
- •Introduction 74
- •Chapter 3: Networking 159
- •Free access for Packt account holders
- •Instant updates on new Packt books
- •Table of Contents Preface 1 Chapter 1: ips and Boot Environments 7
- •Introduction 8
- •Installing a package, verifying its content, and fixing the package corruption 13
- •In an inactive boot environment 64
- •Chapter 2: zfs 73
- •Chapter 4: Zones 235
- •Preface
- •Questions
- •Ips and Boot
- •In this chapter, we will cover the following topics:
- •Introduction
- •Determining the current package publisher
- •Getting ready
- •Installing a package, verifying its content, and fixing the package corruption
- •Getting ready
- •Interface
- •Getting ready
- •Listing and renaming a boot environment
- •Getting ready
- •Configuring an ips local repository
- •Getting ready
- •Configuring a secondary ips local repository
- •Getting ready
- •Publishing packages into a repository
- •Getting ready
- •Adding big applications into a repository
- •Getting ready
- •Creating your own package and publishing it
- •Getting ready
- •Managing an ips publisher on Solaris 11
- •Getting ready
- •Pinning publishers
- •Getting ready
- •Getting ready
- •Creating a mirror repository
- •Getting ready
- •Getting ready
- •Listing and creating a boot environment
- •Getting ready
- •Getting ready
- •Activating a boot environment
- •Getting ready
- •Getting ready
- •References
- •Introduction
- •Creating zfs storage pools and filesystems
- •Getting ready
- •Playing with zfs faults and properties
- •Getting ready
- •Creating a zfs snapshot and clone
- •Getting ready
- •Performing a backup in a zfs filesystem
- •Getting ready
- •Handling logs and caches
- •Getting ready
- •Managing devices in storage pools
- •Getting ready
- •Configuring spare disks
- •Getting ready
- •Handling zfs snapshots and clones
- •Getting ready
- •Playing with comstar
- •Getting ready
- •Mirroring the root pool
- •Getting ready
- •Zfs shadowing
- •Getting ready
- •Configuring zfs sharing with the smb share
- •Getting ready
- •Setting and getting other zfs properties
- •Getting ready
- •Playing with the zfs swap
- •Getting ready
- •References
- •Networking
- •Introduction
- •Playing with Reactive Network Configuration
- •Getting ready
- •Internet Protocol Multipathing
- •Getting ready
- •Setting the link aggregation
- •Getting ready
- •Configuring network bridging
- •Getting ready
- •Getting ready
- •Configuring the dhcp server
- •Getting ready
- •Configuring Integrated Load Balancer
- •Getting ready
- •IPv4 forwarding enabled enabled
- •References
- •Introduction
- •Getting ready
- •Id name status path brand ip
- •Getting ready
- •Value is basic (only the owner can modify it).
- •22:52:06 5849 Rcapd
- •Implementing a flow control
- •Getting ready
- •Getting ready
- •Installing: This may take several minutes...
- •References
- •Playing with Oracle
- •Introduction
- •Reviewing smf operations
- •Getting ready
- •Its dependencies
- •Handling manifests and profiles
- •Getting ready
- •Creating smf services
- •Getting ready
- •Getting ready
- •Troubleshooting Oracle Solaris 11 services
- •Getting ready
- •References
- •Configuring and
- •Introduction
- •Getting ready
- •References
- •Configuring and
- •Introduction
- •Configuring and using rbac
- •Getting ready
- •Playing with least privileges
- •Getting ready
- •References
- •Administering and
- •Introduction
- •Monitoring and handling process execution
- •Getting ready
- •2014 May 4 19:25:10, load average: 0.38, 0.30, 0.28 syscalls: 12648
- •Managing processes' priority on Solaris 11
- •Getting ready
- •Configuring fss and applying it to projects
- •Getting ready
- •References
- •Isbn-13: 978-0131568198
- •Configuring the
- •Introduction
- •Configuring the syslog
- •Getting ready
- •Getting ready
- •References
- •Aggregation 191
- •Identifier (fmri) 294 faults, zfs
- •(Trill) 198
- •Values, l4 (Communication)
- •Virtual ip address (vip address) 228 virtual memory size (vsz) 396 virtual network interface (vnic) 238 virtual network, zone
- •Virtual to virtual (v2v) migration 280
- •About Packt Enterprise
- •Writing for Packt
Value is basic (only the owner can modify it).
f deny: This can deny any requested resource for an amount above the limit value (500 MB). The other possibilities would be none (no action is taken even if the requested resource is above the limit) and signal, in which a signal is sent when the threshold value is exceeded.
Resource capping is a service implemented by the rcapd daemon, and this service can be enabled by the following command:
root@solaris11-1:~# svcs -a | grep rcap
disabled 21:56:20 svc:/system/rcap:default
root@solaris11-1:~# svcs -d svc:/system/rcap:default
STATE STIME FMRI
online 21:56:31 svc:/system/filesystem/minimal:default
online 21:56:33 svc:/system/resource-mgmt:default
online 21:56:35 svc:/system/manifest-import:default root@solaris11-1:~# svcadm enable svc:/system/rcap:default root@solaris11-1:~# svcs - a | grep rcap
online 22:52:06 svc:/system/rcap:default root@solaris11-1:~# svcs -p svc:/system/rcap:default STATE STIME FMRI
online 22:52:06 svc:/system/rcap:default
22:52:06 5849 Rcapd
Chapter 4
Reboot zone1 for memory capping to take effect. It would be feasible to enable the resource capping daemon without rebooting and starting the daemon now by running the following command:
root@solaris11-1:~# rcapadm -E -n
To monitor the action of the rcap daemon (rcapd), execute the following commands:
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
root@solaris11-1:~# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
-
1
zone2
running
/myzones/zone2
solaris
excl
3
zone1
running
/myzones/zone1
solaris
excl
root@solaris11-1:~# rcapstat -z
id
zone
nproc vm
rss
cap
at
avgat
pg
avgpg
3
zone1
- 26M
38M
1024M
0K
0K
0K
0K
3
zone1
- 31M
44M
1024M
0K
0K
0K
0K
3
zone1
- 31M
44M
1024M
0K
0K
0K
0K
The used physical memory (RSS) is below the memory capping limit (1024 MB). If the physical memory is increased, its limit is 1024 MB. Nice!
To make this example more attractive, some changes can be made. Let's remove the first_pool resource pool (and any other existing pool) from zone1. Additionally, the first_pool pool will be deleted by the pooladm -x command. Obviously, the new pool configuration must be saved by the pooladm -s command. The following is the sequence:
root@solaris11-1:~# zonecfg -z zone1 clear pool root@solaris11-1:~# zoneadm -z zone1 shutdown -r root@solaris11-1:~# pooladm -x
root@solaris11-1:~# pooladm -s root@solaris11-1:~# pooladm system default
string system.comment int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load
pool pool_default
int pool.sys_id 0
Zones
boolean pool.active true boolean pool.default true int pool.importance 1 string pool.comment
pset pset_default
pset pset_default
int pset.sys_id -1 boolean pset.default true uint pset.min 1
uint pset.max 65536
string pset.units population uint pset.load 15511
uint pset.size 4 string pset.comment
cpu
int cpu.sys_id 1 string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 3 string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 0 string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 2 string cpu.comment
string cpu.status on-line
Chapter 4
Everything has returned to the default status, and from this point, zone1 doesn't have a special associated pool. This permits us to focus on FSS from now on.
The following command checks what the current default kernel scheduling class is:
root@solaris11-1:~# dispadmin -d
dispadmin: Default scheduling class is not set
There is no default scheduling class. If we want to use FSS, then it would be appropriate to configure it on the global zone because this setting will be inherited by all non-global zones. To configure the FSS as explained, execute the following command:
root@solaris11-1:~# dispadmin -d FSS
root@solaris11-1:~# dispadmin -d
FSS (Fair Share)
This setup only takes effect after a system is rebooted. After the system has been reinitiated, all processes will be classified as FSS. Nonetheless, to enforce it now without a reboot, execute the following command:
root@solaris11-1:~# priocntl -s -c FSS
Unfortunately, all current processes are still running under other scheduling classes and only new processes will take the FSS setting. This can be verified by running the following command:
root@solaris11-1:~# ps -efcZ | more
-
ZONE
UID
PID
PPID
CLS
PRI
STIME
TTY
TIME
CMD
global
root
0
0
SYS
96
00:04:41
?
0:01
sched
global
root
5
0
SDC
99
00:04:38
?
0:07
zpool-rpool
global
root
6
0
SDC
99
00:04:42
?
0:01
kmem_task
global
root
1
0
TS
59
00:04:42
?
0:00
/usr/sbin/init
global
root
2
0
SYS
98
00:04:42
?
0:00
pageout
global
root
3
0
SYS
60
00:04:42
?
0:00
fsflush
global
root
7
0
SYS
60
00:04:42
?
0:00
intrd
global
root
8
0
SYS
60
00:04:42
?
0:00
vmtasks
global
root
115
1
TS
59
00:05:09
?
0:00
/usr/lib/pfexecd
global svc.startd
root
11
1
TS
59
00:04:48
?
0:13
/lib/svc/bin/
global root
13
1
TS
59
00:04:48
?
0:33
/lib/svc/bin/
svc.configd
global
root
911
1
TS
59
02:05:55
?
0:00
(truncated output)
Zones
Again, it's unnecessary to wait for the next reboot. Therefore, all processes can be moved from their current scheduling classes to FSS by executing the following commands:
root@solaris11-1:~# priocntl -s -c FSS -i all
root@solaris11-1:~# ps -efcZ | more
-
ZONE
UID
PID
PPID
CLS
PRI
STIME
TTY
TIME
CMD
global
root
0
0
SYS
96
00:04:41
?
0:01
sched
global
root
5
0
SDC
99
00:04:38
?
0:12
zpool-rpool
global
root
6
0
SDC
99
00:04:42
?
0:02
kmem_task
global
root
1
0
FSS
29
00:04:42
?
0:00
/usr/sbin/init
global
root
2
0
SYS
98
00:04:42
?
0:00
pageout
global
root
3
0
SYS
60
00:04:42
?
0:01
fsflush
global
root
7
0
SYS
60
00:04:42
?
0:00
intrd
global
root
8
0
SYS
60
00:04:42
?
0:00
vmtasks
global pfexecd
root
115
1
FSS
29
00:05:09
?
0:00
/usr/lib/
global svc.startd
root
11
1
FSS
29
00:04:48
?
0:13
/lib/svc/bin/
global svc.configd
root
13
1
FSS
29
00:04:48
?
0:33
/lib/svc/bin/
(truncated
output)
When FSS is set up as the default scheduling class in the global zone, all non-global zones automatically take this configuration. To verify this, run the following command:
root@solaris11-1:~# zlogin zone1
[Connected to zone 'zone1' pts/4]
Oracle Corporation SunOS 5.11 11.1 September 2012 root@zone1:~# ps -efcZ | more
ZONE UID PID PPID CLS PRI STIME TTY TIME CMD
zone1 root 3944 2454 FSS 29 02:06:47 ? 0:00 /usr/sbin/ init
zone1 root 4284 2454 FSS 29 02:06:58 ? 0:06 /lib/svc/ bin/svc.startd
-
zone1
root
2454
2454
SYS
60
02:06:29
?
0:00
zsched
zone1
root
5479
2454
FSS
59
02:48:52
pts/4
0:00
/usr/bin/
login -z global
-f root
zone1 root bin/svc.configd
4287
2454
FSS
29
02:07:00
?
0:21
/lib/svc/
zone1 netcfg netcfgd
4448
2454
FSS
29
02:07:27
?
0:00
/lib/inet/
zone1 root
4922
2454
FSS
29
02:08:21
?
0:00
(truncated output)
Chapter 4
We can realize that all main processes from zone1 are under the FSS class. Anyway, it is recommended that the FSS class be explicitly configured in the non-global settings in order to prevent possible mistakes in the future. Therefore, execute the following command:
root@solaris11-1:~# zonecfg -z zone1 zonecfg:zone1> set scheduling-class=FSS zonecfg:zone1> verify
zonecfg:zone1> commit zonecfg:zone1> exit root@solaris11-1:~#
root@solaris11-1:~# zonecfg -z zone2 zonecfg:zone2> set scheduling-class=FSS zonecfg:zone2> verify
zonecfg:zone2> commit zonecfg:zone2> exit root@solaris11-1:~#
Finally, it is the right moment to use the FSS class to configure some shares for each zone (zone1 and zone2). This way, it is possible to share an amount (70 percent) from the CPU processing for zone1 and the other amount (30 percent) from the CPU processing for zone2. The following is the procedure:
root@solaris11-1:~# zonecfg -z zone1
zonecfg:zone1> add rctl
zonecfg:zone1:rctl> set name=zone.cpu-shares
zonecfg:zone1:rctl> add value (priv=privileged, limit=70,action=none)
zonecfg:zone1:rctl> end zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> exit
root@solaris11-1:~# zonecfg -z zone2
zonecfg:zone2> add rctl
zonecfg:zone2:rctl> set name=zone.cpu-shares
zonecfg:zone2:rctl> add value (priv=privileged,limit=30,action=none)
zonecfg:zone2:rctl> end zonecfg:zone2> verify zonecfg:zone2> commit zonecfg:zone2> exit
Zones
This is excellent! Shares were assigned to zone1 (70 shares) and zone2 (30 shares) using the zonecfg command in a persistent way. For both the zones to take effect, execute the following commands:
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
root@solaris11-1:~# zoneadm -z zone2 shutdown -r
The processor time can be followed and monitored using the following command:
root@solaris11-1:~# prstat -Z
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
-
4466 root
216M
98M
sleep
59
0
0:00:41
0.7%
java/25
4702 root
129M
19M
sleep
59
0
0:00:06
0.5%
gnome-
terminal/2 rcapd/1
5 root 0K 0K sleep 99 -20 0:00:19 0.2% zpool- rpool/138
898 root 53M 18M sleep 53 0 0:00:06 0.1% poold/9
(omitted output)
automountd/2
-
198
root
1780K
788K
sleep
29
0
0:00:00
0.0%
utmpd/1
945
root
2392K
1552K
sleep
59
0
0:00:00
0.0%
ttymon/1
ZONEID
NPROC
SWAP
RSS
MEMORY
TIME
CPU
ZONE
0
117
2885M
794M
9.5%
0:03:28
2.5%
global
2
28
230M
62M
0.7%
0:00:30
0.1%
zone1
1
28
230M
64M
0.7%
0:00:29
0.1%
zone2
Surprisingly, it is feasible to change the zone.cpu-shares attribute dynamically without rebooting zones but in a non-persistent way (all the changes are lost after a reboot) by running the following commands:
root@solaris11-1:~# prctl -n zone.cpu-shares -v 60 -r -i zone zone1
root@solaris11-1:~# prctl -n zone.cpu-shares -P -i zone zone1
zone: 3: zone1
zone.cpu-shares usage 60 - - - zone.cpu-shares privileged 60 - none -
zone.cpu-shares system 65535 max none -
root@solaris11-1:~# prctl -n zone.cpu-shares -v 40 -r -i zone zone2
root@solaris11-1:~# prctl -n zone.cpu-shares -P -i zone zone2
Chapter 4
zone: 4: zone2
zone.cpu-shares usage 40 - - - zone.cpu-shares privileged 40 - none -
zone.cpu-shares system 65535 max none - root@solaris11-1:~#
To collect information about the memory and CPU from both zones in an interval of 5 seconds, execute the following command:
root@solaris11-1:~# zonestat -z zone1,zone2 -r physical-memory 5
Collecting data for first interval... Interval: 1, Duration: 0:00:05
PHYSICAL-MEMORY SYSTEM MEMORY
mem_default 8191M
ZONE USED %USED CAP %CAP [total] 1464M 17.8% - -
[system] 624M 7.62% - - zone2 63.9M 0.78% - - zone1 3561K 0.04% 1024M 0.33%
Interval: 2, Duration: 0:00:10
PHYSICAL-MEMORY SYSTEM MEMORY
mem_default 8191M
ZONE USED %USED CAP %CAP [total] 1464M 17.8% - -
[system] 624M 7.62% - - zone2 63.9M 0.78% - - zone1 3485K 0.04% 1024M 0.33%
Removing all configured shares is quickly executed by running: root@solaris11-1:~# zonecfg -z zone1 clear cpu-shares root@solaris11-1:~# zonecfg -z zone2 clear cpu-shares root@solaris11-1:~# zoneadm -z zone1 shutdown -r root@solaris11-1:~# zoneadm -z zone2 shutdown -r
Zones
Keeping up with our approach about the resource manager, there's a zone resource,
named dedicated-cpu, where it is possible to specify a subset of processors (or cores)
to a non-global zone. For example, the following example shows us that zone1 can use one to four processors (ncpus=1-4) according to the demand, and this setting has an importance value equal to 8 when competing for resources against other zones or configurations. This smart setup creates a temporary pool including any necessary processor inside it. The following is the sequence:
root@solaris11-1:~# zonecfg -z zone1 zonecfg:zone1> add dedicated-cpu zonecfg:zone1:dedicated-cpu> set ncpus=1-4 zonecfg:zone1:dedicated-cpu> set importance=8 zonecfg:zone1:dedicated-cpu> end zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
root@solaris11-1:~# zlogin zone1
[Connected to zone 'zone1' pts/2]
Oracle Corporation SunOS 5.11 11.1 September 2012 root@zone1:~# pooladm
system default
string system.comment int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load
pool SUNWtmp_zone1 int pool.sys_id 1
boolean pool.active true boolean pool.default false int pool.importance 8 string pool.comment boolean pool.temporary true pset SUNWtmp_zone1
pset SUNWtmp_zone1
int pset.sys_id 1
Chapter 4
boolean pset.default false uint pset.min 1
uint pset.max 4
string pset.units population uint pset.load 4
uint pset.size 2 string pset.comment
boolean pset.temporary true
cpu
int cpu.sys_id 1 string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 0 string cpu.comment
string cpu.status on-line
Amazing! To remove the dedicated-cpu resource from zone1, execute the following command:
root@solaris11-1:~# zonecfg -z zone1 zonecfg:zone1> remove dedicated-cpu zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> exit
Before continuing, we must reboot the zone by running the following command:
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
Another good technique to control zone resources is using the capped-cpu resource, which permits us to specify how big a percentage of a CPU the zone can use. The value to be specified means a percentage of CPUs, and this procedure can be performed by executing the following sequence:
root@solaris11-1:~#
zonecfg
-z zone1 zonecfg:zone1>
add
capped-cpu zonecfg:zone1:capped-cpu>
set
ncpus=2.5 zonecfg:zone1:capped-cpu>
end
Zones
zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> exit
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
According to the previous configuration, the ncpus=2.5 attribute means 250 percent of CPUs or 2.5 CPUs. To remove the recently added resource, execute the following command:
root@solaris11-1:~# zonecfg -z zone1 zonecfg:zone1> remove capped-cpu zonecfg:zone1:capped-cpu> end zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> exit
After all the changes, we have to reboot the zone by executing the following command:
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
This is outstanding! We have executed many trials with resource management, and all of them have worked! As zone1 still has a resource capping (memory), it is time to remove it:
root@solaris11-1:~# zonecfg -z zone1 zonecfg:zone1> remove capped-memory zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> exit
root@solaris11-1:~# zoneadm -z zone1 shutdown -r
Finally, the resource capping feature can be disabled by executing the following command:
root@solaris11-1:~# svcs -a | grep rcap
online 18:49:28 svc:/system/rcap:default root@solaris11-1:~# rcapadm -D
state: disabled memory cap enforcement threshold: 0%
process scan rate (sec): 15 reconfiguration rate (sec): 60
report rate (sec): 5 RSS sampling rate (sec): 5
root@solaris11-1:~# svcs -a | grep rcap
disabled 19:28:33 svc:/system/rcap:default
Chapter 4
Another way of disabling the resource capping feature would be to execute the following command:
root@solaris11-1:~# svcadm disable svc:/system/rcap:default
Perfect! Everything has returned to the initial setup.
An overview of the recipe
This section was very long, and we could learn lots of details about resource management controls and how to limit processors and the memory. In the next chapter, we are going to handle the network resource control.
