From owner-freebsd-questions@FreeBSD.ORG Wed May 13 22:04:44 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72951BCC for ; Wed, 13 May 2015 22:04:44 +0000 (UTC) Received: from mail-pa0-x22c.google.com (mail-pa0-x22c.google.com [IPv6:2607:f8b0:400e:c03::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FEC41CF6 for ; Wed, 13 May 2015 22:04:44 +0000 (UTC) Received: by pabsx10 with SMTP id sx10so63138832pab.3 for ; Wed, 13 May 2015 15:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=rqGXnqj21EvhW/6Egps+6J0cJtUxzPFl1TlYYntoHKU=; b=SD+5xGGV1e5Wj/s0vmJNcEyeh8ViTWuMlMDLIYZud3fuhYM1EN7U09Kx20XuBEeSFJ cCitsz4YRea5IDAmx/amJDEhSMA3+A0/oypjfdzO2xO4gQRbwLVOsdPIn6s0fMFYPkPj zLSCLFS5MAooifpKsBzCJIL1GFwFUbZQ0tuaYduEj+Sk3tyLXdnmTmZbxRI7V0Ew4aC1 WcG021SopduX4DDXFzHEfP2lPHGlQvni646BGwD0wNk1kaHle8xWzRuO/zRDyu/16SxF WZTBxd/Y5puNjGbq1XboEuMbmfscQNSdZbiMlk1pW6RDNAJez/ErTATSsYNEcnAIr7MX hSLA== X-Received: by 10.70.52.103 with SMTP id s7mr1782564pdo.117.1431554683756; Wed, 13 May 2015 15:04:43 -0700 (PDT) Received: from [192.168.125.221] (aswan.sscsinc.com. [199.96.38.41]) by mx.google.com with ESMTPSA id v3sm20255031pbs.18.2015.05.13.15.04.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 15:04:42 -0700 (PDT) Message-ID: <5553CA79.60104@gmail.com> Date: Wed, 13 May 2015 15:04:41 -0700 From: Motty Cruz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Konstantin Kukushkin CC: =?UTF-8?B?VHJvbmQgRW5kcmVzdMO4bA==?= , freebsd-questions@freebsd.org Subject: Re: Help! carp slave take over as master at boot! References: <55511AF3.3030408@gmail.com> <55531870.9060607@rambler-co.ru> <5553C041.7050903@rambler-co.ru> In-Reply-To: <5553C041.7050903@rambler-co.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2015 22:04:44 -0000 Thanks for your reply; I disabled preempt on both machines: # net.inet.carp.preempt=1 # sysctl -a | grep "preempt" kern.sched.preemption: 1 kern.sched.preempt_thresh: 80 net.inet.carp.preempt: 0 Machine B(slave) does take over as Master whenever Machine A(master) dies; However, when Machine A (master) boot up it takes over as Master; I would like for a Master to stay Master as long as it lives. Thanks, Motty On 05/13/2015 02:21 PM, Konstantin Kukushkin wrote: > 13.05.2015 20:58, motty cruz пишет: >> Hello Konstantin >> >> This is a new setup; my goal is to have a redundant "file server"; if >> "Machine A(master) goes down or just reboot for any reason, I want >> Machine B(slave) to take over as Master and I want Machine (B slave) to >> stay Master when Machine A come back on-line. >> >> Here is what I have thus far: >> Machine A (master) >> ifconfig_igb0_alias0="inet vhid 31 advbase 12 advskew 40 pass password2 >> 19.16.31.80/24 " >> >> Machine B (slave) >> ifconfig_igb0_alias0="inet vhid 31 advbase 12 advskew 80 pass password2 >> 19.16.31.80/24 " >> both machines: /etc/sysctl.conf >> # net.inet.carp.preempt=1 >> >> (Machine A ) /etc/devd.conf >> ##### Check status of CARP interface ######## >> notify 5 { >> match "system" "CARP"; >> match "subsystem" "[0-9]+@[0-9a-z]+"; >> match "type" "(MASTER)"; >> action "/usr/local/sbin/startmaster.pl >> "; >> }; >> >> notify 5 { >> match "system" "CARP"; >> match "type" "[0-9]+@[0-9a-z]+"; >> match "subsystem" "(BACKUP)"; >> action "/usr/local/sbin/slave.sh"; >> }; >> >> >> (Machine B) /etc/devd.conf >> ### Check status of CARP interface ### >> notify 5 { >> match "system" "CARP"; >> match "subsystem" "[0-9]+@[0-9a-z]+"; >> match "type" "(MASTER)"; >> action "/usr/local/sbin/startmaster.pl >> "; >> }; >> >> >> >> notify 5 { >> match "system" "CARP"; >> match "type" "[0-9]+@[0-9a-z]+"; >> match "subsystem" "(BACKUP)"; >> action "/usr/local/sbin/slave.sh"; >> }; >> >> if Master machine reboots, I want slave to take over as Master and stay >> Master even after Machine with lowest advskew come back online. >> >> any ideas? > > If you want address switched only if neighbour is died you need to > take carp preemtion off, i.e. net.inet.carp.preempt=0 on both machines. > Explanation from carp(4): > net.inet.carp.preempt - Allow virtual hosts to preempt each other. > When enabled, a vhid in a backup state would preempt a master that is > announcing itself with a lower advskew. Disabled by default. > > Enabling this option need for setup where one server main and another > server for fallback, working if (and only if) main server is died. > > Pay attention that carp detect that neighbour is died if 3 packet was > lost, so on your setup "switch" time will be between 36 and 48 seconds. > >> Thanks, >> Motty >> >> >> >> On Wed, May 13, 2015 at 2:25 AM, Konstantin Kukushkin >> > wrote: >> >> 13.05.2015 04:19, motty cruz пишет: >> >> Hi thanks for your reply; >> >> Machine A (master) >> ifconfig_igb0_alias0="inet vhid 31 advbase 12 advskew 40 pass >> password2 >> 19.16.31.80/24 " >> >> Machine B (slave) >> ifconfig_igb0_alias0="inet vhid 31 advbase 12 advskew 80 pass >> password2 >> 19.16.31.80/24 " >> >> if I reboot slave, on boot it takes over as Master, any idea >> why? >> both machines: /etc/sysctl.conf >> # net.inet.carp.preempt=1 >> >> >> I don't understand master was rebooted so check runtime >> configuration of sysctl net.inet.carp.preempt on master. >> Check also /var/log/messages on both computers, sysctl >> net.inet.carp.demotion on master (CARP may be demoted due to >> interface/pfsync errors. CARP with preemption may be demoted also by >> down any other interface with CARP on the system). >> Check firewall on slave, may be it block ingress packets from >> master. >> >> >> On Mon, May 11, 2015 at 10:45 PM, Trond Endrestøl < >> Trond.Endrestol@fagskolen.gjovik.no >> > wrote: >> >> On Mon, 11 May 2015 14:11-0700, Motty Cruz wrote: >> >> Hello, I have two machines running FreeBSD 10.1 Release. >> Machine A is the >> master in Carp with advskew 20 and Machine B slave with >> advskew 200 both >> >> are >> >> set to advbase 10. however, slave machine becomes Master >> on boot; >> >> my questions is, how do I configure both machines so if >> reboot any of the >> machines whatever machine is Master stays master if >> secondary machine >> >> reboot. >> >> You should augment your posting with facts. You may >> withhold any >> sensitive information such as IP addresses, but a copy of >> the relevant >> lines from /etc/rc.conf and /etc/sysctl.conf would be >> helpful. >> >> Have you tried setting: >> >> net.inet.carp.preempt=1 >> >> in /etc/sysctl.conf? >> >> Try the command: >> >> sysctl net.inet.carp.preempt=1 >> >> to see any immediate effect. >> >> -- >> +-------------------------------+------------------------------------+ >> | Vennlig hilsen, | Best regards, >> | >> | Trond Endrestøl, | Trond Endrestøl, >> | >> | IT-ansvarlig, | System administrator, >> | >> | Fagskolen Innlandet, | Gjøvik Technical College, >> Norway, | >> | tlf. mob. 952 62 567, | Cellular...: +47 952 62 >> 567 , | >> | sentralbord 61 14 54 00. | Switchboard: +47 61 14 54 >> 00 . | >> +-------------------------------+------------------------------------+ >> >> >> >> -- >> С уважением, Константин Кукушкин, >> Rambler Internet Holding >> mailto:dark@rambler-co.ru >> тел.: 8 (495) 785-17-00#2129 >> >> >> >> >> -- >> Thanks for your support, >> Motty > >