???????????????Mongodb??replica set????????????????????????????????????????????????????????????????????keepalived??????????????????down???????????????vip?????????????mongodb down???????????keepavlied?????????????????????vip??
????1.    MongoDB?????????
????????????????????????????????????????
????1.1.    ??????1???????????
????/usr/local/mongodb/bin/mongod --dbpath=/var/mongodb/data --logpath=/var/mongodb/logs/log.log --master --slave --source 192.168.1.19   --logappend  --port=27017 --fork
????1.2.    ??????2 ???????????
????/usr/local/mongodb/bin/mongod --dbpath=/var/mongodb/data --logpath=/var/mongodb/logs/log.log --master --slave --source 192.168.1.17   --logappend  --port=27017 --fork
????1.3.    ???????????
???????????????????д????????????????????????????????
????????mongodb:/usr/local/mongodb/bin/mongo
????????????show dbs;
??????????????????test????????????
????db.test.save({"name":"zhouxiaofei"??"position":"Web tester"});
?????????????????test???д?????????????????????????????????????????
????db.test.find();
????1.4.    Keepalived????
????1.4.1.   ??????1keepalived????
! Configuration File for keepalived
global_defs {
notification_email {
master@extmail.org
}
notification_email_from yunlei_ma@extmail.org
smtp_server mail.extmail.org
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_script chk_mongodb {
script "/etc/keepalived/mongodb_check.sh"
interval 2
weight 2
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 150
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
track_script {
chk_mongodb
}
virtual_ipaddress {
192.168.1.18
}
}