/usr/local/mysql/bin/mysqldump-ubackup --password=123456 --host=192.168.52.138--socket=/usr/local/mysql3307/mysql.sock --port=3307 -R -E --skip-opt--single-transaction --flush-logs --master-data=2 --add-drop-table--create-option --quick --extended-insert=false --set-charset --disable-keys-A > /tmp/alldbfullbackup.sql
导入:
/usr/local/mysql/bin/mysql-uroot -p --socket=/usr/local/mysql3308/mysql.sock --port=3308</tmp/alldbfullbackup.sql
9.3,在3308实例上建立复制链接
找到复制点
more/tmp/alldbfullbackup.sql
开始建立复制链接
CHANGE MASTER TOMASTER_HOST='192.168.52.138',MASTER_PORT=3307,
MASTER_USER='repl',
MASTER_PASSWORD='repl_1234',
MASTER_LOG_FILE='mysql-bin.000006',
MASTER_LOG_POS=120;
开启复制
startslave;
查看复制状态
showslave status\G;
mysql> show slave status\G
*************************** 1. row***************************
Slave_IO_State: Waiting formaster to send event
Master_Host: 192.168.52.138
Master_User: repl
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: mysql-bin.000011
Read_Master_Log_Pos: 120
Relay_Log_File:mysql-relay-bin.000005
Relay_Log_Pos: 283
Relay_Master_Log_File: mysql-bin.000011
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
……
Seconds_Behind_Master: 0
10,管理单个实例
停止实例2:
[root@data03 ~]# mysqld_multi--defaults-extra-file=/etc/my.cnf stop 2
[root@data03 ~]#
后台日志信息:
Stopping MySQL servers
150517 06:53:43 mysqld_safe mysqld from pidfile /usr/local/mysql3308/mysqld.pid ended
mysqld_multi log file version 2.16; run: 日 5月 17 06:53:48 2015
启动实例2:
[root@data03 ~]# mysqld_multi--defaults-extra-file=/etc/my.cnf start 2
[root@data03 ~]#
后台日志信息:
Starting MySQL servers
150517 06:53:48 mysqld_safe Logging to'/home/data/mysql3308/data/data03.err'.
150517 06:53:48 mysqld_safe Starting mysqlddaemon with databases from /home/data/mysql3308/data
11,如何使用多实例
由于多实例中,各个实例的资源都是不share的,所以要合理分配好各个实例的内存、磁盘等资源,避免out of memery或则 full disk的情况出现。
--------------------------------------分割线 --------------------------------------
Ubuntu 14.04下安装MySQL