OpenVZ

Aus SchnallIchNet
Wechseln zu: Navigation, Suche

VZ anlegen

vzctl create CTID --ostemplate osname
vzctl set    CTID --save --ipadd a.b.c.d
vzctl set    CTID --save --nameserver a.b.c.D --nameserver a.b.c.E
vzctl start  CTID
CTID Numeric VZ-ID
osname name eines template-images im verz. <VZ-Home>/template/cache - in meinem fall (Debian Lenny) /var/lib/vz/ - ohne die dateiendung (.tar.gz) angeben

VZ zerstoeren

vzctl destroy CTID

zerstoert/loescht die VZ mit der ID CTID

VZ ressourcen setzen

vzctl set CTID --save --kmemsize 2147483647:2147483647 --lockedpages 2147483647:2147483647 \
--privvmpages 2147483647:2147483647 --shmpages 2147483647:2147483647 \
--numproc 2147483647:2147483647 --physpages 2147483647:2147483647 --vmguarpages 2147483647:2147483647 \
--oomguarpages 2147483647:2147483647 --numtcpsock 2147483647:2147483647 --numflock 2147483647:2147483647 \
--numpty 2147483647:2147483647 --numsiginfo 2147483647:2147483647 --tcpsndbuf 2147483647:2147483647 \
--tcprcvbuf 2147483647:2147483647 --othersockbuf 2147483647:2147483647 --dgramrcvbuf 2147483647:2147483647 \
--numothersock 2147483647:2147483647 --dcachesize 2147483647:2147483647 --numfile 2147483647:2147483647 \
--numiptent 2147483647:2147483647 --diskinodes 2147483647:2147483647

setzt alle beschraenkungen auf den wert des hostsystems die in /proc/user_beancounters aufgefuehrt sind
zusaetzlich muss noch der plattenplatz angepasst werden

Achtung.jpeg dies setzt die ressourcen auf den maximal verfuegbaren wert! fuer eine sinnvolle bzw. nutzungs-bedingte berechnung und aufteilung siehe [1]
vzctl set CTID --save --diskspace 10G:15G

setzt das softlimit fuer plattenplatz auf 10GB und das hardlimit auf 15GB

CPU

There are two parameters controlling fair CPU scheduler in OpenVZ: cpuunits and cpulimit.

cpuunits

Cpuunits are set via

vzctl set 101 --cpuunits 1000 --save

For example. If you set a cpuunit for one container to a value and set a cpuunit on another container to a different value, the time allotted to each of the containers will be the ratio of the two units. Let's use a real example.

We did the following:

vzctl set 101 --save --cpuunits 1000
vzctl set 102 --save --cpuunits 2000
vzctl set 103 --save --cpuunits 3000

If we started a CPU intensive application on each CT, then 103 would be given 3 times as much cpu time as 101 and 102 would get twice as much as 101, but some fraction of what 103 got. Here's how to determine what the real ratios are.

Add the three units, 1000+2000+3000 = 6000

101 gets 1000/6000 or 1/6th of the time. (16%)
102 gets 2000/6000 or 1/3rd of the time. (34%)
103 gets 3000/6000 or 1/2 of the time. (50%)

cpulimit

The cpulimit parameter sets the absolute maximum limit for a container to a percent value. For instance:

vzctl set 101 --cpulimit 25 --save

says that container 101 cannot ever have more than 25 percent of the cpu even if the cpu is idle for the other 75% of the time.

Achtung.jpeg cpulimit is not yet implemented in kernels > 2.6.18 (i.e. development ones). Use stable kernel if you want this feature.

Performance

vzctl set CTID --save --noatime yes

setzt noatime auf yes. in der VZ wird dann die access-time fuer files nicht aktualisiert.

OS Templates

Achtung.jpeg Download to host system's /vz/template/cache directory

http://wiki.openvz.org/Download/template/precreated
http://download.openvz.org/beta/templates/precreated/