OpenVZ ist nicht nur eine Visualisierungssystem mit der man, im Gegensatz zu anderen Ansätzen, mehrere Virtuelle Maschinen laufen lassen kann. Man kann auch diese Maschinen von einer zentralen Stelle, der Hardware Note, verwalten. Der Preis dafür ist, dass man nur Linux einsetzen kann.
Debian Upgrade
Wer auf seinem Server nur mit Debian arbeitet kann dieses Script einsetzen um alle VPS auf dem aktuellen Stand zu halten.
|
1 2 3 4 5 6 |
#!/bin/sh
# vzdeb-upgrade
for i in $(vzlist -o vpsid -H)
do
vzctl exec $i apt-get update; apt-get upgrade
done |
System Auslastung
Zeigt die Auslastung der einzelnen VPS mittels vzcalc
|
1 2 3 4 5 6 7 8 9 10 11 |
echo
for i in $(vzlist -o vpsid -H)
do
echo -n $(vzlist -o hostname -H $i)
echo -n " "
echo -n $(vzlist -o kmemsize.m -H $i)
echo -n " "
vzlist -o ip -H $i
vzcalc $i
echo "-----------------------------------------------------------------"
done |
Konfiguration
Die VN’s (Virtual Notes) werden über eine Datei eingestellt. Diese Datei befindet sich im Verzeichnis /etc/vz/…. Hier ein Beispiel einer Konfiguration eines VN’s.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# Copyright (C) 2000-2006 SWsoft. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# solle der VPS beim Starten der HN mitgestartet werden?
ONBOOT="yes"
# UBC parameters (in form of barrier:limit)
# Primary parameters
# Anzahl der erwarteten Prozesse
AVNUMPROC="40:40"
# Anzahl der erlaubten Prozesse und Threads
NUMPROC="232:232"
# Anzahl der TCP Sockets :: limiterit somit die Anzahl der Clients die der
# Server gleichzeitig verarbeitenn kann.
NUMTCPSOCK="500:500"
# Anzahl der anderen (z.B. udp) Sockets
NUMOTHERSOCK="382:382"
# Speichergarantie
VMGUARPAGES="64M:2147483647"
#
# Secondary parameters
#
# xxxxxxxxxxxxxxxxxxxxxx
KMEMSIZE="8512433:8512433"
TCPSNDBUF="4683256:6102456"
TCPRCVBUF="4683256:6102456"
OTHERSOCKBUF="1503232:4063232"
DGRAMRCVBUF="240000:262144"
# Speichergarantie bei Speichermangel
# wird bei vzfree als Zugesicherter Speicher angezeigt
OOMGUARPAGES="64M:2147483647"
# Auxiliary parameters
LOCKEDPAGES="3800:4096"
SHMPAGES="131072:131072"
# Maximal nutzbarer Speicher
PRIVVMPAGES="120M:128M"
NUMFILE="5432:5432"
NUMFLOCK="200:232"
NUMPTY="64:64"
NUMSIGINFO="512:512"
DCACHESIZE="2194304:2317184"
PHYSPAGES="0:2147483647"
NUMIPTENT="128:128"
# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="200M:400M"
DISKINODES="200000:220000"
QUOTATIME="0"
# CPU fair sheduler parameter
CPUUNITS="500"
VE_ROOT="/var/lib/vz/root/$VEID"
VE_PRIVATE="/var/lib/vz/private/$VEID"
OSTEMPLATE="debian-4.0-i386-minimal"
ORIGIN_SAMPLE="vps.basic"
HOSTNAME="vps1.exampel.tdl"
IP_ADDRESS="192.168.0.10"
NAMESERVER="192.168.0.1 192.168.0.3 192.168.0.2"
SEARCHDOMAIN="example.tdl" |
Links
http://forum.plesk.com/showthread.php?s=&threadid=26770
http://www.hosteurope.de/faq/index.php?cpid=13281
Konfiguration der VPS überprüfen
Um die einzelnen Konfigurationsdateien der VPS zu überprüfen kann man folgende Zeile verwenden.
|
1 |
for i in $(vzlist -o vpsid -H -a); do echo -n "$i.conf : " ; vzcfgvalidate /etc/vz/conf/$i.conf ; done |
Funktionsbeschreibung: Zuerst werden die VPS IP’s aller ermittelt. Dann wird der Dateiname ausgegeben und anschließend die Meldung des Tests der mit vzcfgvalidate ermittelt wurde. Zu beachten ist, dass der volle Pfad der Konfigurationsdatei angegeben werden muss.
Laufwerke zwischen den einzelnen VE’s verbinden.
Um Laufwerke bzw. Verzeichnisse unter den einzelnen VE’s verbinden zu können kann der Befehl mount -bind Quelle Ziel verwendet werden.
|
1 |
mount --bind /var/lib/vz/root/105/home/ /var/lib/vz/root/130/home/lenny/webserver/ |
SBM / Windowsfreigabe im VE zur Verfügung stellen
Eigentlich kann man in einem VE keine SMB Laufwerke binden, das im OpenVZ Kern diese Unterstützung nicht eingebaut ist.
Eine Übersicht bekommt man mit diesem Befehl
|
1 2 3 4 5 |
# cat /proc/filesystems
ext3
nodev proc
nodev tmpfs
nodev devpts |
Auszug aus der Seite http://forum.openvz.org/index.php?t=msg&goto=4994&
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
smbfs/cifs isn't virtualized now,
you can't use it inside VE.
All available in VE filesystems resides in /proc/filestystems
file inside VE.
You can do the following to make smb shares available in VE:
On HOST (!):
mount -t cifs //192.168.1.30/test /mn
mount --bind /mn /vz/root/101/mn
After that you can see contents of //192.168.1.30/test
inside VE in /mn directory.
You can automate this process using 101.mount and 101.umount
scripts in conf directory of OpenVZ.
HTH,
vass. |
WebLinks
