Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of configuring Master and Slave on-line by Mysql using percona-xtrabackup

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "Mysql uses percona-xtrabackup online configuration master-slave method", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "Mysql uses percona-xtrabackup online configuration master-slave method"!

Mysql uses percona-xtrabackup to configure master-slave online

I. Install Mysql separately on the master and slave

compile and install

yum -y install make gcc-c++ cmake bison-devel ncurses-devel

groupadd mysql

useradd -g mysql mysql

mkdir -p /usr/local/mysql

[root@TESTDB02-1-16 tools]# tar -xf mysql-5.6.27.tar.gz

[root@TESTDB02-1-16 tools]# cd mysql-5.6.27

[root@TESTDB02-1-16 mysql-5.6.27]# pwd

/usr/local/tools/mysql-5.6.27

[root@TESTDB02-1-16 mysql-5.6.27]# mkdir -p /u02/mysql/data

[root@TESTDB02-1-16 mysql-5.6.27]# chown -R mysql:mysql /u02/mysql

cmake \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/u02/mysql/data \

-DSYSCONFDIR=/etc \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DEXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci

make;

make install;

vim /etc/my.cnf

[client]

port = 3306

socket = /tmp/mysql.sock

[mysql]

#prompt="(\u:HOSTNAME:)[\d]> "

prompt="\u@\h \R:\m:\s [\d]> "

no-auto-rehash

[mysqld]

user = mysql

port = 3306

socket = /tmp/mysql.sock

basedir = /usr

datadir = /u02/mysql/data

character-set-server = utf8mb4

skip_name_resolve = 1

open_files_limit = 3072

back_log = 103

max_connections = 512

max_connect_errors = 100000

table_open_cache = 512

external-locking = FALSE

max_allowed_packet = 32M

sort_buffer_size = 2M

join_buffer_size = 2M

thread_cache_size = 51

query_cache_size = 22M

#default_table_type = InnoDB

tmp_table_size = 96M

max_heap_table_size = 96M

slow_query_log = 1

slow_query_log_file = /u02/mysql/log/slow.log

log-error = /u02/mysql/log/error.log

long_query_time = 3

server-id = 77

log-bin = /u02/mysql/log_bin/log_bin

sync_binlog = 1

binlog_cache_size = 4M

max_binlog_cache_size = 8M

max_binlog_size = 1024M

expire_logs_days = 1

master_info_repository = TABLE

relay_log_info_repository = TABLE

gtid_mode = on

enforce_gtid_consistency = 1

log_slave_updates

binlog_format = row

relay_log_recovery = 1

key_buffer_size = 15M

read_buffer_size = 1M

read_rnd_buffer_size = 16M

bulk_insert_buffer_size = 64M

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

#myisam_max_extra_sort_file_size = 10G

myisam_repair_threads = 1

myisam_recover

transaction_isolation = REPEATABLE-READ

innodb_additional_mem_pool_size = 16M

innodb_buffer_pool_size = 502M

innodb_buffer_pool_load_at_startup = 1

innodb_buffer_pool_dump_at_shutdown = 1

innodb_data_file_path = ibdata1:1024M:autoextend

innodb_flush_log_at_trx_commit = 1

innodb_log_buffer_size = 16M

innodb_log_file_size = 2G

innodb_log_files_in_group = 2

innodb_io_capacity = 4000

innodb_io_capacity_max = 8000

innodb_max_dirty_pages_pct = 50

innodb_flush_method = O_DIRECT

innodb_file_format = Barracuda

innodb_file_format_max = Barracuda

innodb_lock_wait_timeout = 10

innodb_rollback_on_timeout = 1

innodb_print_all_deadlocks = 1

innodb_file_per_table = 1

innodb_locks_unsafe_for_binlog = 0

[mysqldump]

quick

max_allowed_packet = 32M

Master Library:

cd /usr/local/mysql/scripts

[root@ scripts]# ./ mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/u02/mysql/data/

cp ./ support-files/mysql.server /etc/init.d/mysqld

Master Library Change Password

Import required library

mysql -uroot -p test

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report