ZFS Networker: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 2: Line 2:
[[Kategorie:Solaris]]
[[Kategorie:Solaris]]
=Backup of ZFS snapshots on Solaris Cluster with Legato/EMC Networker=
=Backup of ZFS snapshots on Solaris Cluster with Legato/EMC Networker=
This describes how to setup a backup of the Solaris Cluster resource group named sample-rg.


First of all:
The structure of my RGs is always:
<pre>
RG:                <name>-rg
ZFS-HASP:          <name>-hasp-zfs-res
Logical Host:      <name>-lh-res
Logical Host Name: <name>-lh
ZPOOL:            <name>_pool
</pre>
 
I used the bash as shell.
 
==Define variables used in the following command lines==
<source lang=bash>
# NAME=sample
# RGname=${NAME}-rg
# NetworkerGroup=$(echo ${NAME} | tr 'a-z' 'A-Z' )
# ZPOOL=${NAME}_pool
# ZPOOL_BASEDIR=/local/${RGname}
</source>
 
==Define a resource for Networker==
What we need now is a resource definition in our Networker directory like this:
<source lang=bash>
# zfs create ${ZPOOL}/nsr
# mkdir ${ZPOOL_BASEDIR}/nsr/{bin,log,res}
 
# cat > /local/${RGname}/nsr/res/${NetworkerGroup}.res <<EOF
type: savepnpc;
precmd: "/local/${RGname}/nsr/bin/networker_precmd.sh >/local/${RGname}/nsr/log/networker_precmd.log 2>&1";
pstcmd: "/local/${RGname}/nsr/bin/networker_pstcmd.sh >/local/${RGname}/nsr/log/networker_pstcmd.log 2>&1";
timeout: "12:00pm";
abort precmd with group: Yes;
EOF
</source>
 
And now create a link on every node to this file
<source lang=bash>
# ln -s /local/${RGname}/nsr/res/${NetworkerGroup}.res /nsr/res/${NetworkerGroup}.res
</source>
 
 
 
==Registering new resource type LGTO.clnt==
1. Install Solaris client package LGTOclnt
1. Install Solaris client package LGTOclnt
2. Register new resource type in cluster. One one node do:
2. Register new resource type in cluster. One one node do:
Line 11: Line 54:
Now you have a new resource type LGTO.clnt in your cluster.
Now you have a new resource type LGTO.clnt in your cluster.


 
==Create client resource of type LGTO.clnt==
 
The structure of my RGs is always:
<pre>
RG:                <name>-rg
ZFS-HASP:          <name>-hasp-zfs-res
Logical Host:      <name>-lh-res
Logical Host Name: <name>-lh
</pre>


So I use scripts like this:
So I use scripts like this:
Line 47: Line 82:


Now we have a client name to which we can connect: sample-lh
Now we have a client name to which we can connect: sample-lh
What we need now is a resource definition in our Networker directory like this:
<source lang=bash>
# cat /nsr/res/sample.res
type: savepnpc;
precmd: "/local/sample-rg/nsr/networker_precmd.sh >/local/sample-rg/nsr/networker_precmd.log 2>&1";
pstcmd: "/local/sample-rg/nsr/networker_pstcmd.sh >/local/sample-rg/nsr/networker_pstcmd.log 2>&1";
timeout: "12:00pm";
abort precmd with group: Yes;
</source>
Of course our sample.res is just a link:
<source lang=bash>
# ls -al /nsr/res/sample.res
lrwxrwxrwx  1 root    root          40 Sep  5  2014 /nsr/res/sample.res -> /local/sample-rg/nsr/res/sample.res
</source>
So we have no need to copy it to every node. But we need the link on every node!

Revision as of 10:20, 15 September 2014

Kategorie:ZFS Kategorie:Solaris

Backup of ZFS snapshots on Solaris Cluster with Legato/EMC Networker

This describes how to setup a backup of the Solaris Cluster resource group named sample-rg.

The structure of my RGs is always:

RG:                <name>-rg
ZFS-HASP:          <name>-hasp-zfs-res
Logical Host:      <name>-lh-res
Logical Host Name: <name>-lh
ZPOOL:             <name>_pool

I used the bash as shell.

Define variables used in the following command lines

# NAME=sample
# RGname=${NAME}-rg
# NetworkerGroup=$(echo ${NAME} | tr 'a-z' 'A-Z' )
# ZPOOL=${NAME}_pool
# ZPOOL_BASEDIR=/local/${RGname}

Define a resource for Networker

What we need now is a resource definition in our Networker directory like this:

# zfs create ${ZPOOL}/nsr
# mkdir ${ZPOOL_BASEDIR}/nsr/{bin,log,res}

# cat > /local/${RGname}/nsr/res/${NetworkerGroup}.res <<EOF
type: savepnpc;
precmd: "/local/${RGname}/nsr/bin/networker_precmd.sh >/local/${RGname}/nsr/log/networker_precmd.log 2>&1";
pstcmd: "/local/${RGname}/nsr/bin/networker_pstcmd.sh >/local/${RGname}/nsr/log/networker_pstcmd.log 2>&1";
timeout: "12:00pm";
abort precmd with group: Yes;
EOF

And now create a link on every node to this file

# ln -s /local/${RGname}/nsr/res/${NetworkerGroup}.res /nsr/res/${NetworkerGroup}.res


Registering new resource type LGTO.clnt

1. Install Solaris client package LGTOclnt 2. Register new resource type in cluster. One one node do:

# clrt register -f /usr/sbin/LGTO.clnt.rtr LGTO.clnt

Now you have a new resource type LGTO.clnt in your cluster.

Create client resource of type LGTO.clnt

So I use scripts like this:

# RGname=sample-rg
# clrs create \
  -t LGTO.clnt \
  -g ${RGname} \
  -p Resource_dependencies=$(basename ${RGname} -rg)-hasp-zfs-res \
  -p clientname=$(basename ${RGname} -rg)-lh \
  -p Network_resource=$(basename ${RGname} -rg)-lh-res \
  -p owned_paths=/local/${RGname} \
  $(basename ${RGname} -rg)-nsr-res

This expands to:

# clrs create \
  -t LGTO.clnt \
  -g sample-rg \
  -p Resource_dependencies=sample-hasp-zfs-res \
  -p clientname=sample-lh \
  -p Network_resource=sample-lh-res \
  -p owned_paths=/local/sample-rg \
  sample-nsr-res

Now we have a client name to which we can connect: sample-lh