Docker 镜像制作

来自ling
跳转至: 导航搜索

服务注册中心:deloitte.cloud.server.eureka

  • 在docker插件中选择docker build并执行,将会将程序发布为镜像并上传到pom.xml中dockerHost指定的服务器
  • 如需要将镜像上传到阿里云在控制台执行
docker login --username=102010cncger@sina.com registry.cn-hangzhou.aliyuncs.com
docker push registry.cn-hangzhou.aliyuncs.com/ling/deloitte.cloud.server.eureka:latest
  • 运行
docker run -d -p 8889:8889 --restart=always --name deloitte.cloud.server.eureka1 registry.cn-hangzhou.aliyuncs.com/ling/deloitte.cloud.server.eureka

配置管理中心deloitte.cloud.configserver

docker run -d -p 8888:8888 --restart=always --name deloitte.cloud.configserver1 --link deloitte.cloud.server.eureka1:configserver-registry1 registry.cn-hangzhou.aliyuncs.com/ling/deloitte.cloud.configserver

使用阿里镜像代理的Ubuntu基础镜像

安装基础内容

docker run -i -t ubuntu /bin/bash
docker exec -it [container_id] /bin/bash
apt-get update
apt-get clean
apt-get install vim
apt-get install curl
cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
apt-get update
apt-get upgrade
rm -rf /var/lib/apt/lists/*
apt-get clean all

提交并保存镜像

docker ps
docker commit -m="ubuntu base" -a="bo.wang" 0b2616b0e5a8 registry.cn-hangzhou.aliyuncs.com/ling/ubuntu:latest
docker login --username=102010cncger@sina.com registry.cn-hangzhou.aliyuncs.com
docker push registry.cn-hangzhou.aliyuncs.com/ling/ubuntu:latest
docker history registry.cn-hangzhou.aliyuncs.com/ling/ubuntu

使用阿里镜像代理的centos基础镜像

安装基础内容

docker run -i -t centos /bin/bash
docker exec -it [container_id] /bin/bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
yum makecache
yum update

Ubuntu vi 上下左右变ABCD问题解决方法

sudo apt-get remove vim-common
sudo apt-get install vim

yum -y install epel-release net-tools
yum clean all

提交并保存镜像

docker ps
docker commit -m="centos base" -a="bo.wang" 0b2616b0e5a8 registry.cn-hangzhou.aliyuncs.com/ling/centos:latest
docker login --username=102010cncger@sina.com registry.cn-hangzhou.aliyuncs.com
docker push registry.cn-hangzhou.aliyuncs.com/ling/centos:latest
docker history registry.cn-hangzhou.aliyuncs.com/ling/centos

open365

docker run -i -t --name open365 registry.cn-hangzhou.aliyuncs.com/ling/ubantu /bin/bash
apt-get install python3-pip #如果不能安装,需要切换出阿里的镜像源
pip3 install --upgrade pip 
apt-get install libmysqlclient-dev python3-dev
pip3 install mysqlclient 
pip3 install pymongo
pip3 install ldap3
pip3 install requests


docker ps
docker commit -m="open365 base" -a="bo.wang" 0b2616b0e5a8 registry.cn-hangzhou.aliyuncs.com/ling/open365:latest
docker login --username=102010cncger@sina.com registry.cn-hangzhou.aliyuncs.com
docker push registry.cn-hangzhou.aliyuncs.com/ling/open365:latest
docker history registry.cn-hangzhou.aliyuncs.com/ling/open365
docker run -i -t --name open365  -v /root/docker/Open365-master:/open365_install registry.cn-hangzhou.aliyuncs.com/ling/open365:latest /bin/bash

nginx镜像

  docker run --restart=always --name nginx70 --link gitlab:nginx-gitlab -v /alidata/dockerdata/nginx/content:/usr/share/nginx/html:ro -v /alidata/dockerdata/nginx/nginx.conf:/etc/nginx/nginx.conf:ro -v /alidata/dockerdata/nginx/conf.d:/etc/nginx/conf.d  -d -p 70:80 nginx
  • ro表示只读
  • 每次修改配置后重启docker nginx70没有效果,必须删除了重新建立container,不知道为什么

gitlab

vi /alidata/dockerdata/nginx/config/gitlab.conf
location /gitlab 
	{
		proxy_pass http://127.0.0.1:10060/;
		proxy_redirect default;
	}

nginx.conf

vi /alidata/dockerdata/nginx/nginx.conf
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;
upstream gitlab{
server nginx-gitlab:80;
}
 server {

        listen       80;

        server_name  2;

 

        location /gitlab {

        #设置主机头和客户端真实地址,以便服务器获取客户端真实IP

             proxy_set_header Host $host;

             proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

 

             #禁用缓存

             proxy_buffering off;

 

             #反向代理的地址

             proxy_pass http://gitlab;     

        }

    }
    #include /etc/nginx/conf.d/*.conf;
}

ling2.conf

vi /alidata/dockerdata/nginx/config/ling2.conf
server {
        listen       80;
        server_name  www.ling2.cn;
	index index.html index.htm index.php;
	root /opt/phpproject.cn/apache2/htdocs;
	location ~ \.php$ {
            include fastcgi_params;
            fastcgi_pass 127.0.0.1:82;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /opt/phpproject.cn/apache2/htdocs$fastcgi_script_name;
        }
	#include /alidata/server/nginx/conf/rewrite/ling2.conf;
	access_log  /alidata/log/nginx/access/ling2.log;
}

svn.conf

vi /alidata/dockerdata/nginx/config/svn.conf
server{
	listen 8443;
	location / {
		proxy_pass http://www.ling2.cn:8443/;
		proxy_redirect default;
	}
}

支持集群的tomcat镜像

Docker mysql集群

基础操作准备

  • 创建mysql
docker run --name mysql-master  -p 3306:3306 -v /alidata/dockerdata/mysqldata/mysql-master-slave-master:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Wb19831010! -d mysql
docker run --name mysql-slave  -p 3307:3306 -v /alidata/dockerdata/mysqldata/mysql-master-slave-slave:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Wb19831010! -d mysql
  • 外部访问
docker run -it --link mysql-master:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
docker run -it --link mysql-slave:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
  • 内部停止mysql
docker exec -it mysql bash
/etc/init.d/mysql stop
  • 外部停止服务
docker stop mysql-master 
docker stop mysql-slave

主从复制

  • 参考主主复制,即只需要设置一个主一个从,不需要都主都从

主-主复制

自己建容器网络

 docker network create -d bridge --subnet=172.18.0.0/16 mysql-master-master-bridge

创建容器

可以添加 --restart=always使开机或停机自动启动

mysql1

docker run --name mysql-master-master-mysql1 --restart=always -p 3306:3306 --net=mysql-master-master-bridge \
--ip=172.18.0.2 -v /alidata/dockerdata/mysqlmastermaster/mysql1:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=Wb19831010! -d mysql

mysql2

docker run --name mysql-master-master-mysql2 --restart=always -p 3317:3306 --net=mysql-master-master-bridge \
--ip=172.18.0.3 -v /alidata/dockerdata/mysqlmastermaster/mysql2:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=Wb19831010! -d mysql

mysql配置

  • log-bin = mysql-bin #名字
  • server-id = 1 # 各节点不同即可
  • expire-logs-days = 100 #过多少天清除日志
  • binlog-ignore-db = mysql #忽略库
  • log-slave-updates #这个参数用来配置从服务器的更新是否写入二进制日志,从库作为别人的主 需要
  • auto-increment-increment = 2 # 自增长度
  • auto-increment-offset = 1 # 从多少开始,防止自增主键同步重复
vi /alidata/dockerdata/mysqlmastermaster/mysql1/config-file.cnf 
[mysqld]

log-bin = mysql-bin

server-id = 1

expire-logs-days  = 100

binlog-ignore-db  = mysql

log-slave-updates

auto-increment-increment = 2

auto-increment-offset = 1
 vi /alidata/dockerdata/mysqlmastermaster/mysql2/config-file.cnf 
[mysqld]
log-bin   = mysql-bin

server-id = 2 

expire-logs-days  = 100 

binlog-ignore-db  = mysql

log-slave-updates

auto-increment-increment = 2 

auto-increment-offset = 2
docker restart mysql-master-master-mysql1
docker restart mysql-master-master-mysql2

开始设置主从复制

使用sqllog连接mysql docker_hostip:3316/ docker_hostip:3317

docker run -it --net mysql-master-master-bridge --link  mysql-master-master-mysql1:mysql --rm mysql sh -c 'exec mysql -h"172.18.0.2" -P"3306" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
docker run -it --net mysql-master-master-bridge --link  mysql-master-master-mysql2:mysql --rm mysql sh -c 'exec mysql -h"172.18.0.3" -P"3306" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'

mysql1

GRANT REPLICATION SLAVE ON *.* TO 'mysync'@'%' IDENTIFIED BY 'Wb19831010!';
SHOW MASTER status;
mysql-bin.000004  436

mysql2

GRANT REPLICATION SLAVE ON *.* TO 'mysync'@'%' IDENTIFIED BY 'Wb19831010!';
SHOW MASTER STATUS;
mysql-bin.000003 436
reset slave
CHANGE MASTER TO MASTER_HOST='172.18.0.2',MASTER_USER='mysync',MASTER_PASSWORD='Wb19831010!', MASTER_LOG_FILE='SHOW MASTER status mysql1看到的file',MASTER_LOG_POS=mysql1看到的position;
CHANGE MASTER TO MASTER_HOST='172.18.0.2',MASTER_USER='mysync',MASTER_PASSWORD='Wb19831010!', MASTER_LOG_FILE='mysql-bin.000004',MASTER_LOG_POS=436;
START SLAVE;
SHOW SLAVE STATUS;

mysql1

reset slave
CHANGE MASTER TO MASTER_HOST='172.18.0.3',MASTER_USER='mysync',MASTER_PASSWORD='Wb19831010!', MASTER_LOG_FILE='SHOW MASTER status mysql2看到的file',MASTER_LOG_POS=mysql2看到的position;
CHANGE MASTER TO MASTER_HOST='172.18.0.3',MASTER_USER='mysync',MASTER_PASSWORD='Wb19831010!', MASTER_LOG_FILE='mysql-bin.000003',MASTER_LOG_POS=436;
START SLAVE;
SHOW SLAVE STATUS;
grant replication slave on *.* to 'slave'@'192.168.100.%' identified by '308731044';
  • replication slave:远程用户备份权限
  • *.*:第一个星号代表库,第二个星号代表数据库里的表。可指定库和表
  • 'slave'@'192.168.100.%':@前为用户名,@后为授权的IP段(就是允许那些IP使用这个账号权限访问)
  • '308731044':远程备份用户密码

参考文章 mysql 双主配置 基于docker 测试 及数据恢复测试

MySql5.7-多源复制(多主单从)

[MySql5.7-多源复制(多主单从)=]

多节点主从+MHA/MMM

参考MySQL Cluster搭建及配置

更多参考

MySQL高可用与负载均衡架构 实战体验几种MySQLCluster方案 双机高可用、负载均衡、MySQL(读写分离、主从自动切换)架构设计 reset master和reset slave

支持主从的的redis镜像

docker run --name gitlab-redis -d  --restart=always --volume /alidata/dockerdata/redisdata/gitlab:/var/lib/redis sameersbn/redis:latest
docker run --name cloud-redis --restart=always -d -p 6379:6379 --volume /alidata/dockerdata/redisdata/cloud:/var/lib/redis redis:latest

支持主从的的mongo镜像

wordpress

docker run --name wordpress --link mysql1:mysql -p 8100:80 -d wordpress

postgresql

docker run --name gitlab-postgresql -d --restart=always \
   --env 'DB_NAME=gitlabhq_production' \
   --env 'DB_USER=gitlab' --env 'DB_PASS=Wb19831010!' \
   --env 'DB_EXTENSION=pg_trgm' \
   --volume /alidata/dockerdata/postgresqldata/gitlab:/var/lib/postgresql \
   sameersbn/postgresql
docker run --name cloud-postgres --restart=always -d -p 5432:5432  \
   -e POSTGRES_PASSWORD=Wb19831010! -d  \
   --volume   /alidata/dockerdata/postgresqldata/cloud:/var/lib/postgresql  \
   postgres

云端开发环境docker-gitlab

  • 架构

Clouddevenv.png

docker run --restart=always --name gitlab -d \
   --link gitlab-postgresql:postgresql --link gitlab-redis:redisio \
   --publish 10022:22 --publish 10060:80 \
   --env 'GITLAB_PORT=10060' --env 'GITLAB_SSH_PORT=10022' \
   --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
   --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \
   --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \
   --volume /alidata/dockerdata/gitlabdata/gitlab1:/home/git/data \
   sameersbn/gitlab:latest


docker run --name gitlab1 -d \
   --link cloud-postgres:gitlab-postgresql1 --link cloud-redis:gitlab-redis1 \
   --publish 10022:22 --publish 10060:80 \
   --env 'GITLAB_PORT=10060' --env 'GITLAB_SSH_PORT=10022' \
   --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
   --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \
   --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \
   --volume /alidata/dockerdata/gitlabdata/gitlab1:/home/git/data \
   sameersbn/gitlab:latest

hadoop

hue

使用HUE来管理hadoop集群 Getting started with Hue in 1 minute with Docker

docker run -it -p 8888:8888 --name hue8888 gethue/hue:latest bash
docker cp --name hue8888:/hue/desktop/conf /hue

开发者模式

docker run -it -p 8888:8888 --name hue8888 gethue/hue:latest ./build/env/bin/hue runserver_plus 0.0.0.0:8888
touch /alidata/dockerdata/hue/pseudo-distributed.ini
vi /alidata/dockerdata/hue/pseudo-distributed.ini
docker run -tid --name hue8888 --hostname hue.ling2.cn \
 -p 8888:8888 -v /alidata/dockerdata/hue/hdp:/usr/hdp -v /alidata/dockerdata/hue/hadoop:/etc/hadoop \
 -v /alidata/dockerdata/hue/hive:/etc/hive -v /alidata/dockerdata/hue/hbase:/etc/hbase \
 -v /alidata/dockerdata/hue/pseudo-distributed.ini:/hue/desktop/conf/pseudo-distributed.ini \
  gethue/hue:latest ./build/env/bin/hue runserver_plus 0.0.0.0:8888
  • -i 标志保证容器中STDIN是开启的
  • -t 表示告诉docker要为创建的容器分配一个伪tty终端
  • -d 会把容器放到后台运行
  • --name alias_name 可以为这个docker指定一个别名, 要放前面, e.g.:docker run -tid --name alias_name images:version /bin/bash
  • --hostname 指定hostname, 类似--ip
  • -p docker 容器的端口:外部主机的端口, 作端口映射, 来公开在dockerfile里面定义的expose的所有端口.
  • -v 挂在目录, 外部主机目录:容器内部目录, 这里我挂在了 ambari的 hadoop配置文件/etc/hadoop, hive配置路径/etc/hive, hbase配置路径/etc/hbase, 以及用了本地的hue配置文件去替代docker里面的hue配置文件.
  • 最后是要启动容器后要运行的命令 ./build/env/bin/hue runserver_plus 0.0.0.0:8888

iredmail

[1]

启动一个容器

docker run -i -t --privileged --name iredmail registry.cn-hangzhou.aliyuncs.com/ling/centos:latest /bin/bash

修改host

vi /etc/hostname
mx.ling2.cn
sysctl kernel.hostname=mx.ling2.cn
vi /etc/hosts
127.0.0.1 mx.ling2.cn mx localhost localhost.localdomain

SELinux?

iRedMail 不支持 SELinux,所以需要在 /etc/selinux/config 文件里禁用它。

SELINUX=disabled

如果不希望禁用 SELinux,可以设置为让它打印警告信息但不强制限制:

SELINUX=permissive

也可以无须重启服务就禁用它:

setenforce 0

安装

cd /root/

主机中执行

docker cp /alidata/soft/iRedMail-0.9.6.tar.bz2 iredmail:/root/iRedMail-0.9.6.tar.bz2
tar xjf iRedMail-0.9.6.tar.bz2

直接上传后解压出问题了,将解压后的文件夹上传

docker cp /alidata/soft/iRedMail-0.9.6 iredmail:/root/iRedMail-0.9.6
IREDMAIL_MIRROR='http://173.254.22.21' \
IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel' \
USE_EXISTING_MYSQL='YES' \
   MYSQL_SERVER_ADDRESS='www.ling2.cn' \
   MYSQL_SERVER_PORT='3306' \
   MYSQL_ROOT_USER='root' \
   MYSQL_ROOT_PASSWD='Wb19831010!' \
   bash iRedMail.sh
  • Storage base directory: /var/vmail
  • Mailboxes:
  • Daily backup of SQL/LDAP databases:
  • Store mail accounts in: PostgreSQL
  • Web server: Nginx
  • First mail domain name: mail.ling2.cn
  • Mail domain admin: postmaster@mail.ling2.cn
  • Additional components: Roundcubemail SOGo Awstats iRedAdmin Fail2ban

阅读 /root/iRedMail-x.y.z/iRedMail.tips 文件,它包含了:

  • 各个 web 程序的访问地址(URL),用户名和密码。
  • 各个组件的配置文件路径。除此之外还应该阅读文档:Locations of configuration and log files of major components.
  • 以及其它一些重要和敏感信息
docker commit -m="centos base" -a="bo.wang" a7b887991ec9 docker.ling2.cn/iredmail

使用

docker run --privileged -i -t -d --name iredmail \
-p 25:25 -p 143:143 -p 587:587 -p 58:80 \
docker.ling2.cn/iredmail

问题解决

Got fatal error 1236 from master when reading data

  • 停止slave
slave stop
  • master刷新状态,并记录 File和 Position
flush logs
show master status
  • 马上到slave执行
CHANGE MASTER TO MASTER_HOST='172.18.0.3',MASTER_USER='mysync',MASTER_PASSWORD='Wb19831010!', MASTER_LOG_FILE='刚找到的file',MASTER_LOG_POS=刚找到的Position;
slave start;
show slave status;
  • 如果是双主,都执行一遍


  • 另一种解决方案,重置slave状态,有可能不一致.如果是双主,2个主都要执行一遍
stop slave;
show slave status;
reset slave;
show slave status;
start  slave;