צרות עם MYSQL - 2 שאלות

שוּלה

New member
צרות עם MYSQL - 2 שאלות

רקע - יש לי מכונה וירטואלית עם UBUNTU 12.04.
הכל עבד סבבה עד שאחד האתרים המאוחסנים דפק בצורה כזאת נוראית את הדטבייס, עד כדי כך שהיינו חייבים לבנות מחדש את השרת(!)
ניסינו לתקן טבלאות עם MYISAMCHK וכיו"ב, ניסינו לשחזר גיבויים.
במצב הנוכחי יש לנו מכונה חדשה אבל דטבייס במצב לא תקין או לא קונסיסטנטי! (של אחד האתרים)



1) שאלה אחת לא לגמרי קשורה ל-MYSQL -
ה-SERVICE של MYSQL עוצר לפעמים. אני רוצה (בינתיים, עד שהבעיה תתוקן) שהוא יופעל מחדש.
קראתי על RESPAWN, אבל לא הבנתי איך אפשר לקבוע UNLIMITED - כלומר שיעשה כל הזמן RESTART במקרה שהוא נתקע.
קבעתי RESPAWN LIMIT 2000 אבל עדיין אני מגיע למחרת ורואה שהMYSQL בסטטוס STOP.

אז האם יש דרך ואיך לעשות RESTART כל פעם שה-MYSQL מת ?



2) שאלה שנייה:
האם אתם רואים משהו חריג
(חוץ מ-כמובן- השורות שאומרות שיש טבלאות שבורות)


130503 7:57:09 [Note] Plugin 'FEDERATED' is disabled.
130503 7:57:09 InnoDB: The InnoDB memory heap is disabled
130503 7:57:09 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130503 7:57:09 InnoDB: Compressed tables use zlib 1.2.3.4
130503 7:57:09 InnoDB: Initializing buffer pool, size = 128.0M
130503 7:57:09 InnoDB: Completed initialization of buffer pool
130503 7:57:09 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130503 7:57:09 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...
130503 7:57:10 InnoDB: Waiting for the background threads to start
130503 7:57:11 InnoDB: 1.1.8 started; log sequence number 10007706
130503 7:57:11 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
130503 7:57:11 [Note] - '127.0.0.1' resolves to '127.0.0.1';
130503 7:57:11 [Note] Server socket created on IP: '127.0.0.1'.
130503 7:57:11 [Note] Event Scheduler: Loaded 0 events
130503 7:57:11 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.29-0ubuntu0.12.04.2' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
130503 7:57:12 [ERROR] /usr/sbin/mysqld: Table './my_faulty_db/cache' is marked as crashed and should be repaired
130503 7:57:12 [Warning] Checking table: './my_faulty_db/cache'
130503 7:57:12 [ERROR] /usr/sbin/mysqld: Table './my_faulty_db/cache_menu' is marked as crashed and last (automatic?) repair failed
130503 7:57:12 [ERROR] /usr/sbin/mysqld: Table './my_faulty_db/cache_page' is marked as crashed and should be repaired
130503 7:57:12 [Warning] Checking table: './my_faulty_db/cache_page'
130503 7:57:13 [ERROR] /usr/sbin/mysqld: Table './my_faulty_db/counter' is marked as crashed and last (automatic?) repair failed
130503 7:57:13 [ERROR] /usr/sbin/mysqld: Table './my_faulty_db/counter_data' is marked as crashed and should be repaired
130503 7:57:13 [Warning] Checking table: './my_faulty_db/counter_data'
130503 7:57:14 [ERROR] /usr/sbin/mysqld: Table './my_faulty_db/sessions' is marked as crashed and last (automatic?) repair failed


יותר מאוחר אצרף לוג קצת יותר מעניין.
 

mavor

New member
test 5

1) you can put it in /etc/inittab
2) see http://mmonit.com/monit/ (may be over kill )
3) just put cron tab scrip :

/etc/init.d/mysql status > /dev/null 2>&1
Status=$?
if [ $Status -ne 0 ] ;
then
#restart service
/etc/init.d/mysql restart
fi


per you mysql issues
did you reaper the DB ?
did you look at the error log ?
note :
130503 7:57:09 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...
130503 7:57:10 I
so if you using InnoDB its staring to be risky !!
 

שוּלה

New member
תודה,

1) חשבתי שיש פקודה מובנית שעושה משהו כזה,
אבל הכנסתי את הסקריפט לCRON כל שעה.

2) מה זה TEST5 ?

3) לא הבנתי - האם אתה טוען ש-INNODB יותר מסוכן מ-MYISAM ?

4) מחקתי את הדטבייס (והאתר) הבעייתי (ונתתי ללקוח לשבור את הראש), אז אני מקווה שהדטבייס יהיה בסדר מעכשיו.
 

mavor

New member
wall

1)i can give you 5 way to do it but KISS is better
2)test 5 as tapuz nuke my replay 4 times
3) yes
to recover bad INNODB is pain in the ASS and do not forget by default INNODB is ONE per DATABASE !! and MYISAM is per table !! so if you F MYISAM table the issues will be just in the table
if you F INNODB everting will be F (all the DB in the mysql ) you can set mysql to open file per table but its not the default setup
4) not for long if you DB is creasing all the time its roll of dice 10 times it will come up good and at the 11 time it will be dead
 

Infin1ty

New member
קודם כל myisamcheck

לא יעזור לך בטבלאות האלו, כי ככל הנראה הן משתמשות ב InnoDB.
יש לך עוד משהו בלוגים? הברירת מחדל של InnoDB זה כאשר הוא מזהה בעיית corruption הוא יקריס לך את ה MySQL.
יש מלא דרכים לתקן בעיות ב InnoDB, קצת קשה לדעת על גבי הפורום מה באמת הבעיה.
 
למעלה