Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2802991
  • 博文数量: 389
  • 博客积分: 4177
  • 博客等级: 上校
  • 技术积分: 4773
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-16 23:29
文章分类

全部博文(389)

分类: Mysql/postgreSQL

2014-01-09 22:35:15

                                 MySQL数据库迁移问题处理一则

  某日在做mysql迁移,使用的方法为冷拷贝所有数据文件到相同的版本的服务器上。目标服务器上
只是硬件配置要高,os和mysql本身的版本与源库的版本一致.

  当源库的data目录都拷贝到目标服务器后,使用mysqld_safe来启动mysqld时,发现总无法启动

[root@c12 goldengate]# /usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=/usr/local/mysql/data
140109 14:20:26 mysqld_safe Logging to '/var/log/mysqld.log'.
140109 14:20:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140109 14:20:26 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

首先检查了一下pid-file目录是存在的,并且也有读写权限.

查看日志/var/log/mysqld.log

140109 14:20:26 InnoDB: Initializing buffer pool, size = 128.0M
140109 14:20:26 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata did not exist:
InnoDB: a new database to be created!
140109 14:20:26  InnoDB: Setting file ./ibdata size to 10 MB
InnoDB: Database physically writes the file full: wait...
140109 14:20:26 InnoDB: Error: all log files must be created at the same time.
140109 14:20:26 InnoDB: All log files must be created also in database creation.
140109 14:20:26 InnoDB: If you want bigger or smaller log files, shut down the
140109 14:20:26 InnoDB: database and make sure there were no errors in shutdown.
140109 14:20:26 InnoDB: Then delete the existing log files. Edit the .cnf file
140109 14:20:26 InnoDB: and start the database again.
140109 14:20:26 [ERROR] Plugin 'InnoDB' init function returned error.
140109 14:20:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140109 14:20:26 [ERROR] Unknown/unsupported storage engine: InnoDB
140109 14:20:26 [ERROR] Aborting

最后面显示Unknown/unsupported storage engine: InnoDB,竟然innodb不支持.


难道这个版本上innodb使用有问题。在目标库上重新初始化了mysql,发现启动正常,innodb
没有任何问题


这下很无语了,当时时间有点紧,没有往出错的时候日志上看.再往上看显示的是

140109 14:20:26 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata did not exist:
InnoDB: a new database to be created!

我们的方案是从源库拷贝所有数据文件过来的,在这里怎么还要创建./ibdata呢?想想肯定有参数定义错误了
最大的嫌疑对像是innodb_data_file_path

innodb_data_file_path=ibdata:10M:autoextend

仔细一看原来是漏了一个'1'忘掉了,正确的应该是  ibdata1:10M:autoextend.看来dba细心很重要啊.


 

阅读(2804) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~