Score:0

What is the simplest way to set up shared/clustered read-write filesystem across servers?

ht flag

What is the simplest way to set up shared/clustered read-write POSIX-compliant filesystem across servers where performance is not a major concern?

Suppose I have two Linux servers S1 and S2 and an uninitialized (no filesystem) block device /dev/sdb.

Note: self-answered question.

A.B avatar
cl flag
A.B
Maybe you should have presented this question as a [question with its answer made by the same person](https://serverfault.com/help/self-answer "Can I answer my own question?"). Because the question looks rhetorical (or not a good question by asking "for the best").
otujuhxv avatar
ht flag
@A.B I split my question and "answer". I am a beginner and my answer is still very complex for me. Is there no easier way?
A.B avatar
cl flag
A.B
I can just tell that compared to RHEL's GFS2 where every documentation tells you have to configure corosync (and possibly pacemaker and fencing) this appears easier.
otujuhxv avatar
ht flag
@A.B I was hoping there is a simpler way where the filesystem would simply block if there is an active write (concurrency not required).
otujuhxv avatar
ht flag
I think NFS would work for my case too. It'll be slower, but acceptable.
Score:2
ht flag

OCFS2 is POSIX-compliant and "simple" to set up, I tried it and it works:

apt-get update
apt-get install -y ocfs2-tools

# Only step that needs to be done once on any node
mkfs.ocfs2 /dev/sdb

# Hostname MUST be correct or else it doesn't work
o2cb add-cluster CLUSTER_NAME
o2cb add-node CLUSTER_NAME S1_HOSTNAME --ip S1_PRIVATE_IP
o2cb add-node CLUSTER_NAME S2_HOSTNAME --ip S2_PRIVATE_IP

# Manually copy /etc/ocfs2/cluster.conf to all other nodes

# On all nodes, need to run this to set CLUSTER_NAME as default
# This can be skipped if using "ocfs2" (default cluster name)
# dpkg-reconfigure ocfs2-tools

# On all nodes (required)
echo "kernel.panic_on_oops = 1" > /etc/sysctl.conf
echo "kernel.panic = 30" > /etc/sysctl.conf

# On all nodes:
# Enable port 7777 (used by OCFS2 heartbeats) in firewall

# On all nodes
service o2cb online

# On all nodes
mkdir -p /mnt/shared
echo "/dev/sdb /mnt/shared ocfs2 defaults 0 0" >> /etc/fstab
mount -a

This is as simple as it gets for setting up a shared read-write POSIX-compliant filesystem on two or more servers. Nearly all steps need to be run on each node. And if a new node is added to the cluster, all nodes need to be updated with o2cb add-node CLUSTER_NAME SX_HOSTNAME --ip SX_PRIVATE_IP.

This also uses local heartbeat by default, which is supposedly easier to setup than global heartbeat.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.