root@rsus [~]# ls -al /root/
-rw------- 1 root root 39 Dec 18 2013 .my.cnf
root@rs03us [~]# cat .my.cnf
[client]
password="#$6pqo<4"
user=root
=====================
This is the full step-by-step procedure to resync a master-slave replication from scratch:
-rw------- 1 root root 39 Dec 18 2013 .my.cnf
root@rs03us [~]# cat .my.cnf
[client]
password="#$6pqo<4"
user=root
=====================
This is the full step-by-step procedure to resync a master-slave replication from scratch:
At the master:
RESET MASTER; FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS;
And copy the values of the result of the last command somewhere.
Wihtout closing the connection to the client (because it would release the read lock) issue the command to get a dump of the master:
mysqldump -uroot -p --all-databases > /a/path/mysqldump.sql
NOTE: With INNODB typed dabatase and other complex column types like BLOB and DATE defined, recommend using the following switches: --opt --single-transaction --comments --hex-blob --dump-date --no-autocommit --all-databases
Now you can release the lock, even if the dump hasn't end. To do it perform the following command in the mysql client:
UNLOCK TABLES;
Now copy the dump file to the slave using scp or your preferred tool.
At the slave:
Open a connection to mysql and type:
STOP SLAVE;
Load master's data dump with this console command:
mysql -uroot -p < mysqldump.sql
Sync slave and master logs:
RESET SLAVE; CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=98;
Where the values of the above fields are the ones you copied before.
Finally type
START SLAVE;
And to check that everything is working again, if you type
SHOW SLAVE STATUS;
you should see:
Slave_IO_Running: Yes Slave_SQL_Running: Yes
= = = = = = Error : mysql out of resources = = = = = = =
The mysql error: Out of resources when opening file... (Errcode: 24) indicates that the number of files that msyql is permitted to open has been exceeded.
Last_SQL_Error: Error 'Out of resources when opening file './thssedu_scl/' (Errcode: 24)' on query. Default database: 'thssedu_scl'. Query: 'ALTER TABLE thss_bsk_pdf_manager_cats CHANGE COLUMN id `id` int(11) NOT NULL AUTO_INCREMENT'
root@localhost [~]# mysql -e 'show variables;' | grep open
have_openssl DISABLED
innodb_open_files 300
open_files_limit 1024
table_open_cache 400
we have to increase that value:
vim /etc/my.cnf
[mysqld]
open_files_limit = 2024
Then be sure to restart mysql with: sudo /etc/init.d/mysql restart
A good rule of thumb is to take the current number of files and add 1000 to it. If this doesn't help, add some more. This number affects the amount of memory that MySQL uses, so setting it to a very high number is not a good idea.
No comments:
Post a Comment