Riccardo Murri
unread,Mar 6, 2020, 4:06:57 AM3/6/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to smahane douyeb, elasticluster
Hello Smahane,
as far as I understand from reading the docs (never used GCP's
"Filestore" myself, yet), the filestore is made available to VMs like
a normal NFS filesystem.
So you have several options to mount it; for example to mount it on
directory `/data` on a running cluster:
pdsh -a sudo mkdir -p /data
pdsh -a sudo mount -t nfs 1.2.3.4:/filestorename /data
This only works "temporarily" in that the mount point disappears at
reboot; you need to edit `/etc/fstab` for it to be permanent.
To have a more permanent solution that can be re-used across clusters,
it's better to write a small Ansible playbook; like the following
(enclosed in "```" markers).
```
- name: Mount volume on head node
tags:
- after
- local
hosts: all
vars:
# mount point for the filesystem
mountpoint: '/data'
# IP address of filestore endpoint
filestore_server: 1.2.3.4
# filestore endpoint name
filestore_name: foobar
tasks:
- name: Ensure mountpoint directory exists
file:
dest: '{{ mountpoint }}'
state: directory
- name: Mount filesystem
mount:
path: '{{ mountpoint }}'
src: '{{ filestore_server }}:/{{ filestore_name }}'
fstype: nfs
state: mounted
```
You can then run this playbook on all cluster nodes via:
elasticluster setup my-cluster-name -- /path/to/playbook/file.yml
Hope this helps!
Riccardo