Docker practice: mysql Master/Slave backup read/write splitting, dockermysql
1) download the msql Image File
docker pull mysql/mysql-server
You can also specify the mysql version.
docker pull mysql/mysql-server:5.7
View image filesDocker images
2) set the DirectoryTo keep MySql Data on the host machine, create several
Mysql 5.7 docker master-slave replication architecture setup, mysqldockerEnvironment version: MySQL: 5.7.13Docker: 1.11.2CentOS: 7.11. install two MySQL instances on two physical machines. The command is as follows:Docker pull mysql: 5.7.13docker run -- name anuo-mysql-p 3306: 3306-e MYSQL_ROOT_PASSWORD = qaz.00JK-d mysql: 5.7.132. Create a duplicate account on the master databaseGrant replication
Tags: note encountered technical SBO file directory is the lazy perm SQThis blog post is relatively simple, because it is the first time to use the master-slave copy of Docker,mysql in the CentOS environment, but also forget about the same, so this attempt to build in Docker.According to the online tutorial walk or step on some pits, but fortunately finally build success, so record down, to avoid stepping o
Before the Docker operation, set up the directory, my path is d:/docker/mysql, the directory structure is as follows:--mysql --master --data --conf --my.cnf --slaver --data --conf --my.cnf 1. master-Slave configuration fileMaster:my.cnf[mysqld]server_id = 1log-bin= mysql-binread-only=0binlog-do-db=bloggingreplicat
Share MySQL 5.7 docker master-slave replication Architecture Tutorial for your reference, the specific contents are as follows
Environment version:mysql:5.7.13docker:1.11.2centos:7.1
1. Install two MySQL on two physical machines first. Commands are as follows
Copy Code code as follows:
Docker Pull mysql:5.7.13
Because recently in learning MySQL, see a lot of places have "sub-database sub-table", "Read and write separation" word, want to try it!First of all, because of my limited financial capacity, can not afford so many servers, so I borrowed Docker to build a virtual machine to serve as two servers.First, prepare the master-slave server1. Create a master server$docker
Tags: mod names efault GNU socket sha Details C11 useConfigure MySQL master-slave under native DockerInstall the Docker MySQL container first$ docker pull MySQL:5.6Pull two identical versions of MySQLStart MySQL separately and set the root user password to admin:// Master MySQL 3307:3306-d-e mysql_root_password=admin--name mysql-
:
Docker build-t Zhangchao/mysql-master5.7:v1.
Be careful not to drop the last point at the end of the line.
Generate a new container based on a compiled mirror:
Docker run--name mysql-master \
p 3306:3306 \
-v/zc/mysql-master/datadir:/var/lib/mysql \
e mysql_root_ Password= ' 123456 '-D zhangchao/mysql-master5.7:v1
Using MySQL client to connect to the MySQL master server, the aut
Docker MySQL master-slave configuration
1, first create two file my-m.cnf (main library configuration), MY-S.CNF (from the library configuration)
MY-M.CNF content is as follows
# Copyright (c) 2014, Oracle and/or its affiliates.
All rights reserved. # this are free software; Can redistribute it and/or modify # it under the terms of the GNU general public License as published Ftware Foundation;
Versio
Tags: error comm value slave user roo bin tab uitableDocker EXEC commandDocker exec: Executing commands in a running containerGrammarDocker exec [OPTIONS] CONTAINER COMMAND [ARG ...]Options Description:-D: Detach mode: Run in background-I: Keep stdin open even without attaching-T: Assigning a pseudo terminal
Scriptcat/server/scripts/mysql.sh#!/bin/bashDocker exec-t docke_mysql mysql-uroot-p123456-e "show s
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.