1.安装 docker:
1.安装依赖包:yum install -y device-mapper-persistent-data lvm2
2.设置 yum 库:yum-config-manager --add-repo http://mirrors.aliyun.com/docker-
ce/linux/centos/docker-ce.repo
3.测试 yum 库是否正常:yum makecache timer
4.安装最新版的 docker:yum install -y docker-ce
5.启动以及开机自启:systemctl start docker && systemctl enable docker
2.获取 mariadb 镜像:docker pull mariadb
3.主从编辑文件到本地主机:
1.创建路径:mkdir /mariadb /mysql
2.编辑文件:vim /mariadb/my.cnf
[client-server]
socket = /run/mysqld/mysqld.sock
[mysql]
no-auto-rehash
[mysqld]
log-bin=mariadb-bin
binlog_format=mixed
expire_logs_days = 3
max_binlog_size = 1G
server-id=3000 #多台 id 不一样
port=33007 #端口号
log-slave-updates
binlog_cache_size = 256K
thread_stack = 512K
join_buffer_size = 8192K
max_heap_table_size = 1024M
default_storage_engine = InnoDB
table_definition_cache = 400
key_buffer_size = 1024M
max_allowed_packet = 100G
table_open_cache = 2048
sort_buffer_size = 4096K
net_buffer_length = 4K
read_buffer_size = 4096K
read_rnd_buffer_size = 2048K
thread_cache_size = 256
tmp_table_size = 2048M
sql-mode=NO_ENGINE_SUBSTI