当前位置:网站首页>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
边栏推荐
- Learning record of arouter principle
- Market status and development prospect forecast of global heat curing adhesive industry in 2022
- String matching: find a substring in a string
- Market status and development prospect prediction of the near infrared sensor industry of the global Internet of things in 2022
- [USACO 2009 Dec S]Music Notes
- Notes | numpy-08 Advanced index
- Thesis reading_ Tsinghua Ernie
- Network security textual research recommendation
- Realize file download through the tag of < a > and customize the file name
- JQ style, element operation, effect, filtering method and transformation, event object
猜你喜欢
M1 Pro install redis
Source insight garbled code solution
Three representations of signed numbers: original code, inverse code and complement code
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
Thesis reading_ Chinese medical model_ eHealth
[USACO 2009 Dec S]Music Notes
移动端——uniapp开发记录(公共请求request封装)
Introduction to message queuing (MQ)
Interface frequency limit access
Do you know UVs in modeling?
随机推荐
The current market situation and development prospect of the global gluten tolerance test kit industry in 2022
[backtrader source code analysis 4] use Python to rewrite the first function of backtrader: time2num, which improves the efficiency by 2.2 times
论文阅读_中文医疗模型_ eHealth
Introduction to message queuing (MQ)
[SQL injection] joint query (the simplest injection method)
Market status and development prospects of the global automatic tea picker industry in 2022
Flutter monitors volume to realize waveform visualization of audio
2022-02-11 daily clock in: problem fine brush
Sdl2 + OpenGL glsl practice (Continued)
Market status and development prospect prediction of global SoC Test Platform Industry in 2022
Notes | numpy-08 Advanced index
Market status and development prospect prediction of the global forward fluorescent microscope industry in 2022
Valentine's day limited withdrawal guide: for one in 200 million of you
SSM framework integration
1099 build a binary search tree (30 points)
Basic use of Metasploit penetration testing framework
Messy change of mouse style in win system
MySQL winter vacation self-study 2022 12 (3)
112 stucked keyboard (20 points)
Notes | numpy-11 Array operation