文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>mysql cluster 管理 脚本

mysql cluster 管理 脚本

时间:2007-06-21  来源:oychw

管理节点的脚本: mgmd_keepalive.sh

1, ps afx | grep -w ndb_mgmd | grep -v grep &>  /dev/null 中加-w是为了避免把mgmd_keepalive.sh 当作管理进程

2,    $? 只针对上一个语句有效.

#!/bin/bash

#

# mgmd_keepalive.sh

#

echo "**********************************************************************" >>  /var/log/mgmd-restart-log

echo   "Check date: `date`" >> /var/log/mgmd-restart-log

 

ps afx | grep -w ndb_mgmd | grep -v grep &>  /dev/null

 

if [ $? == 0 ] ; then

      echo "mgmd is ok ">> /var/log/mgmd-restart-log

else

 

#     NDBD is dead

      echo "ERROR !----------------NDBD is dead!------------------" >>/var/log/mgmd-restart-log

      /usr/local/bin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini

      wall "mgmd_keepalive.sh restarted mgmd">>/var/log/mgmd-restart-log

      echo  -n "mgmd_keepalive.sh restarted mgmd:" >> /var/log/mgmd-restart-log

 

fi

 

exit 0

 

数据节点的启动脚本:

[root@ls-db-10 meil]# vi ndbd_keepalive.sh

 

#!/bin/bash

#

# ndbd_keepalive.sh

#

# Checks that ndbd, the storage daemon for MySQL Cluster,

# is running. If it is not, start it with -n (nostart)

# to allow administrator to start it from within the

# management client

 

echo "**********************************************************************" >>  /var/log/ndbd-restart-log

echo   "Check date: `date`" >> /var/log/ndbd-restart-log

 

ps afx | grep -w ndbd | grep -v grep &>  /dev/null

 

if [ $? == 0 ] ; then

      echo "ndbd is ok ">> /var/log/ndbd-restart-log

else

 

#     NDBD is dead

      echo "ERROR !----------------NDBD is dead!------------------" >>/var/log/ndbd-restart-log

      /usr/local/mysql/bin/ndbd -n

      wall "ndbd_keepalive.sh restarted ndbd">>/var/log/ndbd-restart-log

      echo  -n "ndbd_keepalive.sh restarted ndbd:" >> /var/log/ndbd-restart-log

 

fi

 

exit 0

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载