MySQLをバージョンアップ

おそらくトラックバックスパムのせいだと思うのだが、サーバへの負荷が一時的に増大してリモートアクセスも不可能となり、電源断/入による再起動を余儀なくされることがあった。どういうわけかそれ以降、MovableTypeのダイナミックパブリッシンングがかなり重くなり、個別エントリのページを開くのに30秒以上かかる始末。topコマンドで確認してみると、mysqldがCPUのほぼ100%%近くを占有している。

/etc/my.cnfを編集してキャッシュなどを割り当ててみたのだが、事態はいっこうに変わらず。もとよりMovableTypeからのリクエストはほとんどがSELECT文であり、これがslowクエリになっているなら改善のしようがない。やはり、1000を超えるエントリを処理するに値しないマシンスペックだということか。

かくなる上は、MySQLのバージョンアップか。しかしながら、Fedora Core 3に用意されたMySQLはバージョン3しかない。ダメもとで調べてみたところ、FC3でMySQL 4をインストールした人のページが引っかかった。以下、その手順に従ってバージョンアップしてみる。

# rpm -Uvh http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-server-4.1.22-0.i386.rpm http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-client-4.1.22-0.i386.rpm http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-devel-4.1.22-0.i386.rpm http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-shared-compat-4.1.22-0.i386.rpm
Retrieving http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-server-4.1.22-0.i386.rpm
Retrieving http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-client-4.1.22-0.i386.rpm
Retrieving http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-devel-4.1.22-0.i386.rpm
Retrieving http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-shared-compat-4.1.22-0.i386.rpm
warning: /var/tmp/rpm-xfer.n64hSY: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing...                ########################################### [100%]
   1:MySQL-shared-compat    ########################################### [ 25%]
   2:MySQL-server           ########################################### [ 50%]
070620 18:58:02 [Warning] Asked for 196608 thread stack, but got 126976
070620 18:58:03 [Warning] Asked for 196608 thread stack, but got 126976
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h meadowsage.oheso.com password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be able to use the new GRANT command!
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com Starting MySQL...................................[FAILED] 3:MySQL-client ########################################### [ 75%] 4:MySQL-devel ########################################### [100%]

デーモンの起動に失敗したようだ。よくよく考えたら、mysqldを起動させた状態でインストール作業を行なっていたことに気付いた。

# /etc/rc.d/init.d/mysqld stop
-bash: /etc/rc.d/init.d/mysqld: No such file or directory

一瞬焦ったがなんのことはない。起動スクリプトの名前が/etc/rc.d/init.d/mysqldから/etc/rc.d/init.d/mysqlに変わっていたからだ。

# /etc/rc.d/init.d/mysql    
Usage: /etc/rc.d/init.d/mysql start|stop|restart|reload
# /etc/rc.d/init.d/mysql reload
MySQL PID file could not be found!                         [FAILED]
# /etc/rc.d/init.d/mysql stop  
MySQL PID file could not be found!                         [FAILED]
# /etc/rc.d/init.d/mysql start
Starting MySQL...................................          [FAILED]

どうやらMySQL-serverのインストールに問題があった模様。仕方なくこれだけやり直す。

# rpm -e MySQL-server
# rpm -Uvh http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-server-4.1.22-0.i386.rpm
Retrieving http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-server-4.1.22-0.i386.rpm
warning: /var/tmp/rpm-xfer.VZbrxd: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
070620 19:14:55 [Warning] Asked for 196608 thread stack, but got 126976
070620 19:14:55 [Warning] Asked for 196608 thread stack, but got 126976
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h meadowsage.oheso.com password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be able to use the new GRANT command!
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com Starting MySQL...[ OK ]

今度はうまくいった。プロセスも確認済み。おっと、(インストール中に表示された)rootパスワードの再設定も忘れずに。

# mysqladmin -u root password 'password'
# mysqladmin -u root -h meadowsage.oheso.com password 'password'

そして最後に、お決まりのこれ。

# chkconfig mysql on

トラックバック(0)

このブログ記事を参照しているブログ一覧: MySQLをバージョンアップ

このブログ記事に対するトラックバックURL: http://somin.heteml.jp/mt/mt-tb.cgi/4249

コメントする

このブログ記事について

このページは、Sominが2007年6月20日 21:04に書いたブログ記事です。

ひとつ前のブログ記事は「MT3.xでcookieが効かない」です。

次のブログ記事は「MT4のXMLRPC API 注意点」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。