Re: [Keepalived-devel] Start keepalived without IP on interface?
Status: Beta
Brought to you by:
acassen
|
From: Quentin A. <qu...@ar...> - 2018-06-29 17:16:21
|
Paul,
There seems to be a bug with the creating of pid file names; I'll have
a look at it.
I can't see any advantage in running different instances of keepalived
for each interface; I think it just complicates things. keepalived has
been tested running with 500 vrrp instances and that works fine.
Quentin
On Fri, 2018-06-29 at 17:14 +0100, Paul Gildea wrote:
> Hi,
> I've tried v2.0.5 and that worked great for my interface not having
> an IP, keepalived starts in a FAULT state and moves to MASTER when it
> gets an IP, great, thanks!
>
> For the other issue, I retested on v2.0.5 and got logs this time
> which indicate I couldn't run a second daemon for some reason:
>
> paul@paul:/etc$ sudo keepalived -f /etc/keepalived2.conf -l -n -p
> /var/run/test.pid
> Fri Jun 29 17:06:41 2018: Starting Keepalived v2.0.5 (06/29,2018)
> Fri Jun 29 17:06:41 2018: WARNING - keepalived was build for newer
> Linux 3.13.11, running on Linux 3.13.0-30-generic #55-Ubuntu SMP Fri
> Jul 4 21:40:53 UTC 2014
> Fri Jun 29 17:06:41 2018: Opening file '/etc/keepalived2.conf'.
> Fri Jun 29 17:06:41 2018: daemon is already running
>
> I was thinking of having a keepalive daemon running for every
> interface (up a dozen interfaces or more) and each would have it's
> own config file. Maybe everything should be in one config/daemon
> instance.
> I'll look into your above suggestion to try and understand it better,
> thanks!
>
> --
> Paul
> On 29 June 2018 at 15:34, Quentin Armitage <qu...@ar...>
> wrote:
> > Paul,
> >
> > Yes it should be possible to run more than one instance of
> > keepalived on the same host, and certainly specifying a separate
> > pid file iswhat is needed. There is a complication though if you
> > want to open the same socket (e.g. raw socket protocol 112) on the
> > same device.
> >
> > What I do to run more than one instance of keepalived on the same
> > host is to use network namespaces. The script test/mk_if will add
> > dummy interfaces in network namespaces high, medium and low. If you
> > run it as test/mk_if add 0 10, it will add eth0..eth9 in high,
> > medium and low, with the eth0s connected, etc (use interface br0
> > etc in medium).
> >
> > If your keepalived configuration file add:
> > @high net_namespace high
> > @medium net_namespace medium
> > @low net_namespace low
> >
> > And when you run keepalived, specify -i high or -i low to say which
> > namespace you want to be in (you won't need to specify the pid
> > files if you use -i).
> >
> > @high etc is conditional configuration, and a line starting @high
> > will only be used if -i high has been specified. @^high ... means
> > include if not high.
> >
> > You can also do things such as in a vrrp instance:
> > @high priority 100
> > @medium priority 90
> > @low priority 80
> >
> > so that the same configuration file can be used on multiple
> > systems.
> >
> > I hope this helps,
> >
> > Quentin
> >
> > P.S. Instread of --dont-fork and --log-console you might like to
> > use -gLOG_FILE -G --flush-log-file and then you could do tail -f
> > LOG_FILE (the log files are created with _vrrp, _check, _bfd and
> > high/medium/low (i.e. what is specified with -i ) added to their
> > names).
> >
> > On Fri, 2018-06-29 at 15:18 +0100, Paul Gildea wrote:
> > > Thanks Quentin, I'll download and try that. Seems
> > > promising.Another question, is it possible to run multiple
> > > instances of the keepalive daemon on the same host? I tried
> > > setting a pidfile for it and the command seemed to take (no
> > > errors), however the second instance didn't start and there were
> > > no logs printed.
> > >
> > >
> > > paul@paul:/etc$ keepalived -f /etc/keepalived2.conf --dont-fork
> > > --log-console -p /var/run/test.pid
> > > paul@paul:/etc$
> > > paul@paul:/etc$ ps ax | grep keep
> > > 18248 pts/39 Z 0:00 [keepalived] <defunct>
> > > 21726 ? Ss 0:00 /usr/sbin/keepalived -f
> > > /etc/keepalived.conf
> > > 21727 ? S 0:00 /usr/sbin/keepalived -f
> > > /etc/keepalived.conf
> > > 21728 ? S 0:00 /usr/sbin/keepalived -f
> > > /etc/keepalived.conf
> > >
> > >
> > > --
> > > Paul
> > >
> > >
> > > On 29 June 2018 at 12:10, Quentin Armitage <qu...@ar....
> > > uk> wrote:
> > > > Can you try keepalived v2.0.5. The version 2.0.x series
> > > > supports "dynamic" interfaces, in other words using an
> > > > interface that doesn't exist when keepalived starts, but is
> > > > subsequently created. You might need to add the keyword
> > > > "dynamic_interfaces" in the global_defs section of your
> > > > configuration.
> > > > To be honest, I'm not sure if it will work, since I have never
> > > > thought about this situation. If it doesn't work, then I think
> > > > keepalived should be modified so that the vrrp instance is in
> > > > fault state until the underlying interface has an address.
> > > > Quentin Armitage
> > > > On Fri, 2018-06-29 at 11:02 +0100, Paul Gildea wrote:
> > > > > I'm new to keepalived. I want to use keepalived on an
> > > > > interface that will get an IP at some point but will not have
> > > > > one initially, can I set this up somehow in the config? If I
> > > > > try to start it now keepalived errors out as keepalived
> > > > > doesn't know what source IP address to use when sending VRRP
> > > > > packets. If this is not possible I presume I could set up a
> > > > > dummy IP and remove it after keepalived starts or script
> > > > > keepalived to start after the interface gets a valid IP, just
> > > > > wondering is it possible to start without said IP and I just
> > > > > can't find out how to do it.
> > > > >
> > > > > Conf:
> > > > >
> > > > > ! Configuration File for keepalived
> > > > >
> > > > > vrrp_instance VI_1 {
> > > > > state MASTER
> > > > > interface eth0
> > > > > virtual_router_id 51
> > > > > priority 150
> > > > > advert_int 1
> > > > > authentication {
> > > > > auth_type PASS
> > > > > auth_pass pwd
> > > > > }
> > > > > virtual_ipaddress {
> > > > > 192.168.0.13
> > > > > }
> > > > > notify /etc/state_change.py
> > > > > }
> > > > >
> > > > > Log:
> > > > >
> > > > > keepalived -f /etc/keepalived.conf --log-console --dont-
> > > > > fork
> > > > > Thu Jun 28 11:25:53 2018: Starting Keepalived v1.4.4
> > > > > (05/08,2018)
> > > > > Thu Jun 28 11:25:53 2018: Running on Linux 4.7.8 #9 SMP
> > > > > Wed Jun 27 17:25:18 IST
> > > > > 2018 (built for Linux 4.7.8)
> > > > >
> > > > > Thu Jun 28 11:25:53 2018: Opening file
> > > > > '/etc/keepalived.conf'.
> > > > > Thu Jun 28 11:25:53 2018: Starting Healthcheck child
> > > > > process, pid=18886
> > > > > Thu Jun 28 11:25:53 2018: Starting VRRP child process,
> > > > > pid=18887
> > > > > Thu Jun 28 11:25:53 2018: Opening file
> > > > > '/etc/keepalived.conf'.
> > > > > Thu Jun 28 11:25:53 2018: Registering Kernel netlink
> > > > > reflector
> > > > > Thu Jun 28 11:25:53 2018: Registering Kernel netlink
> > > > > command channel
> > > > > Thu Jun 28 11:25:53 2018: Registering gratuitous ARP
> > > > > shared channel
> > > > > Thu Jun 28 11:25:53 2018: Opening file
> > > > > '/etc/keepalived.conf'.
> > > > > Thu Jun 28 11:25:53 2018: WARNING - default user
> > > > > 'keepalived_script' for script
> > > > > execution does not exist - please create.
> > > > >
> > > > > Thu Jun 28 11:25:53 2018: (VI_1): Cannot find an IP
> > > > > address to use for interface
> > > > > eth0
> > > > >
> > > > > Thu Jun 28 11:25:54 2018: Stopped
> > > > >
> > > > > Thu Jun 28 11:25:54 2018: Keepalived_vrrp exited with
> > > > > permanent error CONFIG. Te
> > > > > rminating
> > > > >
> > > > > Thu Jun 28 11:25:54 2018: Stopping
> > > > >
> > > > > Thu Jun 28 11:25:54 2018: Stopped
> > > > >
> > > > > Thanks,
> > > > >
> > > > > --
> > > > > Paul
> > > > >
> > > > > -----------------------------------------------------------
> > > > > -------------------
> > > > > Check out the vibrant tech community on one of the world's
> > > > > most
> > > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot__
> > > > > _____________________________________________
> > > > > Keepalived-devel mailing list
> > > > > Kee...@li...
> > > > > https://lists.sourceforge.net/lists/listinfo/keepalived-devel |