阿七

  • HOME
  • CATEGORY
    • TECH
    • ENG
    • VIDEO
    • Image
    • MUSIC
  • Baidu
  • MY LIST
LOVE LASTS FOREVER
  1. Home
  2. TECH
  3. Text

The master-slave hot standby of databese of wordpress

24/11/2018 1832Views 2Likes 0Comments

Introduction

The master-slave hot standby of database could improve the data security, stability, and efficient transmission of wordpress.

Configuration of steps

1 configure my.cnf in salve vps
server-id need different from the master
replicate-do-db: the database you want to syn

1
2
3
4
5
6
vim /etc/my.cnf
 
local-infile=0
innodb_file_per_table=on
replicate-do-db=database_name
server-id=2

2 input SHOW MASTER STATUS; in the master and remember the file and position

1
2
3
4
5
6
MariaDB [(none)]> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000004 |     23033|              |                  |
+------------------+----------+--------------+------------------+

3 input CHANGE MASTER TO MASTER_HOST in the slave
address: your database address
port: your database port
File: your begin file (mysql-bin.000004)
Position: begin position (23033)

1
2
3
4
5
6
7
8
MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST='address',\
    MASTER_USER='root',\                            
    MASTER_PASSWORD='password',\                      
    MASTER_PORT=PORT,\                                
    MASTER_LOG_FILE='File',\              
    MASTER_LOG_POS=Position,\                              
    MASTER_CONNECT_RETRY=10,\                          
    MASTER_HEARTBEAT_PERIOD=2;                        

4 input SHOW SLAVE STATUS\G in the slave database
if Slave_IO_Running and Slave_SQL_Running is yes that is successful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
MariaDB [(none)]> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: ADDRESS
                  Master_User: root
                  Master_Port: PORT
                Connect_Retry: 10
              Master_Log_File: mysql-bin.000004
          Read_Master_Log_Pos: 23033
               Relay_Log_File: mysqld-relay-bin.000023
                Relay_Log_Pos: 5273041
        Relay_Master_Log_File: mysql-bin.000004
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: DATABASE

Licensed under 知识共享署名 4.0 国际许可协议
Tag: web
Last:24/11/2018

frank

Love Lasts Forever

Like
< PREV
NEXT >

Comment

取消回复

frank

Love Lasts Forever

New Hot Rand
New Hot Rand
DirectAdmin 去掉邮件队列 Debian Directadmin 中设置 wordpress 最全的伪静态配置 vnstat 清零流量重新统计 忘记关于什么事情了 selinux DirectAdmin面板 删除log How to install htop on CentOS 7
DirectAdmin面板 删除log 5T 网盘申请 密码群主QQ DomainMegaBot segmentation fault 分析 防伸手党必备教程-教你百度 改善笔记本屏幕PWM调光晃眼软件 Beautiful Now - Zedd

© 2022 阿七 ALL RIGHTS RESERVED | Working

Theme Kratos Made By Seaton Jiang