云服务器网:购买云服务器和VPS必上的网站!

新建主服务器容器

新建主服务器容器实例3307
dockerpullmysql:5.7
dockerrun-p3307:3306–namemysql-master\\-v/home/mysql-master/log:/var/log/mysql\\-v/home/mysql-master/data:/var/lib/m

新建主服务器容器实例3307

dockerpullmysql:5.7

dockerrun-p3307:3306–namemysql-master\
-v/home/mysql-master/log:/var/log/mysql\
-v/home/mysql-master/data:/var/lib/mysql\
-v/home/mysql-master/conf:/etc/mysql\
-eMYSQL_ROOT_PASSWORD=root\
-dmysql:5.7

运行结果

[[email protected]/*<![CDATA[*/!function(t,e,r,n,c,a,p,m,o){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e–;)if(t[e].getAttribute('data-yjshash'))returnt[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-yjsemail')){for(e='',o=0,r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2){m=('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);if((a.length-n)=128)o=(parseInt(m)1)break;e+=’%’+m;}p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/*]]>*/home]#dockerrun-p3307:3306–namemysql-master\
>-v/home/mysql-master/log:/var/log/mysql\
>-v/home/mysql-master/data:/var/lib/mysql\
>-v/home/mysql-master/conf:/etc/mysql\
>-eMYSQL_ROOT_PASSWORD=root\
>-dmysql:5.7
8b5bc09ae8ebd0a4c3ab6bce6f96684bb03a5da8b5b86d2a3518351cae773d2f
[[email protected]/*<![CDATA[*/!function(t,e,r,n,c,a,p,m,o){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e–;)if(t[e].getAttribute('data-yjshash'))returnt[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-yjsemail')){for(e='',o=0,r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2){m=('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);if((a.length-n)=128)o=(parseInt(m)1)break;e+=’%’+m;}p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/*]]>*/home]#dockerps
CONTAINERIDIMAGECOMMANDCREATEDSTATUSPORTSNAMES
8b5bc09ae8ebmysql:5.7″docker-entrypoint.s…”58secondsagoUp56seconds33060/tcp,0.0.0.0:3307->3306/tcpmysql-master

[[email protected]/*<![CDATA[*/!function(t,e,r,n,c,a,p,m,o){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e–;)if(t[e].getAttribute('data-yjshash'))returnt[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-yjsemail')){for(e='',o=0,r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2){m=('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);if((a.length-n)=128)o=(parseInt(m)1)break;e+=’%’+m;}p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/*]]>*/home]#ll
总用量8
drwx——.2lsplsp40964月112018lsp
drwxr-xr-x.5rootroot40964月415:13mysql-master
[[email protected]/*<![CDATA[*/!function(t,e,r,n,c,a,p,m,o){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e–;)if(t[e].getAttribute('data-yjshash'))returnt[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-yjsemail')){for(e='',o=0,r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2){m=('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);if((a.length-n)=128)o=(parseInt(m)1)break;e+=’%’+m;}p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/*]]>*/home]#

2.进入/home/mysql-master/conf目录下新建my.cnf

vimmy.cnf

[mysqld]
##设置server_id,同一局域网中需要唯一
server_id=101
##指定不需要同步的数据库名称
binlog-ignore-db=mysql
##开启二进制日志功能
log-bin=mall-mysql-bin
##设置二进制日志使用内存大小(事务)
binlog_cache_size=1M
##设置使用的二进制日志格式(mixed,statement,row)
binlog_format=mixed
##二进制日志过期清理时间。默认值为0,表示不自动清理。
expire_logs_days=7
##跳过主从复制中遇到的所有错误或指定类型的错误,避免slave端复制中断。
##如:1062错误是指一些主键重复,1032错误是因为主从数据库数据不一致
slave_skip_errors=1062

运行结果

[-rw-r–r–.1rootroot6884月415:25my.cnf
[[email protected]/*<![CDATA[*/!function(t,e,r,n,c,a,p,m,o){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e–;)if(t[e].getAttribute('data-yjshash'))returnt[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-yjsemail')){for(e='',o=0,r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2){m=('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);if((a.length-n)=128)o=(parseInt(m)1)break;e+=’%’+m;}p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/*]]>*/conf]#catmy.cnf
[mysqld]
##设置server_id,同一局域网中需要唯一
server_id=101
##指定不需要同步的数据库名称
binlog-ignore-db=mysql
##开启二进制日志功能
log-bin=mall-mysql-bin
##设置二进制日志使用内存大小(事务)
binlog_cache_size=1M
##设置使用的二进制日志格式(mixed,statement,row)
binlog_format=mixed
##二进制日志过期清理时间。默认值为0,表示不自动清理。
expire_logs_days=7
##跳过主从复制中遇到的所有错误或指定类型的错误,避免slave端复制中断。
##如:1062错误是指一些主键重复,1032错误是因为主从数据库数据不一致
slave_skip_errors=1062

[[email protected]/*<![CDATA[*/!function(t,e,r,n,c,a,p,m,o){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e–;)if(t[e].getAttribute('data-yjshash'))returnt[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-yjsemail')){for(e='',o=0,r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2){m=('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);if((a.length-n)=128)o=(parseInt(m)1)break;e+=’%’+m;}p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/*]]>*/conf]#

本文来源:https://www.yuntue.com/post/90521.html | 云服务器网,转载请注明出处!

关于作者: yuntue

云服务器(www.yuntue.com)是一家专门做阿里云服务器代金券、腾讯云服务器优惠券的网站,这里你可以找到阿里云服务器腾讯云服务器等国内主流云服务器优惠价格,以及海外云服务器、vps主机等优惠信息,我们会为你提供性价比最高的云服务器和域名、数据库、CDN、免费邮箱等企业常用互联网资源。

为您推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注