当前位置:网站首页>MySQL master-slave configuration
MySQL master-slave configuration
2022-07-03 04:58:00 【Home of Jace】
- MySQL install
1. wget install
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.36.tar.gz
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
2. docker install
docker search mysql # lookup mysql Mirror image
docker pull mysql:tag # Install the specified tag Version of MySQL, Don't write :tag , The default is latest
docker run --name your-mysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:5.7 # start-up MySQL Containers
- Master configuration
1. First step
#mysql master1 config/ Master configuration
[mysqld]
server-id = 1 # node ID, Ensure uniqueness
# log config
log-bin = mysql-bin # Turn on mysql Of binlog Log function
sync_binlog = 1 # Control of the database binlog Brush it to disk , 0 Don't control , Best performance ,1 Every time a transaction is committed, it will be brushed into the log file , The worst performance , Safest
binlog_format = mixed #binlog Log format ,mysql By default statement, It is recommended to use mixed
expire_logs_days = 7 #binlog Overdue cleaning time
max_binlog_size = 100m #binlog Size of each log file
binlog_cache_size = 4m #binlog Cache size
max_binlog_cache_size= 512m # Maximum binlog Cache size
binlog-ignore-db=mysql # A database that does not generate log files , Multiple ignore databases can be spliced with commas , perhaps Copy this sentence , Write multiple lines
auto-increment-offset = 1 # Offset of self increment
auto-increment-increment = 1 # Self increment of self increment
slave-skip-errors = all # Skip from library error
2. The second step
Get into master The database of , by master Create replication users
CREATE USER repl_user IDENTIFIED BY ' password ';
3. The third step
grant replication slave on *.* to 'repl_user'@'ip Address ' identified by ' password ';
FLUSH PRIVILEGES;
4. Step four
show master status; see master state
- From node configuration
1. First step
[mysqld]
server-id = 2
log-bin=mysql-bin
relay-log = mysql-relay-bin
replicate-do-db = Your database name
slave-skip-errors = all
2. The second step
change master to master_host='master node IP', master_user='repl_user', master_password=' password ', master_log_file='mysql-bin.000068', master_log_pos=1851774;
among master_log_file ,master_log_pos by show master status; Value printed by the command
边栏推荐
- Interface frequency limit access
- The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping
- 2022-02-11 daily clock in: problem fine brush
- Kept hot standby and haproxy
- Market status and development prospects of the global IOT active infrared sensor industry in 2022
- 【工具跑SQL盲注】
- 【SQL注入点】注入点出现位置、判断
- 【SQL注入】联合查询(最简单的注入方法)
- [research materials] the fourth quarter report of the survey of Chinese small and micro entrepreneurs in 2021 - Download attached
- [backtrader source code analysis 4] use Python to rewrite the first function of backtrader: time2num, which improves the efficiency by 2.2 times
猜你喜欢
2022-02-12 daily clock in: problem fine brush
并发操作-内存交互操作
Interface frequency limit access
Online VR model display - 3D visual display solution
String matching: find a substring in a string
论文阅读_中文医疗模型_ eHealth
Use Sqlalchemy module to obtain the table name and field name of the existing table in the database
ZABBIX monitoring of lamp architecture (3): zabbix+mysql (to be continued)
Learn to use the idea breakpoint debugging tool
Shuttle + alluxio accelerated memory shuffle take-off
随机推荐
General undergraduate college life pit avoidance Guide
【批处理DOS-CMD命令-汇总和小结】-CMD窗口的设置与操作命令-关闭cmd窗口、退出cmd环境(exit、exit /b、goto :eof)
Without 50W bride price, my girlfriend was forcibly dragged away. What should I do
[XSS bypass - protection strategy] understand the protection strategy and better bypass
Review the configuration of vscode to develop golang
Notes | numpy-09 Broadcast
Market status and development prospect prediction of the near infrared sensor industry of the global Internet of things in 2022
普通本科大学生活避坑指南
[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
Unity tool Luban learning notes 1
Introduction to JVM principle
论文阅读_中文医疗模型_ eHealth
Uipath practice (08) - selector
Current market situation and development prospect prediction of global direct energy deposition 3D printer industry in 2022
Objects. Requirenonnull method description
First + only! Alibaba cloud's real-time computing version of Flink passed the stability test of big data products of the Institute of ICT
Market status and development prospect prediction of global fermentation acid industry in 2022
Distinguish between releases and snapshots in nexus private library
Interface frequency limit access