MySQL變更存放目錄
1. 停止MySQL service
2. cp -pr /var/lib/mysql /home/mysqldata
3. mv /var/lib/mysql /var/lib/mysql_bak
4. ln -s /home/mysqldata /var/lib/mysql
5. cd /tmp; unlink mysql.sock; ln -s /home/mysqldata/mysql.sock /tmp/mysql.sock
6. vi /etc/my.cnf
datadir=/home/mysqldata
socket=/home/mysqldata/mysql.sock
basedir=/home
7. 啟動MySQL service
8. 如有必要, 更改phpMyAdmin config
vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
Add
$cfg['Servers'][$i]['socket'] = ‘/home/mysql/mysql.sock’;
$cfg['Servers'][$i]['connect_type'] = ’socket’;
安裝memcache
1. 確認libevent跟libevent-devel均已安裝。(使用yum安裝即可)
2. 安裝memcached
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz tar zxvf memcached-1.4.5.tar.gz cd memcached-1.4.5 ./configure --with-libevent=/usr/local/ make make install cd scripts/ cp memcached.sysv /etc/init.d/memcached chmod 755 /etc/init.d/memcached vi /etc/init.d/memcached <--- daemon memcached改為daemon /usr/local/bin/memcached mkdir /var/run/memcached chkconfig memcached on chkconfig --list | grep memcached /etc/init.d/memcached start
3. 安裝PECL memcache
wget http://pecl.php.net/get/memcache-2.2.5.tgz tar zxvf memcache-2.2.5.tgz cd memcache-2.2.5 phpize ./configure make make install vi /usr/local/lib/php.ini <--- 將extension=memcache.so加進去
另外也可以透過WHM的Module Installers來search跟install
4. 重新啟動httpd
/scripts/restartsrv_httpd
Apache2 mod_cband
注意:該模組比較吃資源,使用在連線頻繁的主機上,將造成loading大幅增加至少7倍以上!
mod_cband是一個可以使用在apache2上面,用來管制虛擬主機連線數及頻寬的模組,
該模組的開發首頁是http://codee.pl/cband.html,目前的最新版本是0.9.7.5。
進行測試的環境配置如下,
apache版本:2.0.63
平均連線數:1200
平均loading:2.5
安裝Munin
Step1. 安裝Perl Module Net::Server::Fork
Step2. 安裝Perl Module HTML::Template
Step3. 到Main >> cPanel >> Manage Plugins安裝Munin
Apache經常不定期重開
在apache重開的時間點,error log出現以下訊息:
Graceful restart requested, doing restart
原因出在cpanel rotate apache log時導致重開apache,
依官方建議(cPanel 11.25 Log Processing )開啟piped log功能後解決。