Bash script to add multiple resources to NFS pacemaker cluster
All,
I'm looking for some guidance on how to accomplish automating the addition of exports to an HA Pacemaker NFS cluster. I would like to do it in bash for logistics reasons.
The resource creation command looks like this:
However, I would like the script to be able to add multiple exports at one time and am trying to figure out the best way to do it. I have been playing around with arrays and can gather 2 of the necessary variables in the command, but there are 4 needed variables:
The rest of the command is pretty static.
Here is a small test script that gathers resource name and clientspec (and puts in order):
As you can see there is a problem with how to define 'directory' and 'fsid'.
Does anyone have any suggestions on how to accomplish this in bash? Any guidance is greatly appreciated.
hello,
During the cluster installation, we are required to enter a cluster name. When this name is used?
I have a shared disk between those 2 nodes. To test NFS failover, what should I do?
PS: I am using VCS 5
thanks (5 Replies)
Hello
I have a directory structure with year in format 4 digits, e.g 2009, below which is month format 1 or 2 digits, e.g 1 or 12, blow which is day format 1 or 2 digits, e.g 1 or 31.
I want to change the names of lots of directories to the be
Year - 4 digits , e.g 2009 - No change here... (4 Replies)
Hello, I am new to the whole "scripting" thing. Below is the script that I have so far and where i need the Variables to go (VAR#)
#!/bin/bash
#Sample Script
VAR1=
echo "Choose an option: 1) Create a file. 2) Delete a file. 3) Move a file."
read VAR1
case $VAR1 in
1)
echo "Pick... (4 Replies)
Hi, I have a bunch of media files in a directory that have been converted (from MTS to MOV format), so my directory contains something like this:
clip1.mts
clip1.mov
clip2.mts
clip2.mov
The problem is that the .mov files that have been created have the timestamps of the conversion task,... (2 Replies)
Hi All,
Need your help to resolve below error in cluter.
Sep 9 05:37:30 node2 rgmanager: Starting disabled service service:Prod_Service
Sep 9 05:37:30 node2 rgmanager: HA LVM: Improper setup detected
Sep 9 05:37:30 node2 rgmanager: * initrd image needs to be newer than lvm.conf... (3 Replies)
I need a help of good people with effective bash script to mount nfs shared,
By the way I did the searches, since i haven't found that someone wrote a script like this in the past, I'm sure it will serve more people.
The scenario as follow:
An NFS Client with Daily CRON , running bash script... (4 Replies)
Hi Everybody,
I'm a newbie to shell scripting, and I'd appreciate some help. I have a bunch of .txt files that have some unwanted content. I want to remove lines 1-3 and 1028-1098.
#!/bin/bash
for '*.txt' in <path to folder>
do
sed '1,3 d' "$f";
sed '1028,1098 d' "$f";
done
I... (2 Replies)
I have 2 VM's setup with a shared VMware disk running RHEL 7.1 (just updated to 7.2 with yum update), and would like to know what is the easiest Fence device to implement for testing purposes. Apparently, I need a fence device before my IP resources will come online.
I have the cluster... (1 Reply)
Discussion started by: mrmurdock
1 Replies
LEARN ABOUT CENTOS
ocf_heartbeat_exportfs
OCF_HEARTBEAT_EXPORT(7) OCF resource agents OCF_HEARTBEAT_EXPORT(7)NAME
ocf_heartbeat_exportfs - Manages NFS exports
SYNOPSIS
exportfs [start | stop | monitor | meta-data | validate-all]
DESCRIPTION
Exportfs uses the exportfs command to add/remove nfs exports. It does NOT manage the nfs server daemon. It depends on Linux specific NFS
implementation details, so is considered not portable to other platforms yet.
SUPPORTED PARAMETERS
clientspec
The client specification allowing remote machines to mount the directory over NFS.
(required, string, no default)
options
The options to pass to exportfs for the exported directory.
(optional, string, no default)
directory
The directory which you wish to export using NFS.
(required, string, no default)
fsid
The fsid option to pass to exportfs. This can be a unique positive integer, a UUID, or the special string "root" which is functionally
identical to numeric fsid of 0. 0 (root) identifies the export as the root of an NFSv4 pseudofilesystem -- avoid this setting unless
you understand its special status. This value will override any fsid provided via the options parameter.
(unique, required, string, no default)
unlock_on_stop
Relinquish NFS locks associated with this filesystem when the resource stops. Enabling this parameter is highly recommended unless the
path exported by this exportfs resource is also exported by a different resource.
(optional, boolean, default 0)
wait_for_leasetime_on_stop
When stopping (unexporting), wait out the NFSv4 lease time. Only after all leases have expired does the NFS kernel server relinquish
all server-side handles on the exported filesystem. If this exportfs resource manages an export that resides on a mount point designed
to fail over along with the NFS export itself, then enabling this parameter will ensure such failover is working properly. Note that
when this parameter is set, your stop timeout MUST accommodate for the wait period. This parameter is safe to disable if none of your
NFS clients are using NFS version 4 or later.
(optional, boolean, default 0)
rmtab_backup
Back up those entries from the NFS rmtab that apply to the exported directory, to the specified backup file. The filename is
interpreted as relative to the exported directory. This backup is required if clients are connecting to the export via NFSv3 over TCP.
Note that a configured monitor operation is required for this functionality.
To disable rmtab backups, set this parameter to the special string "none".
(optional, string, default ".rmtab")
SUPPORTED ACTIONS
This resource agent supports the following actions (operations):
start
Starts the resource. Suggested minimum timeout: 40.
stop
Stops the resource. Suggested minimum timeout: 10.
monitor
Performs a detailed status check. Suggested minimum timeout: 20. Suggested interval: 10.
meta-data
Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5.
validate-all
Performs a validation of the resource configuration. Suggested minimum timeout: 30.
EXAMPLE
The following is an example configuration for a exportfs resource using the crm(8) shell:
primitive p_exportfs ocf:heartbeat:exportfs
params
clientspec=string
directory=string
fsid=string
op monitor depth="0" timeout="20" interval="10"
SEE ALSO
http://www.linux-ha.org/wiki/exportfs_(resource_agent)
AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors)
resource-agents UNKNOWN 06/09/2014 OCF_HEARTBEAT_EXPORT(7)