MARIADB master-Slave backup record

Source: Internet
Author: User

First, the expected effect:

Environment: CentOS 6.5 mariadb 10.0.14 (MYSQL-V)

Primary server: 192.168.5.206 from server: 192.168.5.207 The primary server database has any changes from the service will be followed by changes.

Second, pre-preparation:

Ensure that the master-slave database data is consistent.

Three, configuration:

1?? Primary server: VI/ETC/MY.CNF.D/SERVER.CNF Add the following configuration to ensure that the Log-bin file exists, and that the permissions, the owning user group and MySQL are consistent.

 This  is  for The mysqld standalone daemon[mysqld]log-bin=/var/lib/mysql/log/master-binserver-id= 1

2?? The primary server increases the sync account and logs in from the server to synchronize the master server's data.

MariaDB [(None)]> GRANT REPLICATION slave,reload,super on * * to [email protected]'192.168.5.207 ' ' Password ' ; MariaDB [(None)]> Flush privileges;

Note: Backup: User name 192.168.5.207: From the server IP (IP limit) Password: login password

3?? From the server: VI/ETC/MY.CNF.D/SERVER.CNF Add the following configuration, the same guarantee Salve-bin, Relay-bin file exists, and permissions, the owning user group is consistent with MySQL.

 This  is  for The mysqld standalone daemon[mysqld]log-bin=/var/lib/mysql/log/salve-binserver-id=  2relay-log=/var/lib/mysql/log/relay-binlog-slave-updates=1Read -only=1

Restart from server service MySQL restart

4?? Master-Slave configuration:

master server: MariaDB [(none)]> show Master Status; +-------------------+----------+--------------+------------------+| File              | Position | binlog_do_db | binlog_ignore_db |+-------------------+----------+--------------+------------------+| Master-bin. 000003 |    17030 |              |                  | +-------------------+----------+--------------+------------------+1inset (  0.00 sec)
from server: MariaDB [(none)]> Change Master to master_host='192.168.5.206',    Master_user='Backup',    master_password='Password',    master_log_file='master-bin.000003',    master_log_pos=0; Query OK,0Rows Affected (0.03Sec

MariaDB [(None)]> start slave;
Query OK, 0 rows Affected (0.00 sec)

MariaDB [(none)]> show slave status \g;
1. Row ***************************
slave_io_state:waiting for Master to send event
master_host:192.168.5.206
Master_user:backup1
master_port:3306
connect_retry:60
master_log_file:master-bin.000004
read_master_log_pos:23773
relay_log_file:relay-bin.000004
relay_log_pos:24061
relay_master_log_file:master-bin.000004
Slave_io_running:yes
Slave_sql_running:yes
replicate_do_db:
replicate_ignore_db:
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:0
Last_error:
skip_counter:0
exec_master_log_pos:23773
relay_log_space:24640
Until_condition:none
Until_log_file:
until_log_pos:0
Master_ssl_allowed:no
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
seconds_behind_master:0
Master_ssl_verify_server_cert:no
last_io_errno:0
Last_io_error:
last_sql_errno:0
Last_sql_error:
Replicate_ignore_server_ids:
Master_server_id:1
MASTER_SSL_CRL:
Master_ssl_crlpath:
Using_gtid:no
Gtid_io_pos:
1 row in Set (0.00 sec)

Error:no query specified

So far, it's OK.

MARIADB master-Slave backup record

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.