docker-compose安装zabbix5.0高可用

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 root@192.168.78.164 "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 root@192.168.78.160 "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  

效果


1.jpg

模拟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   

效果


2.jpg

故障恢复

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   

效果


2.jpg
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,386评论 6 479
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,939评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,851评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,953评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,971评论 5 369
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,784评论 1 283
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,126评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,765评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,148评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,744评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,858评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,479评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,080评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,053评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,278评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,245评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,590评论 2 343