2009年6月18日
CARP on CentOS4.7 - ucarp 1.5.1 -
Common Address Redundancy Protocol は、CISCOのVRRP互換のレイヤー3IP冗長化プロトコルである。BSDでは、カーネルランドにて、CARPを実装しているが、Linuxではこの実装がないため、ユーザランドで実装されたucarpを利用する。
1.インストール
% env CFLAGS="-O2" ./configure
% gmake
% gmake check
# gmake install-strip
# cp examples/linux/vip-* /etc
# vi /etc/vip-*.sh
/sbin/ip addr add "$2"/26 dev "$1"
/sbin/ip addr del "$2"/26 dev "$1"
※マスク値に注意!
# vi /etc/init.d/ucarp
. /etc/rc.d/init.d/functions
INTF=eth0
VIP=
RIP=
PASS=XXXXXX
prog="ucarp"start() {
echo -n $"Starting $prog: "
daemon +19 /usr/local/sbin/ucarp -B --interface=${INTF} -v 42 -p ${PASS}\
-a ${VIP} -s ${RIP} \
--upscript=/etc/vip-up.sh --downscript=/etc/vip-down.sh
RETVAL=$?
echo
return $RETVAL
}stop() {
if test "x`pidof ucarp`" != x; then
echo -n $"Stopping $prog: "
killproc ucarp
echo
fi
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
esac
exit $RETVAL
# chkconfig --add ucarp
2.設定
/etc/init.d/ucarpに設定
INTF=eth0 #CARPで共有するIPアドレスのインターフェースを指定する。
VIP=
RIP=
3.備考
厳格なマスター・バックアップ指定はない。
[CARP][CentOS] : 2009年6月18日 23:48
2009年7月 7日
postfix-2.2.10-1.2 on CentOS 4.7
1.postfixの設定
# cd /etc/postfix
# vi mail.cf
myhostname = test.p.oni.gr.jp
mydomain = p.oni.gr.jp
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = subnet
mynetworks =/29, 168.100.0.0/16, 127.0.0.0/8
relay_domains = $mydestination
recipient_delimiter = +
mail_spool_directory = /var/spool/mail
2.sendmailからpostfix
# /etc/init.d/sendmail stop
# chkconfig sendmail off
# chkconfig postfix on
# /etc/init.d/postfix start
2009年11月27日
max_connections of PostgreSQL 8.2 on CentOS(RHEL)4.8
PostgreSQLのmax_connectionsをいくつまで増やすことができるのか?やってみた。
PostgreSQL 8.2.14
1.max_connections =1640 --- 768までnoswarp確認
サーバ:HP ProLiant 380 G5
OS: RHEL 4.8 2.6.9-89.0.9.ELsmp
メモリー:4GB
/proc/sys/kernel/shmmax=536870912
/proc/sys/kernel/shmall=134217728
/proc/sys/kernel/shmmni=4096 (default)
/proc/sys/kernel/sem=250 32000 32 128 (default)
max_connections = 1640
shared_buffers = 128MB
2.max_connections = 1964 noswap未確認
サーバ:HP ProLiant 380 G5
OS: RHEL 4.8 2.6.9-89.0.9.ELsmp
メモリー:4GB
/proc/sys/kernel/shmmax=536870912
/proc/sys/kernel/shmall=134217728
/proc/sys/kernel/shmmni=4096
/proc/sys/kernel/sem=250 32000 32 128
max_connections = 1964 (これ以上は上記パラメータでは起動しない)
shared_buffers = 192MB
3.max_connections = 1644 noswap未確認
サーバ:Dell Power Edge 1850
OS: CentOS 4.8 Linux 2.6.9-89.0.7.ELsmp
メモリー:4GB
/proc/sys/kernel/shmmax=536870912
/proc/sys/kernel/shmall=134217728
/proc/sys/kernel/shmmni=4096
/proc/sys/kernel/sem=250 32000 32 128
max_connections = 1644 (これ以上は上記パラメータでは起動しない)
shared_buffers = 192MB
4.max_connections = 10240 noswap未確認
サーバ:Dell Power Edge 1850
OS: CentOS 4.8 Linux 2.6.9-89.0.7.ELsmp
メモリー: 4GB
/proc/sys/kernel/shmmax=3277324288
/proc/sys/kernel/shmall=2752512
/proc/sys/kernel/shmmni=4096
/proc/sys/kernel/sem=250 36000 100 1178
max_connections = 10240 (これ以上は試していない)
shared_buffers = 512MB
備考
1. kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
2. kernel.shmmax = 512 * 1024 + 8192 * 400000 ( 400000が変数:増減 )
3.エラーメッセージ (max_connections)
FATAL: connection limit exceeded for non-superusers
⇒max_connections,shared_buffersを増やす。
4.エラーメッセージ (shmmax)
You can either reduce the request size or reconfigure the kernel with larger SHMMAX.To reduce the request size (currently 236576768 bytes), reduce PostgreSQL's shared_buffers parameter (currently 24576) and/or its max_connections parameter (currently 1648).
⇒/proc/sys/kernel/shmmaxを増やす。
5.エラーメッセージ(sem)
It occurs when either the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of semaphores (SEMMNS), would be exceeded.
⇒kernel.sem (SEMMNS,SEMMNI)を増やす。
6.設定 /etc/sysctl.conf
kernel.shmmax = 3277324288
kernel.shmall = 2752512
kernel.sem = 250 36000 100 1178
7.設定反映
# sysctl -p