Konfiguracja IP, LVM – XEN cz.1

Print Friendly, PDF & Email

Xen – monitor maszyn wirtualnych (ang. Hypervisor). Jego zadaniem jest zarządzenie współpracą maszyn wirtualnychuruchomionych w jego środowisku, w szczególności dbanie o wzajemną separację środowisk wirtualnych z zachowaniem maksymalnej ich wydajności. Atutem i przyczyną popularności Xen jest to, że zajmuje stosunkowo niewiele zasobów sprzętowych.


Będziemy potrzebować dwóch maszyn (fizycznych):

1) node1.example.com – główny węzeł klastra (IP:192.168.1.100)


2) node2.example.com – węzeł zapasowy (IP:192.168.1.101)

W przykładzie oba węzły powinny mieć dysk 500GB, z czego 20GB przeznaczymy na główną partycje „/”, 1GB na swap, pozostałe miejsce na inne partycje.

Tworzony przez nas klaster będzie miał IP:192.168.1.102 oraz będzie nazywał się cluster1.example.com.

Instancja (maszyna wirtualna) XEN będzie miała IP:192.168.1.105 oraz nazwę inst1.example.com.

Node1 będzie umożliwiał zarządzanie klastrem, na Node2 będzie pracował Inst1.

1) Konfiguracja IP:

Na Node1 ustawimy IP 192.168.1.100:

nano /etc/network/interfaces 

dodajemy do niego:

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.0.255
        gateway 192.168.1.1

Restart:

/etc/init.d/networking restart



Dodajemy nasze maszyny do pliku hosts:

nano /etc/hosts



127.0.0.1       localhost.localdomain   localhost
192.168.1.100   node1.example.com       node1
192.168.1.101   node2.example.com       node2
192.168.1.102   cluster1.example.com    cluster1
192.168.1.105   inst1.example.com       inst1
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

następnie wykonujemy:

hostname
hostname -f
echo node1.example.com > /etc/hostname/etc/init.d/hostname.sh start



następnie:

aptitude update
aptitude safe-upgrade



Node2



nano /etc/network/interfaces



dodajemy:


# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
        address 192.168.0.110
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1


Restart

/etc/init.d/networking restart

        nano /etc/hosts


dodajemy:


127.0.0.1       localhost.localdomain   localhost
192.168.1.100   node1.example.com       node1
192.168.1.101   node2.example.com       node2
192.168.1.102   cluster1.example.com    cluster1
192.168.1.105   inst1.example.com       inst1
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

następnie:


echo node2.example.com > /etc/hostname 


/etc/init.d/hostname.sh start



na koniec:

aptitude update 


aptitude safe-upgrade





2) LVM (manager woluminów logicznych):


Zarządzanie dyskami bez podziału ich na partycje


Node1/Node2


fdisk -l


Disk /dev/sda: 500.1 GB, 500107862016 bytes255 heads, 63 sectors/track, 60801 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0x00023cd1
   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          62      497983+  83  Linux/dev/sda2              63        6141    48829567+  8e  Linux LVM



Przydzielamy resztę dysku do sda3 (postępujemy tak jak wytłuszczone znaki):


fdisk /dev/sda



The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):
  N
Command action
   e   extended
   p   primary partition (1-4) 
p

Partition number (1-4): 3
First cylinder (6142-60801, default 6142):  ENTER
Using default value 6142
Last cylinder or +size or +sizeM or +sizeK (6142-60801, default 60801):
  ENTER
Using default value 60801

Command (m for help):
 t
Partition number (1-4): 3
Hex code (type L to list codes): L

  0  Empty           1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot
 1  FAT12           24  NEC DOS         81  Minix / old Lin bf  Solaris
 2  XENIX root      39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 4  FAT16 less 32M      40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 5  Extended        41  PPC PReP Boot   85  Linux extended  c7  Syrinx
 6  FAT16           42  SFS             86  NTFS volume set da  Non-FS data
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility
 9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt
 a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e1  DOS access
 b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O
 c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          e4  SpeedStor
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs
 f  W95 Ext’d (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  EFI GPT
10  OPUS            55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor
14  Hidden FAT16 <3 a9=”a9″ br=”br” etbsd=”etbsd” f4=”f4″ nbsp=”nbsp” peedstor=”peedstor” style=”margin: 0px; padding: 0px;”>16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fd  Linux raid auto
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fe  LANstep
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid ff  BBT
1c  Hidden W95 FAT3 75  PC/IX

Hex code (type L to list codes):
 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help):
 w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

następnie:

fdisk -l


Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00023cd1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          62      497983+  83  Linux
/dev/sda2              63        6141    48829567+  8e  Linux LVM
/dev/sda3            6142       60801   439056450   8e  Linux LVM

Wielkości będą się różnić w zależności od wielkości dysku.

Robimy restart obu maszyn:

reboot


następnie instalujemy (być może już jest zainstalowany, ale lepiej wykonać jedno polecenie):

apt-get install lvm2




następnie wykonujemy:


pvcreate /dev/sda3 

vgcreate xenvg /dev/sda3




Print Friendly, PDF & Email

Dziękuję Ci, za poświęcony czas na przeczytanie tego artykułu. Jeśli był on dla Ciebie przydatny, to gorąco zachęcam Cię do zapisania się na mój newsletter, jeżeli jeszcze Cię tam nie ma. Proszę Cię także o “polubienie” mojego bloga na Facebooku oraz kanału na YouTube – pomoże mi to dotrzeć do nowych odbiorców. Raz w tygodniu (niedziela punkt 17.00) otrzymasz powiadomienia o nowych artykułach / projektach zanim staną się publiczne. Możesz również pozostawić całkowicie anonimowy pomysł na wpis/nagranie.

Link do formularza tutaj: https://beitadmin.pl/pomysly

Pozostaw również komentarz lub napisz do mnie wiadomość odpisuję na każdą, jeżeli Masz jakieś pytania:).

Dodaj komentarz

beitadmin.pl - Droga Administratora IT