Home  >  Article  >  Database  >  mysql数据库服务器的调整_MySQL

mysql数据库服务器的调整_MySQL

WBOY
WBOYOriginal
2016-06-01 13:01:061004browse

前天给客户做一次数据库服务器的调整,把以前的一台主机废弃,一台从库提升为主,然后新加入其他从机,这里记录下操作步骤:

一、老主库开启只读,以便后面步骤出问题回滚回来:flush tables with read lock

二、110.10.1.102升级为主库,暂停同步,重置为主,清理中继信息,重启数据库

stop slave , reset master , mv master.info relay.log /tmp

修改配置文件my.cnf 加入expire_logs_days=15和innodb_file_per_table

三、开启新主库只读:flush tables with read lock

导出逻辑备份:mysqldump -u root -p --single-transaction -R --flush-logs --master-data=1 -databases db1 db2 db3> database1204.sql

四、show master status,往新的从库导入数据,并change master

五、最后查看所有从库的状态信息,show slave status,并unlock 主库的tables

提醒一点,mysql5.5的版本不再支持/etc/my.cnf 里的masterhost等参数,必须要连上mysql执行change master

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn