2013年3月18日月曜日

drbd StandAloneからの回復


# drbd-overview
  0:resource  StandAlone Secondary/Unknown UpToDate/DUnknown r----


こうなってしまったときでマスターがはっきりしているとき

スレーブ側で
drbdadm secondary resource
drbdadm -- --discard-my-data connect resrouce

マスター側で
drbdadm connect all


# drbd-overview
  0:bp-resource  Connected Secondary/Primary UpToDate/UpToDate B r----


参考
http://www.drbd.jp/users-guide/s-resolve-split-brain.html

2013年2月16日土曜日

2013年2月15日金曜日

kvm nic追加

virshでnic追加/削除

つけるとき
virsh attach-interface --type bridge --source br106 --model e1000 vmname

はずすとき
virsh detach-interface --type bridge --mac 52:54:00:34:38:33  vmname

参考
http://builder.virt-tools.org/artifacts/libvirt-virshcmdref/html/sect-attach-interface.html

2013年2月8日金曜日

証明書の中身がみたいとき

openssl s_client -connect www.com:443 -showcerts

-----BEGIN CERTIFICATE-----
から
-----END CERTIFICATE-----
を適当なファイルに保存して

openssl x509 -in test -text

とか

2012年12月17日月曜日

CentOS6.3にSmokePingをインストールしたときのメモ

SmokePing
http://oss.oetiker.ch/smokeping/

yumでインストール



  • 準備

rpmforgeを使えるようにしておく


  • 必要なパッケージ

yum install mod_fcgid httpd httpd-devel rrdtool fping wget curl bind-utils gcc make


  • perlのモジュール

yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-RRD-Simple perl-CGI-SpeedCGI perl-ExtUtils-MakeMaker


  • 追加

yum install perl-CGI-SpeedyCGI perl-CGI-SpeedCGI

  • apacheの設定

chkconfig httpd on
/etc/httpd/conf.d/smokeping.conf

<Directory "/var/www/html/smokeping">
    Options +ExecCGI
    AllowOverride all
    order deny,allow
    deny from all
    allow from アクセスを許可するIP
</Directory>

service httpd start


  • smokepingのインストール

wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
tar -zxvf smokeping-2.6.8.tar.gz -C /opt/
mkdir /opt/smokeping
cd /opt/smokeping-2.6.8/setup
./build-perl-modules.sh
cp -r ../thirdparty /opt/smokeping/
cd ..
./configure –prefix=/opt/smokeping
make
make install


  • SmokePing用ディレクトリ作成

cd /opt/smokeping
mkdir data
mkdir var


  • initスクリプトのダウンロード

wget http://static.wedebugyou.com/smokeping_start_stop.txt
mv smokeping_start_stop.txt /etc/init.d/smokeping
chmod 755 /etc/init.d/smokeping


  • configの作成

cd /opt/smokeping/etc/
for foo in *.dist; do cp $foo `basename $foo .dist`; done
chmod 600 /opt/smokeping/etc/smokeping_secrets.dist
/opt/smokeping/etc/config
監視対象を追記する
+ Ping

menu = 名前
title = SmokePingで監視

++ test-server1

menu = test-server1
title = test-server1
host = 192.168.1.1

++ test-switch1

menu = test-switch1
title = test-switch1
host = 192.168.101.1


  • SmokePingをapacheから見れるように、の設定

cp -r /opt/smokeping/htdocs/cropper /var/www/cgi-bin/
cp /opt/smokeping/htdocs/smokeping.fcgi.dist /var/www/cgi-bin/smokeping.fcgi
cd /var/www/html/
mkdir cache
chown apache cache
ln -s /var/www/html/cache /opt/smokeping/cache


  • smokepingスタート

service httpd restart
service smokeping start


  • アクセスして確認

http:///serveraddress/smokeping/

2012年11月28日水曜日

mkfs.ext4でエラー


# mkfs.ext4 /dev/sdb1
mke2fs 1.42.3 (14-May-2012)
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

こんなエラーが出てファイルシステムが作成できなかった。

multipathdを止めたら作成できた。

# service multipathd stop

# dmsetup remove_all
# systemctl disable multipathd.service


# mkfs.ext4 /dev/sdb1