Hello Everyone,
I was wondering if anyone might be able to help me out with setting up Keepalived on Ubuntu 16. I went ahead and followed the tutorial here on Digital Ocean but when I run sudo start keepalived I get an error saying that start isnt a recognized command.
I am having a hard time finding other resources but I suspect that I either need to use different command to start keepalived, or I need to modify the tutorial in some way.
Any help or advice would greatly be appreciated!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
So I finally got things working. I wanted to write down what it was I needed to do to get things to running so hopefully anyone with a similar issue doesn’t have to sink in as much time as I did.
I thought all you needed to do to enable private networking on my droplets was just click on the button in the control panel. Turns out there is a bit more work involved, you can see what you need to do here: https://www.google.com/search?q=enabling+private+neworking+on+digiatal+ocean&ie=utf-8&oe=utf-8&client=firefox-b
Make sure you are downloading the latest version of keepalived. The version currently listed in the tutorial has a bug in it that prevents it from running the master.sh script. As of me writing this the newest version is 1.2.23. Just check here to see what latest version is:
http://www.keepalived.org/download.html
apt-get install python-pip export LC_ALL=C pip install requests
sudo nano /etc/systemd/system/keepalived.service
Then I copied the following into the file, saved and closed it on both droplets
#
# keepalived control files for systemd
#
# Incorporates fixes from RedHat bug #769726.
[Unit]
Description=LVS and VRRP High Availability monitor
After=network.target
ConditionFileNotEmpty=/etc/keepalived/keepalived.conf
[Service]
Type=simple
# Ubuntu/Debian convention:
EnvironmentFile=-/etc/default/keepalived
ExecStart=/usr/local/sbin/keepalived --dont-fork
ExecReload=/bin/kill -s HUP $MAINPID
# keepalived needs to be in charge of killing its own children.
KillMode=process
[Install]
WantedBy=multi-user.target
I then used the following commands to set up the keepalived service systemctl preset keepalived.service systemctl start keepalived.service
after that I was all good to go.
Keepalived outputs to syslog. I found it very useful to check those logs to help me debug a few of these issues that I had. You can view those logs via the following command: sudo cat /var/log/syslog
this will also include other processes as well so just keep an eye out for Keepalived or Keepalived_vrrp
Well I hope this is useful to anyone else out there in the future!
So I finally got things working. I wanted to write down what it was I needed to do to get things to running so hopefully anyone with a similar issue doesn’t have to sink in as much time as I did.
I thought all you needed to do to enable private networking on my droplets was just click on the button in the control panel. Turns out there is a bit more work involved, you can see what you need to do here: https://www.google.com/search?q=enabling+private+neworking+on+digiatal+ocean&ie=utf-8&oe=utf-8&client=firefox-b
Make sure you are downloading the latest version of keepalived. The version currently listed in the tutorial has a bug in it that prevents it from running the master.sh script. As of me writing this the newest version is 1.2.23. Just check here to see what latest version is:
http://www.keepalived.org/download.html
apt-get install python-pip export LC_ALL=C pip install requests
sudo nano /etc/systemd/system/keepalived.service
Then I copied the following into the file, saved and closed it on both droplets
#
# keepalived control files for systemd
#
# Incorporates fixes from RedHat bug #769726.
[Unit]
Description=LVS and VRRP High Availability monitor
After=network.target
ConditionFileNotEmpty=/etc/keepalived/keepalived.conf
[Service]
Type=simple
# Ubuntu/Debian convention:
EnvironmentFile=-/etc/default/keepalived
ExecStart=/usr/local/sbin/keepalived --dont-fork
ExecReload=/bin/kill -s HUP $MAINPID
# keepalived needs to be in charge of killing its own children.
KillMode=process
[Install]
WantedBy=multi-user.target
I then used the following commands to set up the keepalived service systemctl preset keepalived.service systemctl start keepalived.service
after that I was all good to go.
Keepalived outputs to syslog. I found it very useful to check those logs to help me debug a few of these issues that I had. You can view those logs via the following command: sudo cat /var/log/syslog
this will also include other processes as well so just keep an eye out for Keepalived or Keepalived_vrrp
Well I hope this is useful to anyone else out there in the future!
So I finally got things working. I wanted to write down what it was I needed to do to get things to running so hopefully anyone with a similar issue doesn’t have to sink in as much time as I did.
I thought all you needed to do to enable private networking on my droplets was just click on the button in the control panel. Turns out there is a bit more work involved, you can see what you need to do here: https://www.google.com/search?q=enabling+private+neworking+on+digiatal+ocean&ie=utf-8&oe=utf-8&client=firefox-b
Make sure you are downloading the latest version of keepalived. The version currently listed in the tutorial has a bug in it that prevents it from running the master.sh script. As of me writing this the newest version is 1.2.23. Just check here to see what latest version is:
http://www.keepalived.org/download.html
apt-get install python-pip export LC_ALL=C pip install requests
sudo nano /etc/systemd/system/keepalived.service
Then I copied the following into the file, saved and closed it on both droplets
#
# keepalived control files for systemd
#
# Incorporates fixes from RedHat bug #769726.
[Unit]
Description=LVS and VRRP High Availability monitor
After=network.target
ConditionFileNotEmpty=/etc/keepalived/keepalived.conf
[Service]
Type=simple
# Ubuntu/Debian convention:
EnvironmentFile=-/etc/default/keepalived
ExecStart=/usr/local/sbin/keepalived --dont-fork
ExecReload=/bin/kill -s HUP $MAINPID
# keepalived needs to be in charge of killing its own children.
KillMode=process
[Install]
WantedBy=multi-user.target
I then used the following commands to set up the keepalived service systemctl preset keepalived.service systemctl start keepalived.service
after that I was all good to go.
Keepalived outputs to syslog. I found it very useful to check those logs to help me debug a few of these issues that I had. You can view those logs via the following command: sudo cat /var/log/syslog
this will also include other processes as well so just keep an eye out for Keepalived or Keepalived_vrrp
Well I hope this is useful to anyone else out there in the future!
So I finally got things working. I wanted to write down what it was I needed to do to get things to running so hopefully anyone with a similar issue doesn’t have to sink in as much time as I did.
I thought all you needed to do to enable private networking on my droplets was just click on the button in the control panel. Turns out there is a bit more work involved, you can see what you need to do here: https://www.google.com/search?q=enabling+private+neworking+on+digiatal+ocean&ie=utf-8&oe=utf-8&client=firefox-b
Make sure you are downloading the latest version of keepalived. The version currently listed in the tutorial has a bug in it that prevents it from running the master.sh script. As of me writing this the newest version is 1.2.23. Just check here to see what latest version is:
http://www.keepalived.org/download.html
apt-get install python-pip export LC_ALL=C pip install requests
sudo nano /etc/systemd/system/keepalived.service
Then I copied the following into the file, saved and closed it on both droplets
#
# keepalived control files for systemd
#
# Incorporates fixes from RedHat bug #769726.
[Unit]
Description=LVS and VRRP High Availability monitor
After=network.target
ConditionFileNotEmpty=/etc/keepalived/keepalived.conf
[Service]
Type=simple
# Ubuntu/Debian convention:
EnvironmentFile=-/etc/default/keepalived
ExecStart=/usr/local/sbin/keepalived --dont-fork
ExecReload=/bin/kill -s HUP $MAINPID
# keepalived needs to be in charge of killing its own children.
KillMode=process
[Install]
WantedBy=multi-user.target
I then used the following commands to set up the keepalived service systemctl preset keepalived.service systemctl start keepalived.service
after that I was all good to go.
Keepalived outputs to syslog. I found it very useful to check those logs to help me debug a few of these issues that I had. You can view those logs via the following command: sudo cat /var/log/syslog
this will also include other processes as well so just keep an eye out for Keepalived or Keepalived_vrrp
Well I hope this is useful to anyone else out there in the future!
I am trying to run this on Ubuntu Bionic and keep seeing this :
killall5[somenumber]: only one argument, a signal number, allowed
Because of this, vrrp is not actually working and lb1 holds onto the Floating IP even if nginx is not running locally.
Here is my /etc/systemd/system/multi-user.target.wants/keepalived.service file : [Unit] Description=Keepalive Daemon (LVS and VRRP) After=syslog.target network-online.target Wants=network-online.target
ConditionFileNotEmpty=/etc/keepalived/keepalived.conf
[Service] Type=forking KillMode=process
EnvironmentFile=-/etc/default/keepalived ExecStart=/usr/sbin/keepalived $DAEMON_ARGS ExecReload=/bin/kill -HUP $MAINPID
[Install] WantedBy=multi-user.target
As far as I understand it, this file is what determines what keepalived “does” under SystemD. Killmode=process is the same as under Ubuntu 16 and 14.
Has anyone else had this issue ?
YES @ArtirigoOcean! Brilliant!
Oh great that worked!
I am still having some issues with keepalived working but that is because my setup is a bit more involved than the one in the tutorial. I’ll figure it out eventually.
Thanks so much for your help
Ah, Ubuntu 16.04 uses systemd instead of upstart, so “start” isn’t a thing anymore. Instead, you can use:
sudo service keepalived start
or
sudo systemctl start keepalived.service
both will do the same. :)
So it looks like I have one remaining problem. The keepalived service is up and running on both of my droplets now. They recognize and change their state when I turn on and off my servers, but neither of them seem to run the notify_master script.
When I run the master.sh script manually the floating IP is successfully transferred over. From that I am guessing that the script itself is not the issue.
Hi,
Have you found a solution to this?
Thanks