当前位置:网站首页>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
边栏推荐
- Without 50W bride price, my girlfriend was forcibly dragged away. What should I do
- The least operation of leetcode simple problem makes the array increment
- Review the old and know the new: Notes on Data Science
- Introduction to JVM principle
- Messy change of mouse style in win system
- [research materials] 2021 China's game industry brand report - Download attached
- [luatos sensor] 1 light sensing bh1750
- 1114 family property (25 points)
- [set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
- Distinguish between releases and snapshots in nexus private library
猜你喜欢

The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping

Compile and decompile GCC common instructions

Symbol of array element product of leetcode simple problem

《牛客刷verilog》Part II Verilog进阶挑战

SSM framework integration

Review the configuration of vscode to develop golang

【批处理DOS-CMD命令-汇总和小结】-CMD窗口的设置与操作命令-关闭cmd窗口、退出cmd环境(exit、exit /b、goto :eof)

Actual combat 8051 drives 8-bit nixie tube

Thesis reading_ ICD code_ MSMN

Thesis reading_ Chinese medical model_ eHealth
随机推荐
[tools run SQL blind note]
Interface frequency limit access
1099 build a binary search tree (30 points)
Oracle SQL table data loss
Market status and development prospects of the global automatic tea picker industry in 2022
@RequestMapping
Sprintf formatter abnormal exit problem
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
Shuttle + alluxio accelerated memory shuffle take-off
Automatic voltage rise and fall 5-40v multi string super capacitor charging chip and solution
The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection
Prepare for 2022 and welcome the "golden three silver four". The "summary of Android intermediate and advanced interview questions in 2022" is fresh, so that your big factory interview can go smoothly
Three representations of signed numbers: original code, inverse code and complement code
[SQL injection point] location and judgment of the injection point
MC Layer Target
[SQL injection] joint query (the simplest injection method)
Market status and development prospect prediction of global fermentation acid industry in 2022
[research materials] the fourth quarter report of the survey of Chinese small and micro entrepreneurs in 2021 - Download attached
112 stucked keyboard (20 points)
[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)