File: migrate-unify-to-distribute.sh

package info (click to toggle)
glusterfs 3.2.7-3%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 16,884 kB
  • sloc: ansic: 195,466; sh: 9,573; python: 1,564; makefile: 587; yacc: 471; lisp: 124; lex: 69
file content (36 lines) | stat: -rwxr-xr-x 1,110 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

#
# This is a template script which can be used to migrate the GlusterFS
# storage infrastructure from 'cluster/unify' to 'cluster/distribute'

# This script needs to be executed on the machine where namespace volume 
# of 'cluster/unify' translator resides. And also, one need to mount the 
# new 'cluster/distribute' volume with "option lookup-unhashed yes" on 
# the same machine.
# If the namespace volume was replicated (ie, afr'ed), then this can be 
# executed just on one of the namespace machines..

# Only the variables defined below needs to be changed to appropriate path

# This is export from old 'cluster/unify' volume's namespace volume.
namespace_export=/exports/export-ns
namespace_host=localhost

# This is the new mount point with 'cluster/distribute' volume
distribute_mount=/mnt/glusterfs

function execute_on()
{
    local node="$1"
    local cmd="$2"

    if [ "$node" = "localhost" ]; then
        $cmd
    else
        ssh "$node" sh -c "$cmd"
    fi
}

execute_on $namespace_host "cd ${namespace_export} && find ." |
(cd ${distribute_mount} && xargs -d '\n' stat -c '%n')