OCFS2 ist seit Kernel 2.6.19 stabil (eingeführt 2005)
Bei OCFS2 handelt es sich um ein Open-Source Cluster-Dateisystem von der Firma Oracle für Linux, welches in einem Computercluster konkurrierenden Zugriff auf eine Shared Storage ermöglicht.
OCFS2 unterstützt keine ACLs, die Unterstützung erweiterter Attribute und SELINUX ist geplant.
OCFS2 beherrscht gleichzeitig den gepufferten und ungepufferten ("O_DIRECT") Zugriff.
WAN-Tauglich ist es nicht ⇒ lower latency is highly recommended
OCFS2 is a general purpose extent based shared disk cluster file system with many similarities to ext3. It supports 64 bit inode numbers, and has automatically extending metadata groups which may also make it attractive for non-clustered use.
o2cb add-heartbeat share_ocfs2 /dev/sdc1 o2cb heartbeat-mode share_ocfs2 local
dpkg-reconfigure ocfs2-tools service o2cb stop service o2cb start ss -lntp mount /share_test/
echo "stats" | debugfs.ocfs2 -n /dev/sdc1
node:
ip_port = 7777
ip_address = 192.168.2.101
number = 0
name = hostname01
cluster = share_ocfs2
node:
ip_port = 7777
ip_address = 192.168.2.102
number = 1
name = hostname02
cluster = share_ocfs2
node:
ip_port = 7777
ip_address = 192.168.2.103
number = 2
name = hostname03
cluster = share_ocfs2
cluster:
name = share_ocfs2
heartbeat_mode = local
node_count = 3
> fdisk /dev/vdb > fdisk -l /dev/vdb Disk /dev/vdb: 21.5 GB, 21474836480 bytes 3 Köpfe, 34 Sektoren/Spur, 411206 Zylinder, zusammen 41943040 Sektoren Einheiten = Sektoren von 1 × 512 = 512 Bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Festplattenidentifikation: 0x3dbc6fb1 Gerät boot. Anfang Ende Blöcke Id System /dev/vdb1 2048 41943039 20970496 83 Linux > aptitude -y install ocfs2-tools > mkfs -t ocfs2 -L "share_ocfs2" /dev/vdb1 > echo "LABEL="share_ocfs2" /home ocfs2 defaults,_netdev 0 0" >> /etc/fstab > cp /usr/share/doc/ocfs2-tools/examples/cluster.conf /etc/ocfs2/ > vi /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 192.168.2.101
number = 0
name = hostname01
cluster = share_ocfs2
node:
ip_port = 7777
ip_address = 192.168.2.102
number = 1
name = hostname02
cluster = share_ocfs2
node:
ip_port = 7777
ip_address = 192.168.2.103
number = 2
name = hostname03
cluster = share_ocfs2
cluster:
node_count = 3
name = share_ocfs2
Bei "name = " muss die Ausgabe von "uname -n" angegeben werden!
# service o2cb configure > dpkg-reconfigure ocfs2-tools Loading filesystem "configfs": OK Mounting configfs filesystem at /sys/kernel/config: OK Loading stack plugin "o2cb": OK Loading filesystem "ocfs2_dlmfs": OK Creating directory '/dlm': OK Mounting ocfs2_dlmfs filesystem at /dlm: OK Setting cluster stack "o2cb": OK Starting O2CB cluster share_ocfs2: OK > service o2cb online Cluster share_ocfs2 already online > /etc/init.d/ocfs2 start Starting Oracle Cluster File System (OCFS2) OK > service o2cb status Driver for "configfs": Loaded Filesystem "configfs": Mounted Stack glue driver: Loaded Stack plugin "o2cb": Loaded Driver for "ocfs2_dlmfs": Loaded Filesystem "ocfs2_dlmfs": Mounted Checking O2CB cluster share_ocfs2: Online Heartbeat dead threshold = 31 Network idle timeout: 30000 Network keepalive delay: 2000 Network reconnect delay: 2000 Checking O2CB heartbeat: Active > cat /etc/default/o2cb # # This is a configuration file for automatic startup of the O2CB # driver. It is generated by running 'dpkg-reconfigure ocfs2-tools'. # Please use that method to modify this file. # # O2CB_ENABLED: 'true' means to load the driver on boot. O2CB_ENABLED=true # O2CB_BOOTCLUSTER: If not empty, the name of a cluster to start. O2CB_BOOTCLUSTER=share_ocfs2 # O2CB_HEARTBEAT_THRESHOLD: Iterations before a node is considered dead. O2CB_HEARTBEAT_THRESHOLD=31 # O2CB_IDLE_TIMEOUT_MS: Time in ms before a network connection is considered dead. O2CB_IDLE_TIMEOUT_MS=30000 # O2CB_KEEPALIVE_DELAY_MS: Max. time in ms before a keepalive packet is sent. O2CB_KEEPALIVE_DELAY_MS=2000 # O2CB_RECONNECT_DELAY_MS: Min. time in ms between connection attempts. O2CB_RECONNECT_DELAY_MS=2000
> tunefs.ocfs2 -Q "Label = %V\nUUID = %U\nNumSlots =%N\n" /dev/sdc1 Label = share_ocfs2 UUID = 74FD5D9EC36F4B5897A47D2F98F8D40D NumSlots =2
> o2info -h > o2info --volinfo /dev/sdc1
> ss -lntp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 64 192.168.2.101:7777 0.0.0.0:*
aptitude install ocfs2-tools ocfs2console
Hole:1 http://de.archive.ubuntu.com karmic/main ocfs2-tools 1.4.2-1 [710kB]
Hole:2 http://de.archive.ubuntu.com karmic/main python-cairo 1.8.6-1ubuntu1 [105kB]
Hole:3 http://de.archive.ubuntu.com karmic/main python-gtk2 2.16.0-0ubuntu1 [1.711kB]
Hole:4 http://de.archive.ubuntu.com karmic/main ocfs2console 1.4.2-1 [107kB]
http://oss.oracle.com/projects/ocfs2/
http://oss.oracle.com/projects/ocfs2/dist/documentation/ocfs2_faq.html
################################################################################
# O2CB - Default cluster stack for the OCFS2 file system.
Damit O2CB problemlos funktioniert, sollte man SELINUX und iptables abschalten
oder wenigstens modifizieren.
Vielleicht wird SELINUX in Zukunft auch unterstützt, wenn das Dateisystem mit
erweiterten Attributen umgehen können wird.
#aptitude install ocfs2-tools ocfs2console
aptitude install ocfs2-tools
Die "cluster.conf" ist auf allen Cluster-Knoten die gleiche:
cp /usr/share/doc/ocfs2-tools/examples/cluster.conf /etc/ocfs2/
vi /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 10.10.10.1
number = 0
name = hostname1.domain.de
cluster = ocfs2cluster
node:
ip_port = 7777
ip_address = 10.10.10.2
number = 1
name = hostname2
cluster = ocfs2cluster
cluster:
node_count = 2
name = ocfs2cluster
mkfs.ocfs2 -L "ocfs2cluster" /dev/sda1
fsck.ocfs2 -f -r 2 /dev/sda1
vi /etc/fstab
/dev/sda1 /dir ocfs2 _netdev 0 0
### O2CB Cluster Timeout Configuration
#
### RedHat
# service o2cb configure
#
### Debian
dpkg-reconfigure ocfs2-tools
/etc/init.d/o2cb start
/etc/init.d/o2cb status
/etc/init.d/ocfs2 start
/etc/init.d/ocfs2 status
ln -s /etc/init.d/o2cb /etc/rc2.d/S98o2cb
ln -s /etc/init.d/o2cb /etc/rc3.d/S98o2cb
ln -s /etc/init.d/o2cb /etc/rc4.d/S98o2cb
ln -s /etc/init.d/o2cb /etc/rc5.d/S98o2cb
ln -s /etc/init.d/o2cb /etc/rc0.d/K01o2cb
ln -s /etc/init.d/o2cb /etc/rc1.d/K01o2cb
ln -s /etc/init.d/o2cb /etc/rc6.d/K01o2cb
ln -s /etc/init.d/ocfs2 /etc/rc2.d/S99ocfs2
ln -s /etc/init.d/ocfs2 /etc/rc3.d/S99ocfs2
ln -s /etc/init.d/ocfs2 /etc/rc4.d/S99ocfs2
ln -s /etc/init.d/ocfs2 /etc/rc5.d/S99ocfs2
ln -s /etc/init.d/ocfs2 /etc/rc0.d/K00ocfs2
ln -s /etc/init.d/ocfs2 /etc/rc1.d/K00ocfs2
ln -s /etc/init.d/ocfs2 /etc/rc6.d/K00ocfs2
#
# ODER
#
#update-rc.d o2cb start 98 2 3 4 5 . stop 01 0 1 6 .
#update-rc.d ocfs2 start 98 2 3 4 5 . stop 01 0 1 6 .
#
# ODER
#
#aptitude install chkconfig lsb-base
#chkconfig -a o2cb
#chkconfig -s o2cb on
#chkconfig -a ocfs2
#chkconfig -s ocfs2 on
################################################################################
To manually enable panic on oops and set a 30 sec timeout for reboot on panic, do:
$ echo 1 > /proc/sys/kernel/panic_on_oops
$ echo 30 > /proc/sys/kernel/panic
To enable the above on every reboot, add the following to /etc/sysctl.conf:
kernel.panic_on_oops = 1
kernel.panic = 30