Requisitos y notas:
-
Es conveniente instalar ntp en todos los servidores que compartan almacenamiento y usuarios, para evitar conflictos por faltas de sincronía.
-
El servidor target SCSI no puede participar en OCFS2 con el resto de los equipos, pues no ve de la misma manera el disco, a menos que se configure como cliente iSCSI y se comunique a sus discos por red, como los demás nodos. Si se intenta conectar el servidor así al cluster de almacenamiento, los otros nodos lo sacarán al primer acceso con mensajes de error.
Configurando iscsi.
En el servidor (target) iSCSI, instala los paquetes: iscsitarget, iscsitarget-modules-2.6-amd64. Una vez instalados, revisa las opciones de exportación en /etc/ietd.conf, en el caso de 911comp, en la máquina "imagen", el archivo queda con las líneas:
Target iqn.2010-06.mx.com.911comp.imagen:storage.datos
Lun 0 Path=/dev/disk/by-id/scsi-2001b4d230f1c8800,Type=fileio
Target iqn.2010-06.mx.com.911comp.imagen:storage.usuarios
Lun 1 Path=/dev/datos/usuarios,Type=fileio
Estas describen el target, y el Lun (número de dispositivo) a exportar, como se ve en la segunda línea, puede ser un volumen LVM.
En el cliente instala los paquetes: open-iscsi y lsscsi. Al terminar, ejecuta: iscsi_discovery IP_target, en 911comp: iscsi_discovery 192.168.21.2 (imagen.911comp.com.mx). En el archivo de configuración /etc/iscsi/iscsid.conf debe configurarse la autentificación, y activarse la línea:
node.startup = automatic
LVM + cluster.
En todos los nodos que comparten el almacenamiento, instala los paquetes: clvm y openais, clvm en particular, siguiendo el texto: http://h2o.glou.fr/post/2009/04/20/clvm-openais-on-Debian/Lenny, que viene a continuación, esto permitirá que puedan ver los volúmenes compartidos, aunque esto no permite que compartan el uso de los datos de manera simultánea:
clvm + openais on Debian/Lenny
|
Par olecam le lundi 20 avril 2009, 11:18 - debian - Lien permanent
As pointed by Javier Guerra on the xen-users mailing list, the RedHat's cluster projet is now based on openAIS. It is then possible to skip cman and fenced when only clvm (aka without GFS) is needed. This results in a setting easiest by far! Exactly what I was looking for from always for my xen servers which do share the same FC storage unit!
The clvm package in Debian/Lenny is still based on cman, but it is quite easy to compile its source in order to use openAIS instead. I won't develop here the full process on how to install the build environment for dpkg nor the source, please refer to the large number of howto's.
Compile the package
-
The package libopenais-dev is required. Please install it.
-
in ~/src/clvm/lvm2-2.02.39/debian/clvm.init: remove everything related to cman and cluster.conf
-
in ~/src/clvm/lvm2-2.02.39/debian/control: modify the dependies (lvm2 without the version number, openais in place of cman) and modify the comments accordingly like following:
Package: clvm
Section: admin
Priority: extra
Architecture: any
Depends: ${shlibs:Depends}, lvm2, lsb-base, openais
Description: Cluster LVM Daemon for lvm2
This package provides the clustering interface for lvm2. Instead of
the package powered by debian, this one is not based on the Red Hat's
"cman" cluster infrastructure but on "openais". This provide a light
way to implement Cluster LVM. It allows logical volumes to be created
on shared storage devices (eg Fibre Channel, or iSCSI).
-
in ~/src/clvm/lvm2-2.02.39/debian/rules: replace cman by openais in the configure options, and add the PATH where to find the openais libs in:
...
$(STAMPS_DIR)/setup-deb: SOURCE_DIR = $(BUILD_DIR)/source
$(STAMPS_DIR)/setup-deb: DIR = $(BUILD_DIR)/build-deb
$(STAMPS_DIR)/setup-deb: $(STAMPS_DIR)/source
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); \
./configure CFLAGS="$(CFLAGS)" \
LDFLAGS="-L/usr/lib/openais" \
$(CONFIGURE_FLAGS) \
--with-optimisation="" \
--with-clvmd=openais \
--enable-readline
touch $@
...
-
update the version number and place a comment in changelog (eg with dch -i)
-
install the required libs in order to compile the package then build it:
~# apt-get build-dep clvm
~# dpkg-buildpackage -rfakeroot -uc -b
Install and configure openAIS and clvm
-
Install openais, then follow the provided QUICKSTART instructions (/usr/share/doc/openais/QUICKSTART.gz). In short:
-
-
create the user ais and the group ais.
-
mkdir /etc/ais where you can copy and modify the openais.conf example in from /ush/share/doc/openais/examples.
-
start aisexec on each nodes; debian does not provide the init script for it, you must write your own. For now, you can just type aisexec, which will start as a daemon by itself.
-
install the openais version of clvm (eg dpkg -i clvm_2.02.39-7.acv1_amd64.deb), then modify /etc/lvm/lvm.conf with locking_type = 3 in the global section.
-
Start it with /etc/init.d/clvm start (you can first check that everything is OK lauching clvm -d 1 on each nodes).
-
and voilà. Don't forget to create an init script for aisexec before you reboot your computers! ;)
You can get a copy of my own clvm package for openAIS at http://olecam.online.fr/debian/lenny/clvm_2.02.39-7.acv1_amd64.deb
Hope that helps!
|
Una vez compartidos los volúmenes LVM, se pueden crear los espacios para cada máquina virtual, y todos los nodos los verán, es importante que se tome la precaución de no utilizar estos espacios al mismo tiempo en máquinas independientes, a menos que se use un sistema de archivos compartido, como OCFS2, o GFS.
OCFS2
OCFS2 es un sistema de archivos concurrente, escrito por Oracle, y licenciado bajo la GPL, que permite a varios servidores compartir un mismo almacenamiento. Para instalarlo en debian, hay que instalar los paquetes: ocfs2-tools, heartbeat-2. Los archivos de configuración se crean durante la instalación, y es necesario también crear el archivo /etc/ocfs2/cluster.conf, ya sea con la herramienta de consola, o con el formato:
node:
ip_port = 7777
ip_address = 192.168.21.24
number = 24
name = mailwintel
cluster = c911
node:
ip_port = 7777
ip_address = 192.168.21.25
number = 25
name = samba
cluster = c911
cluster:
node_count = 2
name = c911
Este archivo es el más delicado, los nombres de nodos deben coincidir con el hostname de la estación, y el archivo debe ser idéntico en todas las estaciones del cluster.
Nota: en debian es recomendable instalar los paquetes, y crear el archivo cluster.conf antes de configurar ocfs2 con el comando: dpkg-reconfigure ocfs2-tools.