Moosefs on Carp

From Rodovid Engine

Jump to: navigation, search

Contents

[edit] /etc/rc.conf

  • both
cloned_interfaces="... carp253"
  • master
ifconfig_carp253="vhid 253 advskew 1 pass PASSWORD253 172.16.0.253 netmask 255.255.255.0"
  • logger
ifconfig_carp253="vhid 253 advskew 100 pass PASSWORD253 172.16.0.253 netmask 255.255.255.0"

[edit] /usr/local/etc/mfsmaster.cfg

WORKING_USER = mfs
# WORKING_GROUP = 
# SYSLOG_IDENT = mfsmaster
# LOCK_MEMORY = 0
# NICE_LEVEL = -19

# EXPORTS_FILENAME = /usr/local/etc/mfsexports.cfg

DATA_PATH = /mfs/master

# BACK_LOGS = 50

# REPLICATIONS_DELAY_INIT = 300
# REPLICATIONS_DELAY_DISCONNECT = 3600

MATOML_LISTEN_HOST = 172.16.0.253
# MATOML_LISTEN_PORT = 9419

MATOCS_LISTEN_HOST = 172.16.0.253
# MATOCS_LISTEN_PORT = 9420

MATOCU_LISTEN_HOST = 172.16.0.253
# MATOCU_LISTEN_PORT = 9421

# CHUNKS_LOOP_TIME = 300
# CHUNKS_DEL_LIMIT = 100
# CHUNKS_WRITE_REP_LIMIT = 1
# CHUNKS_READ_REP_LIMIT = 5

# REJECT_OLD_CLIENTS = 0

# deprecated, to be removed in MooseFS 1.7
# LOCK_FILE = /var/run/mfs/mfsmaster.lock

NB: before first run on first master cp metadata.mfs.empty metadata.mfs

[edit] /usr/local/etc/mfsmetalogger.cfg

WORKING_USER = mfs
# WORKING_GROUP = 
# SYSLOG_IDENT = mfsmetalogger
# LOCK_MEMORY = 0
# NICE_LEVEL = -19

DATA_PATH = /mfs/logger

# BACK_LOGS = 50
# META_DOWNLOAD_FREQ = 24

# MASTER_RECONNECTION_DELAY = 5

# MASTER_HOST = mfsmaster
# MASTER_PORT = 9419

# MASTER_TIMEOUT = 60

# deprecated, to be removed in MooseFS 1.7
# LOCK_FILE = /var/run/mfs/mfsmetalogger.lock

[edit] /root/bin/carp/mfs.make.me.sh

#!/bin/sh

log_event() {
    logger -s -p kern.warning -t "`basename $0`[$WHO]" $1
}

PREFIX=/usr/local/sbin
SCRIPTDIR=/usr/local/etc/rc.d
MFSDIR=/mfs

MDATA=$MFSDIR/master/metadata.mfs
LDATA=$MFSDIR/logger/metadata_ml.mfs

WHO=$1
case "$WHO" in
    "master")
        $SCRIPTDIR/mfsmetalogger onestop
        if [ -f $LDATA.back ]; then
            LCHECK=$LDATA.back
        else
            LCHECK=$LDATA
        fi
        if [ -f $MDATA.back ]; then
            MCHECK=$MDATA.back
        else
            MCHECK=$MDATA
        fi
        if [ $LCHECK -nt $MCHECK -o ! -d $MFSDIR/master ]; then
            log_event "Last time work as metalogger"
            if [ -d $MFSDIR/master ]; then
                NF=$MFSDIR/master.`date "+%Y%m%d.%H%M"`
                log_event "Backup old master metadata to $NF..."
                mv -f $MFSDIR/master $NF
            fi
            log_event "Restoring logger metadata..."
            $PREFIX/mfsmetarestore -a -d $MFSDIR/logger
            log_event "Moving logger metadata to master metadata..."
            mv $MFSDIR/logger $MFSDIR/master
        else
            log_event "Last time work as master"
        fi
        if [ -f $MDATA.back -a ! -f $MDATA ]; then
                $PREFIX/mfsmetarestore -a -d $MFSDIR/master
        fi
        $SCRIPTDIR/mfsmaster onestart # NO mfsmaster_enable="YES" in rc.conf
        ;;
    "logger")
        /usr/local/etc/rc.d/mfsmaster onestop
        mkdir $MFSDIR/logger
        chown mfs:mfs $MFSDIR/logger
        $SCRIPTDIR/mfsmetalogger onestart # NO mfsmetalogger="YES" in rc.conf
        ;;
    *)
        log_event "Usage: `basename $0` <master|logger>"
        ;;
esac
  • chmod 770 /root/bin/carp/mfs.make.me.sh

[edit] /usr/local/etc/devd/mfsmaster.carp.conf

notify 30 {
	match "system" "IFNET";
	match "subsystem" "carp253";
	match "type" "LINK_UP";
	action "/root/bin/carp/mfs.make.me.sh master";
};
notify 30 {
	match "system" "IFNET";
	match "subsystem" "carp253";
	match "type" "LINK_DOWN";
	action "/root/bin/carp/mfs.make.me.sh logger";
};
restart /etc/rc.d/devd

[edit] last step

on master then on logger

reboot

OR

ifconfig carp253 create ...
Personal tools
Джерельна довідка за населеним пунктом