This repository contains code to deploy a two node OCFS2 cluster on Google Cloud using multi-writer persistent disks.
To deploy the demo:
Create a new Google Cloud project
Open the Cloud Shell for your project and clone the demo repository:
git clone https://github.com/zencore-dev/gcp-pd-multiwriter.gitChange into the terraform code directory:
cd gcp-pd-multiwriter/terraformRun Terraform:
terraform init
terraform applyAccess each instance via SSH and run the following commands on both:
# switch to root
sudo -i
# Install the OCFS2 tools and kernel module for the current kernel version:
GCP_KERNEL_VERSION=$(uname -r)
apt install -y ocfs2-tools linux-modules-extra-${GCP_KERNEL_VERSION}Run the following command in the first instance only, to format the filesystem:
mkfs.ocfs2 -b 4k -C 32K -L "ocfs2" -N 2 /dev/sdbRun the following commands on both instances:
mkdir /data
dpkg-reconfigure ocfs2-toolsChoose Yes to enable OCFS2 at startup. Accept defaults for the other questions.
Edit /etc/ocfs2/cluster.conf on both VMs and configure the node definitions:
nano /etc/ocfs2/cluster.confAdd the following to the file:
node:
ip_port = 7777
ip_address = 10.0.0.2
number = 1
name = nas-1
cluster = ocfs2
node:
ip_port = 7777
ip_address = 10.0.0.3
number = 2
name = nas-2
cluster = ocfs2
cluster:
node_count = 2
name = ocfs2
Finally, register the cluster and mount the shared disk:
o2cb register-cluster ocfs2
mount /dev/sdb /dataYou should have a shared filesystem mounted at /data on both instances.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.