docker exec -it 8b71301f25ed /bin/bash //8b71301f25ed为容器ID docker exec -it mysql-master /bin/bash //mysql-master为容器名称
这边看一下环境,他本身是centos 容器内部不一定和外部环境一致,比如说ubuntu和centos就不一样
这边我们主要
apt-get update
apt-get install vim
我们容器里面是
yum install vim -y
Loaded plugins: ovl
mysql-tools-community | 2.6 kB 00:00:00
mysql5.7-server-minimal
bash-4.2# ls
bin boot dev docker-entrypoint-initdb.d entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
bash-4.2# cd /etc
bash-4.2# ls
DIR_COLORS csh.cshrc gnupg hosts.deny libuser.conf mysql pki rc0.d rsyslog.d subgid xdg
DIR_COLORS.256color csh.login groff init.d localtime nsswitch.conf pm rc1.d sasl2 subuid xinetd.d
DIR_COLORS.lightbgcolor dbus-1 group inputrc login.defs nsswitch.conf.bak popt.d rc2.d securetty sysconfig yum
GREP_COLORS default group- issue logrotate.d openldap prelink.conf.d rc3.d security sysctl.d yum.conf
X11 depmod.d gshadow issue.net machine-id opt printcap rc4.d selinux system-release yum.repos.d
aliases dracut.conf gshadow- krb5.conf modprobe.d oracle-release profile rc5.d services system-release-cpe
alternatives dracut.conf.d gss krb5.conf.d modules-load.d os-release profile.d rc6.d shadow systemd
bash_completion.d environment host.conf ld.so.cache motd pam.d protocols redhat-release shadow- terminfo
bashrc exports hostname ld.so.conf mtab passwd python resolv.conf shells tmpfiles.d
binfmt.d filesystems hosts ld.so.conf.d my.cnf passwd- rc.d rpc skel udev
chkconfig.d gcrypt hosts.allow libaudit.conf my.cnf.d pkcs11 rc.local rpm ssl vimrc
bash-4.2# vim my.cnf
[mysqld]
同一局域网内注意要唯一
server-id=100
开启二进制日志功能,可以随便取(关键)
log-bin=master-bin
binlog-format=ROW // 二级制日志格式,有三种 row,statement,mixed
binlog-do-db=数据库名 //同步的数据库名称,如果不配置,表示同步所有的库