Home > Tags > CentOS

CentOS

PHPをAPC(Alternative PHP Cache)で高速化

準備
[root@centos ~]# yum install php-pear
[root@centos ~]# yum install httpd-devel

APCインストール
[root@centos ~]# pecl install APC

APC設定ファイル作成
[root@centos ~]# vi /etc/php.d/apc.ini
extension = apc.so
apc.ttl = 7200
apc.user_ttl = 7200

Apache設定ファイル再読込
[root@centos ~]# /etc/rc.d/init.d/httpd reload

APCの設定オプション

muninのプラグイン追加・削除

muninでネットワークやシステム監視をするの続きです。

監視の必要が無い項目の削除

[root@centos ~]# /sbin/service munin-node stop

[root@centos ~]# rm /etc/munin/plugins/ntp_* ← シンボリックリンク削除
[root@centos ~]# rm /var/lib/munin/localhost/localhost-ntp_*.rrd ← データ削除

[root@centos ~]# rm /etc/munin/plugins/sendmail_* ← シンボリックリンク削除
[root@centos ~]# rm /var/lib/munin/localhost/localhost-sendmail_*.rrd ← データ削除

[root@centos ~]# /sbin/service munin-node start

ntpの監視は必要ないですし、sendmailは使用していないので削除しました。

監視項目の追加(muninインストール時にアンクティブになっていないMySQLの場合)

[root@centos ~]# /sbin/service munin-node stop

[root@centos ~]# ln -s /usr/share/munin/plugins/mysql_bytes /etc/munin/plugins/mysql_bytes
[root@centos ~]# ln -s /usr/share/munin/plugins/mysql_isam_space_ /etc/munin/plugins/mysql_isam_space_
[root@centos ~]# ln -s /usr/share/munin/plugins/mysql_queries /etc/munin/plugins/mysql_queries
[root@centos ~]# ln -s /usr/share/munin/plugins/mysql_slowqueries /etc/munin/plugins/mysql_slowqueries
[root@centos ~]# ln -s /usr/share/munin/plugins/mysql_threads /etc/munin/plugins/mysql_threads

[root@centos ~]# vi /etc/munin/plugin-conf.d/munin-node
[mysql*]
env.mysqlopts -u root -pパスワード
env.mysqladmin /usr/bin/mysqladmin

[root@centos ~]# /sbin/service munin-node start

監視項目の追加(プラグインをダウンロードする場合)

[root@centos ~]# /sbin/service munin-node stop

[root@centos ~]# mkdir /etc/munin/plugins/add
[root@centos add ~]# cd /etc/munin/plugins/add

PostgreSQL
[root@centos add ~]# wget http://munin.projects.linpro.no/attachment/wiki/plugin-pg__connections/pg__connections?format=raw
[root@centos add ~]# mv pg__connections?format=raw pg__connections
[root@centos add ~]# chmod +x pg__connections
[root@centos add ~]# ln -s /etc/munin/plugins/add/pg__connections /etc/munin/plugins/

qmail
[root@centos add ~]# wget http://muninexchange.projects.linpro.no/download.php?phid=274
[root@centos add ~]# mv qremote?format=raw qremote
[root@centos add ~]# chmod +x qremote
[root@centos add ~]# ln -s /etc/munin/plugins/add/qremote /etc/munin/plugins/
[root@centos add ~]# wget http://muninexchange.projects.linpro.no/download.php?phid=273
[root@centos add ~]# mv queuestats?format=raw queuestats
[root@centos add ~]# chmod +x queuestats
[root@centos add ~]# ln -s /etc/munin/plugins/add/queuestats /etc/munin/plugins/

[root@centos add ~]# /sbin/service munin-node start

5分後くらいに反映されているはずです。

Clam AntiVirusのSelfCheckログを止める

/var/log/messagesに、Clam AntiVirusのSelfCheckログが10分ごとに出力されていたので止めてみました。
/var/log/messagesに出力されるログ

Apr 5 07:48:38 centos clamd[2485]: SelfCheck: Database status OK.

Clam AntiVirus設定ファイル編集
[root@centos ~]# vi /etc/freshclam.conf
# Use system logger (can work together with LogFile).
# Default: no
#LogSyslog yes ← ここをコメントアウト

Clam AntiVirus再起動
[root@centos ~]# /etc/rc.d/init.d/clamd start

スッキリしました :-D

muninでネットワークやシステム監視をする

MRTG+NET-SNMPはイマイチ好きではなかったのでmuninのインストールをしてみました。
MRTGより導入が簡単で項目も多いのでお勧めですよ。
では一気にいきます ;)

[root@centos ~]# yum install munin ← 本体
[root@centos ~]# yum install munin-node ← データ収集する方

munin-nodeの設定ファイル編集
[root@centos ~]# vi /etc/munin/munin-node.conf
#host_name lisse.leuven.wieers.com
host_name centos ← 何でもいい

munin-nodeの起動&自動起動設定
[root@centos ~]# /etc/init.d/munin-node start
[root@centos ~]# chkconfig munin-node on

Apacheの設定でローカルからのみアクセス可にする
[root@centos ~]# vi /etc/httpd/conf.d/munin.conf
   Options None
   AllowOverride None
   order deny,allow
   deny from all
   allow from 127.0.0.1
   Allow from 192.168.1.0/24

Apacheの設定再読込み
[root@centos ~]# /etc/init.d/httpd reload

http://サーバーのIP/munin/
munin1
munin2
こんな感じに表示されます。

muninはインストール時にcron登録されています。「/etc/cron.d/munin」
munin設定ファイル 「/etc/munin/munin.conf」

次回は不必要なプラグイン(表示)を削除したり、プラグインを追加していきます。

電源ボタンの無効化

自室のサーバーは良いとしても、遠隔地のサーバーは電源ボタンを無効にしておけば多少安心できます。

[root@centos ~]# /etc/rc.d/init.d/acpid stop
[root@centos ~]# chkconfig acpid off

Home > Tags > CentOS

Ads
Tag Cloud
Feeds
Counter

Return to page top