91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Mysql利用percona-xtrabackup在線配置主從的方法

發布時間:2021-09-16 14:28:43 來源:億速云 閱讀:119 作者:chen 欄目:MySQL數據庫

這篇文章主要講解了“Mysql利用percona-xtrabackup在線配置主從的方法”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“Mysql利用percona-xtrabackup在線配置主從的方法”吧!

Mysql 利用percona-xtrabackup在線配置主從
一.在主從上分別安裝Mysql

編譯安裝
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
主庫:
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
主庫修改密碼

導入所需求庫
mysql -uroot -p test <test.sql

利用percona-xtrabackup備份庫
主從安裝percona-xtrabackup
wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.2.10/binary/redhat/6/x86_64/percona-xtrabackup-2.2.10-1.el6.x86_64.rpm
innobackupex --socket=/data/mysql/mysql.sock --parallel=8 --user=root --password=XMSSSS /data/backup/hotbackup
scp -r /data/backup/hotbackup/* root@備庫:/u02/mysql/hotbackup
主庫建帳戶
GRANT REPLICATION SLAVE ON *.* TO '用戶名'@'從庫ip' IDENTIFIED BY '密碼';

從庫恢復
cd /u02/mysql/hotbackup
注意在從庫恢復之前建好my.cnf,如果主庫打開忽略大小寫,從庫也要一樣,不然會報錯
innobackupex --user=root --password=密碼 --defaults-file=/etc/my.cnf --apply-log /u02/mysql/hotbackup/2015-10-28_17-30-50/
innobackupex --copy-back /u02/mysql/hotbackup/2015-10-28_17-30-50/
chown -R mysql:mysql /u02/mysql
service mysql start
cat xtrabackup_binlog_info
log_bin.000006 928891450

記住此logbin和pos
CHANGE MASTER TO MASTER_HOST='主IP', MASTER_USER='用戶名', MASTER_PASSWORD='密碼', MASTER_LOG_FILE='log_bin.000006', MASTER_LOG_POS=928891450;
start slave;
show slave status \G

感謝各位的閱讀,以上就是“Mysql利用percona-xtrabackup在線配置主從的方法”的內容了,經過本文的學習后,相信大家對Mysql利用percona-xtrabackup在線配置主從的方法這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

泸定县| 红安县| 将乐县| 贵德县| 大洼县| 枣庄市| 宁陵县| 闻喜县| 长泰县| 乌拉特中旗| 随州市| 吉安市| 报价| 龙南县| 泰兴市| 榆中县| 三原县| 高邮市| 揭阳市| 宣威市| 内丘县| 涟水县| 安福县| 望城县| 长沙市| 灵川县| 周宁县| 新乡县| 闵行区| 虹口区| 龙海市| 湖南省| 浮山县| 乐都县| 黎平县| 驻马店市| 青冈县| 永丰县| 青铜峡市| 边坝县| 南平市|