Docker 部署 MYSQL-5.7 主从

一、拉取对应镜像

docker pull registry.cn-hangzhou.aliyuncs.com/farerboy/mysql:5.7

二、部署主节点

1、创建对应需要的目录

mkdir -p /wwwroot/opt/docker/mysql-master-3306/log
mkdir -p /wwwroot/opt/docker/mysql-master-3306/data
mkdir -p /wwwroot/opt/docker/mysql-master-3306/conf
touch /wwwroot/opt/docker/mysql-master-3306/conf/my.cnf

2、my.cnf 配置填充

[mysqld]
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
binlog_cache_size = 32K
thread_stack = 256K
join_buffer_size = 256K
query_cache_type = 0
max_heap_table_size = 128M
lower_case_table_names = 1
port = 3306
default_storage_engine = InnoDB
performance_schema_max_table_instances = 400
table_definition_cache = 400
skip-external-locking
key_buffer_size = 256M
table_open_cache = 1024
sort_buffer_size = 4096K
net_buffer_length = 4K
read_buffer_size = 4096K
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 64M
thread_cache_size = 128
query_cache_size = 0M
tmp_table_size = 128M

explicit_defaults_for_timestamp = true
#skip-name-resolve
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535

skip-ssl

log_bin = ON
server_id = 1
sync_binlog = 1
binlog_format = ROW
expire-logs-days=10
binlog-ignore-db = mysql
binlog_ignore_db = information_schema
binlog_ignore_db = performation_schema

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

内容解读:

sql_mode:设置MySQL的SQL模式,这里指定了一系列严格模式和错误处理模式,例如禁止日期字段中的零值、禁止自动创建用户等。

binlog_cache_size:指定了二进制日志缓存的大小,这是MySQL服务器用于存储二进制日志事件的缓冲区大小。

thread_stack:设置线程栈的大小,即每个MySQL线程的栈空间大小。

join_buffer_size:设置连接缓冲区的大小,用于执行连接操作时的中间结果缓存。

query_cache_type:设置查询缓存的类型&#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夸父CV

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值