docker-compose安装zabbix5.0高可用
本次实验一共准备了,三台机器
主机名 | ip | 软件环境 |
---|---|---|
zabbix-server01 | 192.168.78.160 | nginx+keepalived+sshpass zabbix server+agent |
zabbix-server02 | 192.168.78.164 | nginx+keepalived+sshpass zabbix server+agent |
zabbix-mysql | 192.168.78.158 | zabbix agent+mysql |
我的做法agent中的配置文件,Server和ServerActive中分别都配置了两个ip,就是为了保证,zabbix-server01宕机了,还可以把监控数据发往zabbix-server02,由于两个zabbix-server共用一个数据库,肯定不能同时往数据库写数据,于是我想到了使用keepalived来控制zabbix server的开关,做到VIP在哪,那台机器的zabbix server就启动,另外一台关闭,而zabbix的web页面使用VIP去访问
准备工作
安装好docker软件
设置主机名
zabbix-mysql
[root@zabbix-mysql ~]# hostnamectl set-hostname zabbix-mysql
zabbix-server01
[root@zabbix-server01 ~]# hostnamectl set-hostname zabbix-server01
zabbix-server01
[root@zabbix-server02 ~]# hostnamectl set-hostname zabbix-server02
禁用防火墙和selinux
zabbix-mysql
[root@zabbix-mysql ~]# systemctl stop firewalld
[root@zabbix-mysql ~]# systemctl disable firewalld
[root@zabbix-mysql ~]# setenforce 0
[root@zabbix-mysql ~]# vim /etc/selinux/config
SELINUX=disabled
[root@zabbix-mysql ~]# getenforce
Permissive
zabbix-server01
[root@zabbix-server01 ~]# systemctl stop firewalld
[root@zabbix-server01 ~]# systemctl disable firewalld
[root@zabbix-server01 ~]# setenforce 0
[root@zabbix-server01 ~]# vim /etc/selinux/config
SELINUX=disabled
[root@zabbix-server01 ~]# getenforce
Permissive
zabbix-server02
[root@zabbix-server02 ~]# systemctl stop firewalld
[root@zabbix-server02 ~]# systemctl disable firewalld
[root@zabbix-server02 ~]# setenforce 0
[root@zabbix-server02 ~]# vim /etc/selinux/config
SELINUX=disabled
[root@zabbix-server02 ~]# getenforce
Permissive
优化ssh
zabbix-server01
[root@zabbix-server01 ~]# vim /etc/ssh/ssh_config
GSSAPIAuthentication no
[root@zabbix-server01 ~]# systemctl restart sshd
zabbix-server02
[root@zabbix-server02 ~]# vim /etc/ssh/ssh_config
GSSAPIAuthentication no
[root@zabbix-server02 ~]# systemctl restart sshd
安装sshpass
zabbix-server01
[root@zabbix-server01 ~]# yum -y install sshpass
zabbix-server012
[root@zabbix-server02 ~]# yum -y install sshpass
安装mysql和zabbix-agent
zabbix-mysql
安装docker-compose
[root@zabbix-mysql ~]# sudo curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
[root@zabbix-mysql ~]# sudo chmod +x /usr/local/bin/docker-compose
[root@zabbix-mysql ~]# docker-compose version
docker-compose version 1.27.1, build 509cfb99
docker-py version: 4.3.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
创建挂载目录
[root@zabbix-mysql ~]# mkdir -p zabbix-HA-mysql/mysqldata
[root@zabbix-mysql ~]# cd zabbix-HA-mysql
编写docker-compose.yml
version: "3.8"
services:
mysql-server:
image: mysql:8.0
container_name: mysql-server
restart: always
environment:
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
command:
- --character-set-server=utf8
- --collation-server=utf8_bin
- --default-authentication-plugin=mysql_native_password
networks:
- zabbix-net
volumes:
- "/root/zabbix-HA-mysql/mysqldata:/var/lib/mysql"
- "/etc/localtime:/etc/localtime"
ports:
- "3306:3306"
zabbix-agent:
image: zabbix/zabbix-agent
container_name: zabbix-agent
restart: always
privileged: true
environment:
ZBX_HOSTNAME: "zabbix-mysql"
ZBX_SERVER_HOST: "192.168.78.160,192.168.78.164"
ZBX_SERVER_PORT: 10051
ports:
- "10050:10050"
volumes:
- "/etc/localtime:/etc/localtime"
networks:
- zabbix-net
networks:
zabbix-net:
ipam:
driver: default
config:
- subnet: "172.18.0.0/16"
启动
[root@zabbix-mysql zabbix-HA-mysql]# docker-compose up -d
安装nginx,zabbix-server,zabbix-agent,zabbix-java-gateway
zabbix-server01
安装docker-compose
[root@zabbix-server01 ~]# sudo curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
[root@zabbix-server01 ~]# sudo chmod +x /usr/local/bin/docker-compose
[root@zabbix-server01 ~]# docker-compose version
docker-compose version 1.27.1, build 509cfb99
docker-py version: 4.3.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
创建挂载目录
[root@zabbix-server01 ~]# mkdir -p /root/zabbix-HA-server01/alertscripts
[root@zabbix-server01 ~]# mkdir -p /root/zabbix-HA-server01/externalscripts
[root@zabbix-server01 ~]# cd zabbix-HA-server01/
编写docker-compose.yml文件
version: "3.8"
services:
zabbix-java-gateway:
image: zabbix/zabbix-java-gateway
container_name: zabbix-java-gateway
volumes:
- "/etc/localtime:/etc/localtime"
ports:
- "10052:10052"
restart: always
networks:
- zabbix-net
zabbix-server-mysql:
image: zabbix/zabbix-server-mysql
container_name: zabbix-server-mysql
networks:
- zabbix-net
restart: always
environment:
DB_SERVER_HOST: "192.168.78.158"
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
ZBX_JAVAGATEWAY: zabbix-java-gateway
ZBX_JAVAGATEWAY_ENABLE: "true"
ports:
- "10051:10051"
volumes:
- "/etc/localtime:/etc/localtime"
- "/root/zabbix-HA-server01/alertscripts:/usr/lib/zabbix/alertscripts"
- "/root/zabbix-HA-server01/externalscripts:/usr/lib/zabbix/externalscripts"
links:
- zabbix-java-gateway:zabbix-java-gateway
zabbix-web-nginx-mysql:
image: zabbix/zabbix-web-nginx-mysql
container_name: zabbix-web-nginx-mysql
networks:
- zabbix-net
restart: always
depends_on:
- zabbix-server-mysql
environment:
DB_SERVER_HOST: "192.168.78.158"
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
ZBX_SERVER_HOST: zabbix-server
PHP_TZ: "Asia/Shanghai"
ports:
- "8080:8080"
volumes:
- "/etc/localtime:/etc/localtime"
links:
- zabbix-server-mysql:zabbix-server
zabbix-agent:
image: zabbix/zabbix-agent
container_name: zabbix-agent
restart: always
privileged: true
environment:
ZBX_HOSTNAME: "Zabbix server"
ZBX_SERVER_HOST: "172.18.0.1"
ZBX_SERVER_PORT: 10051
ports:
- "10050:10050"
volumes:
- "/etc/localtime:/etc/localtime"
networks:
- zabbix-net
networks:
zabbix-net:
ipam:
driver: default
config:
- subnet: "172.18.0.0/16"
启动
[root@zabbix-server01 zabbix-HA-server01]# docker-compose up -d
安装nginx,zabbix-server,zabbix-agent,zabbix-java-gateway
zabbix-server02
安装docker-compose
[root@zabbix-server02 ~]# sudo curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
[root@zabbix-server02 ~]# sudo chmod +x /usr/local/bin/docker-compose
[root@zabbix-server02 ~]# docker-compose version
docker-compose version 1.27.1, build 509cfb99
docker-py version: 4.3.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
创建挂载目录
[root@zabbix-server02 ~]# mkdir -p /root/zabbix-HA-server02/alertscripts
[root@zabbix-server02 ~]# mkdir -p /root/zabbix-HA-server02/externalscripts
[root@zabbix-server02 ~]# cd zabbix-HA-server02/
编写docker-compose.yml文件
version: "3.8"
services:
zabbix-java-gateway:
image: zabbix/zabbix-java-gateway
container_name: zabbix-java-gateway
volumes:
- "/etc/localtime:/etc/localtime"
ports:
- "10052:10052"
restart: always
networks:
- zabbix-net
zabbix-server-mysql:
image: zabbix/zabbix-server-mysql
container_name: zabbix-server-mysql
networks:
- zabbix-net
restart: always
environment:
DB_SERVER_HOST: "192.168.78.158"
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
ZBX_JAVAGATEWAY: zabbix-java-gateway
ZBX_JAVAGATEWAY_ENABLE: "true"
ports:
- "10051:10051"
volumes:
- "/etc/localtime:/etc/localtime"
- "/root/zabbix-HA-server02/alertscripts:/usr/lib/zabbix/alertscripts"
- "/root/zabbix-HA-server02/externalscripts:/usr/lib/zabbix/externalscripts"
links:
- zabbix-java-gateway:zabbix-java-gateway
zabbix-web-nginx-mysql:
image: zabbix/zabbix-web-nginx-mysql
container_name: zabbix-web-nginx-mysql
networks:
- zabbix-net
restart: always
depends_on:
- zabbix-server-mysql
environment:
DB_SERVER_HOST: "192.168.78.158"
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
ZBX_SERVER_HOST: zabbix-server
PHP_TZ: "Asia/Shanghai"
ports:
- "8080:8080"
volumes:
- "/etc/localtime:/etc/localtime"
links:
- zabbix-server-mysql:zabbix-server
zabbix-agent:
image: zabbix/zabbix-agent
container_name: zabbix-agent
restart: always
privileged: true
environment:
ZBX_HOSTNAME: "Zabbix server"
ZBX_SERVER_HOST: "172.18.0.1"
ZBX_SERVER_PORT: 10051
ports:
- "10050:10050"
volumes:
- "/etc/localtime:/etc/localtime"
networks:
- zabbix-net
networks:
zabbix-net:
ipam:
driver: default
config:
- subnet: "172.18.0.0/16"
在zabbix-server01和zabbix-server02上分别安装keepalived并编写切换脚本
zabbix-server01
[root@zabbix-server01 zabbix-HA-server01]# yum -y install keepalived
[root@zabbix-server01 zabbix-HA-server01]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id zabbix-server01
}
vrrp_instance VI_1 {
state BACKUP
interface ens37 #网卡名
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.78.200
}
notify_master /opt/to_master.sh
}
编写切换脚本
[root@zabbix-server01 zabbix-HA-server01]# vim /opt/to_master.sh
#!/bin/bash
sshpass -p 123456 ssh -o StrictHostKeyChecking=no [email protected] "cd /root/zabbix-HA-server02 && docker-compose down"
cd /root/zabbix-HA-server01 && docker-compose up -d
[root@zabbix-server01 zabbix-HA-server01]# chmod +x /opt/to_master.sh
[root@zabbix-server01 zabbix-HA-server01]# ll /opt/to_master.sh
-rwxr-xr-x. 1 root root 190 9月 21 17:26 /opt/to_master.sh
zabbix-server02
[root@zabbix-server02 zabbix-HA-server02]# yum -y install keepalived
[root@zabbix-server02 zabbix-HA-server02]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id zabbix-server02
}
vrrp_instance VI_1 {
state BACKUP
interface ens37 #网卡名
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.78.200
}
notify_master /opt/to_master.sh
}
编写切换脚本
[root@zabbix-server02 zabbix-HA-server02]# vim /opt/to_master.sh
#!/bin/bash
sshpass -p 123456 ssh -o StrictHostKeyChecking=no [email protected] "cd /root/zabbix-HA-server01 && docker-compose down"
cd /root/zabbix-HA-server02 && docker-compose up -d
[root@zabbix-server02 zabbix-HA-server02]# chmod +x /opt/to_master.sh
[root@zabbix-server02 zabbix-HA-server02]# ll /opt/to_master.sh
-rwxr-xr-x. 1 root root 189 9月 21 16:43 /opt/to_master.sh
测试
两台zabbix server都启动keepalived的
zabbix-server01 启动zabbix server
zabbix-server02不启动zabbix server
启动keepalived
zabbix-server01
[root@zabbix-server01 zabbix-HA-server01]# systemctl start keepalived
[root@zabbix-server01 zabbix-HA-server01]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: active (running) since 一 2020-09-21 19:54:26 CST; 3min 31s ago
Process: 32496 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 32497 (keepalived)
CGroup: /system.slice/keepalived.service
├─32497 /usr/sbin/keepalived -D
├─32498 /usr/sbin/keepalived -D
└─32499 /usr/sbin/keepalived -D
9月 21 19:54:29 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:29 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:29 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:29 zabbix-server01 Keepalived_vrrp[32499]: Opening script file /opt/to_master.sh
9月 21 19:54:34 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:34 zabbix-server01 Keepalived_vrrp[32499]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs on ens37 for 192.168.78.200
9月 21 19:54:34 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:34 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:34 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:34 zabbix-server01 Keepalived_vrrp[32499]: Sending gratuitous ARP on ens37 for 192.168.78.200
[root@zabbix-server01 zabbix-HA-server01]# systemctl enable keepalived
zabbix-server02
[root@localhost zabbix-HA-server02]# systemctl start keepalived
[root@zabbix-server02 zabbix-HA-server02]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: active (running) since 一 2020-09-21 16:54:23 CST; 3h 3min ago
Main PID: 21638 (keepalived)
CGroup: /system.slice/keepalived.service
├─21638 /usr/sbin/keepalived -D
├─21639 /usr/sbin/keepalived -D
└─21640 /usr/sbin/keepalived -D
9月 21 19:40:26 zabbix-server02 Keepalived_vrrp[21640]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:40:31 zabbix-server02 Keepalived_vrrp[21640]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:40:31 zabbix-server02 Keepalived_vrrp[21640]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs on ens37 for 192.168.78.200
9月 21 19:40:31 zabbix-server02 Keepalived_vrrp[21640]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:40:31 zabbix-server02 Keepalived_vrrp[21640]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:40:31 zabbix-server02 Keepalived_vrrp[21640]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:40:31 zabbix-server02 Keepalived_vrrp[21640]: Sending gratuitous ARP on ens37 for 192.168.78.200
9月 21 19:54:27 zabbix-server02 Keepalived_vrrp[21640]: VRRP_Instance(VI_1) Received advert with higher priority 150, ours 100
9月 21 19:54:27 zabbix-server02 Keepalived_vrrp[21640]: VRRP_Instance(VI_1) Entering BACKUP STATE
9月 21 19:54:27 zabbix-server02 Keepalived_vrrp[21640]: VRRP_Instance(VI_1) removing protocol VIPs.
[root@zabbix-server02 zabbix-HA-server02]# systemctl enable keepalived
zabbix-server01状态如下
[root@zabbix-server01 zabbix-HA-server01]# ip addr | grep 192.168.78.200
inet 192.168.78.200/32 scope global ens37
[root@zabbix-server01 zabbix-HA-server01]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 26547/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1361/master
tcp6 0 0 :::10050 :::* LISTEN 28719/docker-proxy
tcp6 0 0 :::10051 :::* LISTEN 28989/docker-proxy
tcp6 0 0 :::10052 :::* LISTEN 28731/docker-proxy
tcp6 0 0 :::8080 :::* LISTEN 29103/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 26547/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1361/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 672/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 29790/dhclient
udp6 0 0 ::1:323 :::* 672/chronyd
zabbix-server02状态如下
[root@zabbix-server02 zabbix-HA-server02]# ip addr | grep 192.168.78.200
[root@zabbix-server02 zabbix-HA-server02]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 21673/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1343/master
tcp6 0 0 :::22 :::* LISTEN 21673/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1343/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 675/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 22535/dhclient
udp6 0 0 ::1:323 :::* 675/chronyd
效果
模拟zabbix-server01宕机,keepalived不工作了
zabbix-server01
[root@zabbix-server01 zabbix-HA-server01]# systemctl stop keepalived
[root@zabbix-server01 zabbix-HA-server01]# ip addr | grep 192.168.78.200
[root@zabbix-server01 zabbix-HA-server01]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 26547/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1361/master
tcp6 0 0 :::10050 :::* LISTEN 28719/docker-proxy
tcp6 0 0 :::10051 :::* LISTEN 28989/docker-proxy
tcp6 0 0 :::10052 :::* LISTEN 28731/docker-proxy
tcp6 0 0 :::8080 :::* LISTEN 29103/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 26547/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1361/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 672/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 29790/dhclient
udp6 0 0 ::1:323 :::* 672/chronyd
zabbix-server02
[root@zabbix-server02 zabbix-HA-server02]# ip addr | grep 192.168.78.200
inet 192.168.78.200/32 scope global ens37
[root@zabbix-server02 zabbix-HA-server02]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 21673/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1343/master
tcp6 0 0 :::10050 :::* LISTEN 25615/docker-proxy
tcp6 0 0 :::10051 :::* LISTEN 25883/docker-proxy
tcp6 0 0 :::10052 :::* LISTEN 25628/docker-proxy
tcp6 0 0 :::8080 :::* LISTEN 25991/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 21673/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1343/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 675/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 22535/dhclient
udp6 0 0 ::1:323 :::* 675/chronyd
效果
故障恢复
zabbix-server01
[root@zabbix-server01 zabbix-HA-server01]# systemctl start keepalived
[root@zabbix-server01 zabbix-HA-server01]# ip addr | grep 192.168.78.200
inet 192.168.78.200/32 scope global ens37
[root@zabbix-server01 zabbix-HA-server01]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 26547/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1361/master
tcp6 0 0 :::10050 :::* LISTEN 33984/docker-proxy
tcp6 0 0 :::10051 :::* LISTEN 34257/docker-proxy
tcp6 0 0 :::10052 :::* LISTEN 33997/docker-proxy
tcp6 0 0 :::8080 :::* LISTEN 34369/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 26547/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1361/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 672/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 29790/dhclient
udp6 0 0 ::1:323 :::* 672/chronyd
zabbix-server02
[root@zabbix-server02 zabbix-HA-server02]# ip addr | grep 192.168.78.200
[root@zabbix-server02 zabbix-HA-server02]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 21673/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1343/master
tcp6 0 0 :::22 :::* LISTEN 21673/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1343/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 675/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 22535/dhclient
udp6 0 0 ::1:323 :::* 675/chronyd
效果