PMM部署遇到的坑

本文永久地址:
http://fuxkdb.com/2017/08/01/PMM%E9%83%A8%E7%BD%B2%E9%81%87%E5%88%B0%E7%9A%84%E5%9D%91/

PMM部署遇到的坑

系统 内核版本
CentOS release 6.4 (Final) 2.6.32-358.el6.x86_64

1.公司环境pull不下来

在自己的环境pull下来然后save image

[root@slave oracle]# docker images
REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
docker.io/percona/pmm-server   1.2.0               eb82a0e154c8        2 weeks ago         1.266 GB
docker.io/percona/pmm-server   latest              eb82a0e154c8        2 weeks ago         1.266 GB
[root@slave oracle]# docker save eb82a0e154c8 > pmm-server.tar

[root@slave oracle]# scp pmm-server.tar 10.4.2.43:~/
root@10.4.2.43's password: 
pmm-server.tar                                                                                                                                                        100% 1232MB 902.5KB/s   23:18  

在原环境导入

[root@test2 ~]# docker load < pmm-server.tar 

repostory和tag是

[root@test2 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
<none>              <none>              abdf7c1b7a63        2 weeks ago         1.266 GB
<none>              <none>              3690474eb5b4        11 months ago       0 B

修改tag

[root@test2 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
                            abdf7c1b7a63        2 weeks ago         1.266 GB
                            3690474eb5b4        11 months ago       0 B
[root@test2 ~]# docker tag abdf7c1b7a63 docker.io/percona/pmm-server:1.2.0

2.docker容器无法启动 no such file or directory statusCode=404

这个搜了半天不知道是什么原因,怀疑是内核版本太低

因为CentOS6.4自带内核版本是2.6.32-358.23.2.el6.x86_64,而Docker要求内核版本大于3.0,推荐3.8以上的内核

https://yq.aliyun.com/ziliao/48262

遂升级内核

wget http://elrepo.org/linux/kernel/el6/x86_64/RPMS/kernel-lt-3.10.107-1.el6.elrepo.x86_64.rpm

如果连接不对,自己去http://elrepo.org/linux/kernel/el6/x86_64/RPMS/看一眼,找一个合适的

rpm -ivh kernel-lt-3.10.107-1.el6.elrepo.x86_64.rpm

修改grub.conf

vi /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-LogVol00
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.107-1.el6.elrepo.x86_64)
        root (hd0,0)
        kernel /vmlinuz-3.10.107-1.el6.elrepo.x86_64 ro root=/dev/mapper/VolGroup-LogVol00 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=VolGroup/LogVol00 rd_NO_DM rhgb quiet numa=off elevator=deadline
        initrd /initramfs-3.10.107-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-358.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/VolGroup-LogVol00 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=VolGroup/LogVol00 rd_NO_DM rhgb quiet numa=off elevator=deadline
        initrd /initramfs-2.6.32-358.el6.x86_64.img

现在title CentOS (3.10.107-1.el6.elrepo.x86_64)在 0 号位置,所以将
default=1改为default=0
重启os

重启后

[root@test2 ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)
[root@test2 ~]# uname -r
3.10.107-1.el6.elrepo.x86_64

再次创建container成功

[root@test2 ~]# docker load < pmm-server.tar 
[root@test2 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
                            abdf7c1b7a63        2 weeks ago         1.266 GB
                            3690474eb5b4        11 months ago       0 B
[root@test2 ~]# docker tag abdf7c1b7a63 docker.io/percona/pmm-server:1.2.0
[root@test2 ~]# docker create \
>    -v /opt/prometheus/data \
>    -v /opt/consul-data \
>    -v /var/lib/mysql \
>    -v /var/lib/grafana \
>    --name pmm-data \
>    percona/pmm-server:1.2.0 /bin/true
094c63bd911b5139a267abe7939e5c4442cdc857970dedaccb9ae0cb5f165fc9
[root@test2 ~]# docker run -d \
>    -p 80:80 \
>    --volumes-from pmm-data \
>    --name pmm-server \
>    --restart always \
>    percona/pmm-server:1.2.0
69195dca404bc607fa12a9cd6436a9786a71dcf226a0e4c1d6bf0b9879a14f03
[root@test2 ~]# docker ps -a
CONTAINER ID        IMAGE                      COMMAND                CREATED             STATUS              PORTS                         NAMES
69195dca404b        percona/pmm-server:1.2.0   "/opt/entrypoint.sh"   11 seconds ago      Up 9 seconds        0.0.0.0:80->80/tcp, 443/tcp   pmm-server          
094c63bd911b        percona/pmm-server:1.2.0   "/bin/true"            21 seconds ago                                                        pmm-data            

Note

PMM-server选择一个内核版本搞的服务器就行

PMM-client无所谓

  1. pmm-data 状态为Exited
    内核版本低

4.MySQL dashboard没数据
防火墙没关

pmm-admin check-network

centos 7
停止: systemctl disable firewalld
禁用: systemctl stop firewalld

5.容器时区为UTC与我们系统CST差八个小时

进入容器

 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

PMM系列文章:

1.Percona Monitoring and Management架构
2.PMM部署
3.PMM部署遇到的坑
4.PMM设置grafana登录用户
5.PMM出问题排查
6.PMM升级

你可能感兴趣的:(MySQL,PMM)