Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] dischi virtuali e remote raid con GNBD
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Nov 14, 2005 11:35 am    Post subject: [TIP] dischi virtuali e remote raid con GNBD Reply with quote

Come si può condividere lo storage in rete ?
nfs lo conoscono tutti, ma alla domanda in questione si può rispondere anche:
con un "network block device".

NBD è un modulo del kernel ed ha un funzionamento molto semplice:
il device fisico (disco/partizione/file) si trova sul server, NBD lo "importa" e il client vi accede localmente.
Ora, sebbene i network block devices e relativi tools userspace non siano giovanissini, i crash frequenti ne limitano fortemente l'utilizzo.

RedHat, nella sua nuova, fiammeggiante suite dedicata al clustering, ha creato un'implementazione molto robusta denominata GNBD.
GNBD, in realtà, è solo un componente di un'infrastruttura molto più complessa che comprende GFS*, cluster manager + varie ed eventuali.

Ai fini del tip in oggetto, GNBD basta e soverchia, per cui sorvoliamo sul resto.

Installazione.
Code:
/etc/portage/package.keywords
..
sys-cluster/gnbd ~x86
sys-cluster/gnbd-headers ~x86
sys-cluster/gnbd-kernel ~x86
sys-cluster/magma ~x86
..
emerge sys-cluster/gnbd sys-cluster/gnbd-kernel
depmod -a


Ora, creiamo e due dischi virtuali ext3 da 100Mb sul server:

Code:
dd if=/dev/zero of=/data/disk1 bs=1024 count=`expr 100 \* 1024`
dd if=/dev/zero of=/data/disk2 bs=1024 count=`expr 100 \* 1024`
mkfs.ext3 -F /data/disk1
mkfs.ext3 -F /data/disk2


Creati i disci, esportarli è molto semplice:

Code:
# facciamo partire il server
gnbd_serv -n

# aggiungiamo gli shares
gnbd_export -c -e disk1 -d /data/disk1
gnbd_export -c -e disk2 -d /data/disk2

# visualizziamo gli shares esportati
gnbd_export -l


Sul client

Code:
# modulo del kernel
modprobe gnbd

# importiamo gli shares
gnbd_import -n -i $SERVER

# visualizziamo gli shares importati
gnbd_import -ln


Ora, i devices locali
Code:
/dev/gnbd/disk1
/dev/gnbd/disk2


corrispondono a disk1 e disk2 creati in precedenza sul server ed ogni modifica locale viene trasmessa via rete ai devices reali.

possiamo montarli ed utilizzarli come faremmo se i devices fossero realmente sul client
Code:
mount /dev/gnbd/disk1 /mnt/disk1
mount /dev/gnbd/disk2 /mnt/disk2


Raid remoto distribuito.
Ora la parte più bella, supponiamo che disk1 e disk2 vengano importati da due servers distinti.
Creando un raid software, potremmo distribuire il carico sui servers (raid0) o avere un backup realtime (raid1).
Code:
modprobe raid1
mdadm --create /dev/md0 --auto=yes --level=1 --raid-devices=2 /dev/gnbd/disk1 /dev/gnbd/disk2

mount /dev/md0 /mnt/raid1


Happy coding.

* c'era scritto qualcosa qui, ma non ricordo esattamente cosa


Last edited by makoomba on Tue Dec 20, 2005 10:58 am; edited 1 time in total
Back to top
View user's profile Send private message
!equilibrium
Bodhisattva
Bodhisattva


Joined: 06 Jun 2004
Posts: 2109
Location: MI/BG/LC

PostPosted: Mon Nov 14, 2005 3:12 pm    Post subject: Reply with quote

ottimo TIP, proprio quello che cercavo.
come sono le performance in lettura/scrittura di NBD ?
_________________
Arch Tester for Gentoo/FreeBSD
Equilibrium's Universe

all my contents are released under the Creative Commons Licence by-nc-nd 2.5
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Nov 14, 2005 3:22 pm    Post subject: Reply with quote

in lettura 10mb/s su una 100mbit.
in scrittura è un pò più difficile a causa della cache, ma a rigor di logica i tempi dovrebbero essere identici.

mi piacerebbe fare qualche test più serio, magari su gigabit ethernet.
Back to top
View user's profile Send private message
!equilibrium
Bodhisattva
Bodhisattva


Joined: 06 Jun 2004
Posts: 2109
Location: MI/BG/LC

PostPosted: Mon Nov 14, 2005 3:45 pm    Post subject: Reply with quote

makoomba wrote:
in lettura 10mb/s su una 100mbit.
in scrittura � un p� pi� difficile a causa della cache, ma a rigor di logica i tempi dovrebbero essere identici.

mi piacerebbe fare qualche test pi� serio, magari su gigabit ethernet.


grazie per la risposta, farò qualche test anche io con NBD + XFS e credo che una rete gigabit sia proprio necessaria.
_________________
Arch Tester for Gentoo/FreeBSD
Equilibrium's Universe

all my contents are released under the Creative Commons Licence by-nc-nd 2.5
Back to top
View user's profile Send private message
SilverXXX
l33t
l33t


Joined: 18 Sep 2004
Posts: 885

PostPosted: Mon Nov 14, 2005 4:53 pm    Post subject: Reply with quote

Molto bello, ma personalmente ce lo vedo bene solo su una gigabit
_________________
about:mozilla
Back to top
View user's profile Send private message
Dr.Dran
l33t
l33t


Joined: 08 Oct 2004
Posts: 766
Location: Imola - Italy

PostPosted: Fri Dec 16, 2005 9:00 pm    Post subject: Reply with quote

Ho una piccola curiosità, ma viene fatto un controllo di accesso sugli utenti? Oppure tutti possono montare le partizioni condivise?

Scusate ma la domanda per me è lecita e necessaria :wink:

EDIT: eh eh eh scusate l'approccio ma mi interessa poichè potrebbe essere un ottimo filesystem sostitutivo per NFS :wink:
_________________
:: [Dr.Dran] Details ::
- Linux User # 286282
- IT FreeLance Consultant
- President of ImoLUG [Imola & Faenza Linux User Group]
Back to top
View user's profile Send private message
xchris
Advocate
Advocate


Joined: 10 Jul 2003
Posts: 2824

PostPosted: Mon Dec 19, 2005 9:01 am    Post subject: Reply with quote

complimenti makoomba :)

ottimo tip per una cosa veramente "sconosciuta" o quasi.

Ti nomino "Capo Tips Inusuali e Curiosi" :lol:

;)

ciao
_________________
while True:Gentoo()
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Dec 19, 2005 11:20 am    Post subject: Reply with quote

@xchris
ehehe, sono onorato dell'investitura e ti anticipo il nuovo (da postare, tempo permettendo)
Code:
[TIP] WinXP inside gentoo: was vmware-player + qemu


@DranXXX
no, i controlli di accesso vanno implentati nei livelli successivi (GFS)
puoi usare iptables, ma a livello globale e non per singolo share
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 1:48 pm    Post subject: Network Block Device Reply with quote

Ho da poco scoperto questo strumento e mentre mi accingo a testarlo approfonditamente mi chiedo come mai sia quasi sconosciuto rispetto a NFS (almeno io ho sempre trovato riferimenti a nfs e mai a nbd).
Da quanto ho letto ndb offre prestazioni maggiori e dovrebbe anche essere più cool :lol:
Ok, questo potevo risparmiarmelo ma sembra che, contrariamente a nfs, possa fare al caso mio permettendomi di condividere un cdrom UDF (prima testo e poi confermo).

Voi lo conoscevate e lo avete scartato (se è così per quale motivo ?) o esiste una cospirazione interplanetaria per nasconderci le potenzialita di nbd (oltre che delle GPU :lol: ) ?
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
Ic3M4n
Advocate
Advocate


Joined: 02 Nov 2004
Posts: 3489
Location: Bergamo.

PostPosted: Mon Dec 19, 2005 2:03 pm    Post subject: Reply with quote

mi sa che la cospirazione ha lasciato il segno anche qui. :wink: :lol:
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Dec 19, 2005 2:21 pm    Post subject: Reply with quote

è buggatissimo e crasha una bellezza
usa gnbd.
c'è un tip nella sezione apposita.
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 2:49 pm    Post subject: Reply with quote

makoomba wrote:
è buggatissimo e crasha una bellezza
usa gnbd.
c'è un tip nella sezione apposita.

Ho letto che l'hanno incluso nel kernel dalla 2.1 e pensavo che ormai fosse decisamente stabile 8O
Dove posso trovare un elenco dei bug di cui parli ?

Grazie per avermi segnalato il tip :wink:
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Dec 19, 2005 3:06 pm    Post subject: Reply with quote

beh, cerca un pò su internet, ma considera che la mia è un esperienza diretta.
voglio dire, ho provato ad utilizzarlo ma crasha, oopsa, urla, sputa, rutta, etc, etc.
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
.:chrome:.
Advocate
Advocate


Joined: 19 Feb 2005
Posts: 4588
Location: Brescia, Italy

PostPosted: Mon Dec 19, 2005 3:12 pm    Post subject: Reply with quote

Kernel78 wrote:
Ho letto che l'hanno incluso nel kernel dalla 2.1

no. non 2.1, ma 2.6.1
questo spiega perché è poco conosciuto (NFS esiste dalla notte dei tempi, NBD esiste dal 2004) e perché è ancora così buggato. si tratta semplicemente di un codice giovane
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 3:14 pm    Post subject: Reply with quote

makoomba wrote:
beh, cerca un pò su internet, ma considera che la mia è un esperienza diretta.
voglio dire, ho provato ad utilizzarlo ma crasha, oopsa, urla, sputa, rutta, etc, etc.

Da come le descrivi mi ricorda mio fratello :lol:

Giusto per curiosità : ti è capitato di trovare altra gente che si lamentasse dell'instabilità conclamata di nbd o i tuoi commenti sono solo frutto della tua esperienza ? non che non mi fidi di te, anzi, dopo i tuoi commenti presterò maggiore attenzione ma per il poco che ho trovato per ora mi sembrava che ne parlassero solo bene ...
Adesso provo a vedere se google mi aiuta a cercare dei bug :wink:
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 3:17 pm    Post subject: Reply with quote

k.gothmog wrote:
Kernel78 wrote:
Ho letto che l'hanno incluso nel kernel dalla 2.1

no. non 2.1, ma 2.6.1
questo spiega perché è poco conosciuto (NFS esiste dalla notte dei tempi, NBD esiste dal 2004) e perché è ancora così buggato. si tratta semplicemente di un codice giovane

Allora il sito http://nbd.sourceforge.net/ è errato visto che riporta
Quote:
Network block device has been included into standard (Linus') kernel tree in 2.1.101.
e anche http://www2.linuxjournal.com/article/3778 da cui cito
Quote:
In April of 1997, Pavel Machek wrote the code for his Network Block Device (NBD), the vehicle for his work being the then-current 2.1.55 Linux kernel.


Da dove hai ricavato le tue info ?
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Dec 19, 2005 3:25 pm    Post subject: Reply with quote

@k.gothmog
non soffre di problemi di gioventù, soffre di problemi e basta
Code:
/*
 * Network block device - make block devices work over TCP
 *
 * Note that you can not swap over this thing, yet. Seems to work but
 * deadlocks sometimes - you can not swap over TCP in general.
 *
 * Copyright 1997-2000 Pavel Machek <pavel@ucw.cz>
 * Parts copyright 2001 Steven Whitehouse <steve@chygwyn.com>
 *
 * (part of code stolen from loop.c)
 *

Kernel78 wrote:
Giusto per curiosità : ti è capitato di trovare altra gente che si lamentasse dell'instabilità conclamata di nbd o i tuoi commenti sono solo frutto della tua esperienza ? non che non mi fidi di te, anzi, dopo i tuoi commenti presterò maggiore attenzione ma per il poco che ho trovato per ora mi sembrava che ne parlassero solo bene ...

mi è bastata l'esperienza diretta.
passato a gnbd, son spariti tutti i problemi
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
.:chrome:.
Advocate
Advocate


Joined: 19 Feb 2005
Posts: 4588
Location: Brescia, Italy

PostPosted: Mon Dec 19, 2005 3:31 pm    Post subject: Reply with quote

Kernel78 wrote:
Allora il sito http://nbd.sourceforge.net/ è errato visto che riporta
Quote:
Network block device has been included into standard (Linus') kernel tree in 2.1.101.

evidentemente ricordo male.
eppure ricordo di avere discusso di quel coso con un tipo proprio in concomitanza delle prime uscite del kernel 2.6, e quando lavoravo là era proprio l'inizio del 2004... è possibile che sia stato pesantemente riscritto in quell'occasione o che abbia cambiato nome assumendo l'attuale NBD?
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 3:32 pm    Post subject: Reply with quote

makoomba wrote:

mi è bastata l'esperienza diretta.
passato a gnbd, son spariti tutti i problemi

Quello che mi secca è dover usare sw mascherato quando teoricamente esiste già un equivalente "stabile" anche se a quanto dici molto stabile non è :cry:

... mettero mano al package.keywords :evil: ...
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 3:34 pm    Post subject: Reply with quote

k.gothmog wrote:
Kernel78 wrote:
Allora il sito http://nbd.sourceforge.net/ è errato visto che riporta
Quote:
Network block device has been included into standard (Linus') kernel tree in 2.1.101.

evidentemente ricordo male.
eppure ricordo di avere discusso di quel coso con un tipo proprio in concomitanza delle prime uscite del kernel 2.6, e quando lavoravo là era proprio l'inizio del 2004... è possibile che sia stato pesantemente riscritto in quell'occasione o che abbia cambiato nome assumendo l'attuale NBD?

Come diceva una celebre pubblicità "Questo lo ignoro" ... ho conosciuto nbd solo oggi :wink:
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Dec 19, 2005 3:40 pm    Post subject: Reply with quote

Code:
 * 97-3-25 compiled 0-th version, not yet tested it
 *   (it did not work, BTW) (later that day) HEY! it works!
 *   (bit later) hmm, not that much... 2:00am next day:
 *   yes, it works, but it gives something like 50kB/sec
 * 97-4-01 complete rewrite to make it possible for many requests at
 *   once to be processed
 * 97-4-11 Making protocol independent of endianity etc.
 * 97-9-13 Cosmetic changes
 * 98-5-13 Attempt to make 64-bit-clean on 64-bit machines
 * 99-1-11 Attempt to make 64-bit-clean on 32-bit machines <ankry@mif.pg.gda.pl>
 * 01-2-27 Fix to store proper blockcount for kernel (calculated using
 *   BLOCK_SIZE_BITS, not device blocksize) <aga@permonline.ru>
 * 01-3-11 Make nbd work with new Linux block layer code. It now supports
 *   plugging like all the other block devices. Also added in MSG_MORE to
 *   reduce number of partial TCP segments sent. <steve@chygwyn.com>
 * 01-12-6 Fix deadlock condition by making queue locks independent of
 *   the transmit lock. <steve@chygwyn.com>
 * 02-10-11 Allow hung xmit to be aborted via SIGKILL & various fixes.
 *   <Paul.Clements@SteelEye.com> <James.Bottomley@SteelEye.com>
 * 03-06-22 Make nbd work with new linux 2.5 block layer design. This fixes
 *   memory corruption from module removal and possible memory corruption
 *   from sending/receiving disk data. <ldl@aros.net>
 * 03-06-23 Cosmetic changes. <ldl@aros.net>
 * 03-06-23 Enhance diagnostics support. <ldl@aros.net>
 * 03-06-24 Remove unneeded blksize_bits field from nbd_device struct.
 *   <ldl@aros.net>
 * 03-06-24 Cleanup PARANOIA usage & code. <ldl@aros.net>
 * 04-02-19 Remove PARANOIA, plus various cleanups (Paul Clements)
 * possible FIXME: make set_sock / set_blksize / set_size / do_it one syscall
 * why not: would need access_ok and friends, would share yet another
 *          structure with userland
 */

cmq, il problema c'è anche a livello di userspace
ogni server esporta un singolo share, quindi n shares = n servers
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 3:41 pm    Post subject: Reply with quote

Una curiosità ...
I passi che hai descritto sono sufficienti o devo mettere mano al kernel (per nbd devo aggiungere nel kernel il supporto) ?
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Mon Dec 19, 2005 3:45 pm    Post subject: Reply with quote

sys-cluster/gnbd-kernel compila il modulo per il kernel.
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 3:59 pm    Post subject: Reply with quote

makoomba wrote:

cmq, il problema c'è anche a livello di userspace
ogni server esporta un singolo share, quindi n shares = n servers

Domanda: con gnbd n shares = 1 server ?
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Mon Dec 19, 2005 4:00 pm    Post subject: Reply with quote

makoomba wrote:
sys-cluster/gnbd-kernel compila il modulo per il kernel.

con la domanda che sto per fare mostrerò tutta la mia abissale ignoranza !!!
Ogni volta che ricompilo il kernel devo riemergere il pacchetto ?
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum