打赏 jQuery火箭图标返回顶部代码

使用docker19.03.6部署zabbix

可参考官方文档:https://www.zabbix.com/documentation/4.0/zh/manual/installation/containers

1)启动一个空的mysql服务器实例

docker run --name mysql-server -t \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="zabbix" \
      -d mysql:5.7  \
--character-set-server=utf8 --collation-server=utf8_bin

2)启动Zabbix server实例,并关联这个实例到已创建的MySQL服务器实例

docker run --name zabbix-server-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="zabbix" \
      --link mysql-server:mysql \
      -p 10051:10051 \
      -d zabbix/zabbix-server-mysql:latest

3)启动Zabbix web 接口,并将它与MySQL服务器实例和Zabbix server实例关联

docker run --name zabbix-web-nginx-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="zabbix" \
      --link mysql-server:mysql \
      --link zabbix-server-mysql:zabbix-server \
      -p 8080:80 \
      -d zabbix/zabbix-web-nginx-mysql:latest

4)查看镜像,和容器启动情况

[root@m129 ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
nginx                           latest              2073e0bcb60e        13 days ago         127MB
mysql                           5.7                 c4f186b9e038        2 weeks ago         435MB
zabbix/zabbix-web-nginx-mysql   latest              7b61d6b63d70        2 weeks ago         155MB
zabbix/zabbix-server-mysql      latest              3ea9c02413ac        2 weeks ago         65.9MB
centos                          7                   5e35e350aded        3 months ago        203MB
[root@m129 ~]# docker ps
CONTAINER ID        IMAGE                                  COMMAND                  CREATED              STATUS              PORTS                           NAMES
53bfb729695c        zabbix/zabbix-web-nginx-mysql:latest   "docker-entrypoint.sh"   About a minute ago   Up About a minute   443/tcp, 0.0.0.0:8080->80/tcp   zabbix-web-nginx-mysql
2f1b654be829        zabbix/zabbix-server-mysql:latest      "/sbin/tini -- /usr/…"   3 minutes ago        Up 3 minutes        0.0.0.0:10051->10051/tcp        zabbix-server-mysql
e63756570e74        mysql:5.7                              "docker-entrypoint.s…"   6 minutes ago        Up 6 minutes        3306/tcp, 33060/tcp             mysql-server
[root@m129 ~]# 

 

5)查看虚拟机网卡的ip地址

[root@m129 ~]# ifconfig -a|grep -o -e 'inet [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}'|grep -v "127.0.0"|awk '{print $2}'
172.17.0.1
192.168.161.129  #用这个ip+8080就可以访问zabbix了,初始用户Admin密码zabbix
[root@m129 ~]# hostname -I
192.168.161.129 172.17.0.1 
[root@m129 ~]#

 

posted @ 2020-02-16 14:45  浪漫De刺猬  阅读(288)  评论(0编辑  收藏  举报