I want to know how to change the process name root to another one?
when using the following command:
ps aux | grep keepalived
root 26982 0.0 0.0 19344 1560 ? Ss 11:52 0:00 /usr/local/keepalived-2.0.16/sbin/keepalived -D
root 26983 0.0 0.1 19344 2404 ? S 11:52 0:02 /usr/local/keepalived-2.0.16/sbin/keepalived -D
root 30816 0.0 0.0 9288 1628 pts/1 S+ 13:49 0:00 grep --color=auto keepalived
keepalived working as expected handle virtual IP and failover.
but I want to change root to username:keepalived
my env:
- linux distribution:SUSE SLES 12 SP4
- linux kernel:4.12.14-95.13
- Unix daemon:systemd
- keepalived version:
- 1.4.5(use zypper from https://software.opensuse.org/package/keepalived)
- also, try to make install from source code
- follow the install step from https://www.keepalived.org/doc/installing_keepalived.html#build-and-install
- 1.4.5(from https://www.keepalived.org/download.html)
- 2.0.16(from https://www.keepalived.org/download.html)
(due to https://www.keepalived.org/index.html says:"Keepalived code present in git master branch must be considered as stable and futur proof.",
and https://www.keepalived.org/manpage.html only show one version(is that 2.0.16?) document, I choose 2.0.16 to discuss)
(the following information is 2.0.16 version, Run command as root, but I can see the similar error in 1.4.5)
how I install keepalived:
wget http://keepalived.org/software/keepalived-2.0.16.tar.gz
tar -xvf keepalived-2.0.16.tar.gz
cd keepalived-2.0.16/
zypper in gcc
zypper in openssl-devel
./configure --prefix=/usr/local/keepalived-2.0.16
make
sudo make install
setting keepalived.conf
vi /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
script_user keepalived
enable_script_security
}
# Script used to check if nginx is running
vrrp_script check_nginx {
script "/etc/keepalived/check_nginx.sh"
interval 2
weight 2
}
# Virtual interface
# The priority specifies the order in which the assigned interface to take over in a failover
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass pass
}
# The virtual ip address shared between the two loadbalancers
virtual_ipaddress { # Block limited to 20 IP addresses
192.168.2.179
}
track_script {
check_nginx
}
}
what I already try:
- cp /usr/lib/systemd/system/keeplaived.service to /etc/systemd/system/keepalived.service and add user tag
User=keepalived
Group=users
but keepalived not working anymore, keepalived stop.
- change dir, permission in /etc/systemd/system/keepalived.service
#PIDFile=/var/run/keepalived.pid
ExecStart=/usr/local/keepalived-2.0.16/sbin/keepalived $KEEPALIVED_OPTIONS -p /etc/keepalived/keepalived.pid -r /etc/keepalived/vrrp.pid -c /etc/keepalived/keepalived_checkers.pid
useradd -M -s /bin/nologin -d /opt/keepalived keepalived
chown -R keepalived:users /etc/keepalived/
this time keepalived start working
keepali+ 26289 0.0 0.0 19344 1628 ? Ss 11:34 0:00 /usr/local/keepalived-2.0.16/sbin/keepalived -D -p /etc/keepalived/keepalived.pid -r /etc/keepalived/vrrp.pid -c /etc/keepalived/keepalived_checkers.pid
keepali+ 26290 0.0 0.1 19344 2456 ? S 11:34 0:00 /usr/local/keepalived-2.0.16/sbin/keepalived -D -p /etc/keepalived/keepalived.pid -r /etc/keepalived/vrrp.pid -c /etc/keepalived/keepalived_checkers.pid
root 26323 0.0 0.0 9288 1628 pts/1 S+ 11:35 0:00 grep --color=auto keepalived
but got following error in systemctl status keepalived and journalctl -xe
-- Unit keepalived.service has begun starting up.
Keepalived[10409]: Starting Keepalived v2.0.16 (05/03,2019), git commit v2.0.15-96-g4d492740+
Keepalived[10409]: Running on Linux 4.12.14-95.13-default #1 SMP Fri Mar 22 06:04:58 UTC 2019 (c01bf34) (bu
Keepalived[10409]: Command line: '/usr/local/keepalived-2.0.16/sbin/keepalived' '-D' '-p'
Keepalived[10409]: '/etc/keepalived/keepalived.pid' '-r' '/etc/keepalived/vrrp.pid' '-c'
Keepalived[10409]: '/etc/keepalived/keepalived_checkers.pid'
Keepalived[10409]: Opening file '/etc/keepalived/keepalived.conf'.
Keepalived[10409]: Failed to bind to process monitoring socket - errno 1 - Operation not permitted
systemd[1]: Started LVS and VRRP High Availability Monitor.
-- Subject: Unit keepalived.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit keepalived.service has finished starting up.
--
-- The start-up result is done.
Keepalived[10409]: Remove a zombie pid file /etc/keepalived/keepalived.pid
Keepalived[10409]: Remove a zombie pid file /etc/keepalived/vrrp.pid
Keepalived[10412]: Starting VRRP child process, pid=10413
Keepalived_vrrp[10413]: Registering Kernel netlink reflector
Keepalived_vrrp[10413]: Registering Kernel netlink command channel
Keepalived_vrrp[10413]: Opening file '/etc/keepalived/keepalived.conf'.
Keepalived_vrrp[10413]: Assigned address 192.168.2.178 for interface eth0
Keepalived_vrrp[10413]: Assigned address fe80::a00:27ff:feef:6ebe for interface eth0
Keepalived_vrrp[10413]: Error 1 while registering gratuitous ARP shared channel
Keepalived_vrrp[10413]: (VI_1) removing VIPs.
Keepalived_vrrp[10413]: Netlink: error: Operation not permitted, type=RTM_DELADDR(21), seq=1557728895, pid=
Keepalived_vrrp[10413]: cant open raw socket. errno=1
Keepalived_vrrp[10413]: (VI_1) Entering BACKUP STATE (init)
Keepalived_vrrp[10413]: VRRP sockpool: [ifindex(2), family(IPv4), proto(112), unicast(0), fd(-1,-1)]
Keepalived_vrrp[10414]: Couldn't setgroups: 100 (Operation not permitted)
Keepalived_vrrp[10413]: VRRP_Script(check_nginx) succeeded
Keepalived_vrrp[10413]: (VI_1) Changing effective priority from 150 to 152
Keepalived_vrrp[10415]: Couldn't setgroups: 100 (Operation not permitted)
(in my case, I use keepalived to failover the nginx ) also, I want to ask
is there a forum or Q&A for keepalived?
the better way to install keepalived?
- keepalived 1.4.5(for now) from zypper(package manager)?
- keepalived latest 2.0.16(for now) from source code?
is something I do or what I think is wrong or weird?