BMS-HOSxP Community

HOSxP => MySQL => ข้อความที่เริ่มโดย: KHEMSAK ที่ เมษายน 21, 2011, 13:25:58 PM

หัวข้อ: innodb_file_per_table error
เริ่มหัวข้อโดย: KHEMSAK ที่ เมษายน 21, 2011, 13:25:58 PM
ช่วยด้วยครับ ใช้งานอยู่ดี login เข้ามาเจอข้อความ innodb_file_per_table เพิ่งมาเป็นครับ จะเป็น RAM 12 GB

[client]
port      = 3306
socket      = /var/lib/mysql/mysql.sock
#basedir   = /var/lib/mysql
#datadir   = /var/lib/mysql/data
default-character-set=tis620

[mysqld]
port      = 3306
socket      = /var/lib/mysql/mysql.sock
skip-locking

key_buffer = 1024M
max_allowed_packet = 32M
table_cache = 1000
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 1M
max_heap_table_size = 128M
myisam_sort_buffer_size = 128M
thread_cache = 8
query_cache_size= 256M

thread_concurrency = 8
default-character-set=tis620
skip-name-resolve
innodb_file_per_table
skip-character-set-client-handshake
init_connect = 'SET NAMES tis620'
max_connections = 1000
######################################## 5.1.25--->X  cpu multicore
innodb_thread_concurrency = 0

########################################

innodb_data_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql/

#############################   mysql 5.1.X
#innodb_log_arch_dir = /var/lib/mysql/
#############################
#############################
# add rc.local  --->  ulimit -n 30000     
#############################
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 512M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 32M
allow-keywords

[mysql]
no-auto-rehash
default-character-set=tis620

[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 1M
write_buffer = 1M

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 1M
write_buffer = 1M

[mysqlhotcopy]
interactive-timeout
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: manoi ที่ เมษายน 21, 2011, 14:51:19 PM
ต้องดู Log file ของ MySQL ครับ  ถ้ายังแก้ไขไม่ได้ ให้ติดต่อ staff ที่ Call center ให้ Remote เข้าไปตรวจสอบให้นะครับ
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: KHEMSAK ที่ เมษายน 21, 2011, 15:00:49 PM
ส่ง log มาให้ดูครับ
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: เข้ม ที่ เมษายน 21, 2011, 19:05:09 PM
ทาง BMS แก้ไขให้ได้หรือยังครับ ...

จาก log file ผมเข้าใจว่า ... น่าจะรันระบบได้
แต่น่าจะมีการปรับและแก้ไข my.cnf ในส่วนของ

innodb_log_file_size = 512M
innodb_log_buffer_size = 8M

ไปเป็นค่าอื่น ซึ่ง variable 2 ตัวนี้ห้ามแก้ไข หลังจากที่ได้มีการรันไปแล้ว
ทำให้มี error ขึ้น

110421 13:12:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
InnoDB: Error: log file /var/lib/mysql/ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 536870912 bytes!
110421 13:12:19 [ERROR] Plugin 'InnoDB' init function returned error.
110421 13:12:19 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

และหลังจากนั้น ... ก็กลับไปแก้ไขให้ variable ตัวนั้นกลับเป็นค่าเดิม ... จะไม่มี error เกิดขึ้น

110421 14:21:33 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.30'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

และต่อมาเข้าใจว่า ได้มีการลบไฟล ib* ซึ่งเก็บ log ต่าง ๆ ของ innodb  ออก ... เพราะมีการสร้าง ib* ขึ้นมาใหม่ ... และอีกอย่างน่าจะมีการแก้ไข my.cnf อีกครั้งในส่วนของ innodb_log_file_size  อีกหรือป่าว...?


110421 14:34:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110421 14:34:57  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
110421 14:34:57  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
110421 14:34:57  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
110421 14:34:59  InnoDB: Started; log sequence number 0 46604
110421 14:35:00 [Note] Event Scheduler: Loaded 0 events
110421 14:35:00 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.30'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

และ mysql พยายามจะกู้ข้อมูลเดิมขึ้นมา แต่ก็ไม่สามารถทำได้ ... โดยเมื่อเปรียบเทียบ log sequen number ไม่เท่ากัน

110421 12:47:29  InnoDB: Started; log sequence number 0 46409
.
.
.
110421 14:34:59  InnoDB: Started; log sequence number 0 46604


ตัว innodb ใน ib* น่าจะเสียหายไปแล้ว ...

ผมเองไม่รู้วิธีแก้ไขครับ ... ถ้าเป็นเครื่อง slave ผมก็จะใช้ initial import ใหม่เลย ...
แต่ถ้าเป็น master คงต้องพึ่ง อ. ชัยพรและทีมงาน แล้วหล่ะครับ
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: Khuad ที่ เมษายน 21, 2011, 19:20:12 PM

... ถ้าลบไฟล ib* ใน master ก็งานเข้าแล้วมั้งครับท่านเข้ม
   
    เห็น อ.mn เคยบอกให้เตรียมข้อมูลที่สำรองไว้มาใช้ได้เลย ...  :) ....
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: KHEMSAK ที่ เมษายน 21, 2011, 20:03:39 PM
เป็นเครื่อง slave ครับ แต่ผม เคย ลง OS 64 bit ใหม่แล้ว ก็ลง Mysql เหมือนเดิมครับก็ยังเจอ innodb_file_per_table
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: manoi ที่ เมษายน 21, 2011, 20:15:47 PM
มันมี error ตรงนี้

110421 13:12:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
InnoDB: Error: log file /var/lib/mysql/ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 536870912 bytes!

แล้ว Error นี้ก็หายไปกลายเป็นสร้างแฟ้ม ib_logfile0 ใหม่ แสดงว่ามีคนไปลบแฟ้มนี้ออกนะครับ

น่าจะลองใช้ Xtrabackup GUI ที่ผมทำให้ ทำการ transfer slave แล้วเลือกติดตั้ง MySQL ให้ใหม่ดูนะครับ จะได้ไม่ต้องแก้ปัญหากับ configuration ของ MySQL
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ เมษายน 21, 2011, 21:46:16 PM
ความรู้ใหม่อีกแล้ว..สำหรับผม..นะ :)
หัวข้อ: Re: innodb_file_per_table error
เริ่มหัวข้อโดย: มนตรี บอยรักยุ้ยคนเดียว ที่ เมษายน 24, 2011, 13:05:42 PM

... ถ้าลบไฟล ib* ใน master ก็งานเข้าแล้วมั้งครับท่านเข้ม
   
    เห็น อ.mn เคยบอกให้เตรียมข้อมูลที่สำรองไว้มาใช้ได้เลย ...  :) ....

ถ้าลบไฟล ib* ใน master ก็งานเข้าแล้วมั้งครับ

มันมี error ตรงนี้

110421 13:12:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
InnoDB: Error: log file /var/lib/mysql/ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 536870912 bytes!

แล้ว Error นี้ก็หายไปกลายเป็นสร้างแฟ้ม ib_logfile0 ใหม่ แสดงว่ามีคนไปลบแฟ้มนี้ออกนะครับ

น่าจะลองใช้ Xtrabackup GUI ที่ผมทำให้ ทำการ transfer slave แล้วเลือกติดตั้ง MySQL ให้ใหม่ดูนะครับ จะได้ไม่ต้องแก้ปัญหากับ configuration ของ MySQL

http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=9623.msg177226#new