设为首页 加入收藏

TOP

MongoDB集群架构之分片架构(七)
2018-10-23 00:06:06 】 浏览:846
Tags:MongoDB 集群 架构 分片
sp;


echo -e "Starting shard nodes @{$SHARD_PORTS}...."


/data/mongo/data/shard/startshard.sh    $SHARD_PORTS 


echo -e "Starting route nodes @{$ROUTE_PORTS} with CONFIG:{$CONFIG_ADDRESSES}...."


/data/mongo/data/route/startroute.sh    $CONFIG_ADDRESSES $ROUTE_PORTS


echo -e "===ALL DONE====="


}


stop()


{


PIDS=$(pidof mongod mongos 2>/dev/null )


if [ "$PIDS" == "" ]


then


   echo -e "NO such process found!"


   exit 1


fi


echo -e "Stopping mongod and mongos:{$PIDS} ...."


kill -9 ${PIDS}


exit 0


}


status()


{


  C_PIDS=$(ps -elf |grep mongod |grep configsvr |grep -v grep |awk '{print $4}' |xargs )


  D_PIDS=$(ps -elf |grep mongod |grep shardsvr |grep -v grep |awk '{print $4}' |xargs )


  R_PIDS=$(ps -elf |grep mongos |grep -v grep |awk '{print $4}' |xargs )


  if [ "$C_PIDS" == "" ]


  then


 C_STATUS="NOT running"


  else


 C_STATUS="Running"


  fi


  if [ "$D_PIDS" == "" ]


  then


 D_STATUS="NOT running"


  else


 D_STATUS="Running"


  fi


  if [ "$R_PIDS" == "" ]


  then


 R_STATUS="NOT running"


  else


 R_STATUS="Running"


  fi


  echo -e "config nodes:{$C_PIDS}:{${C_STATUS}}"


  echo -e "shard nodes :{$D_PIDS}:{${D_STATUS}}"


  echo -e "route nodes :{$R_PIDS}:{${R_STATUS}}"


  exit 0 


}


usage()


{


 echo -e "Usage: $0 [start|stop|status]"


 exit 1


}


case  "$1" in


start)


start


;;


stop)


stop


;;


status)


status


;;


*)


usage


;;


esac


脚本功能如下:


启动集群:


[root@coe2coe data]# ./cluster.sh start


Starting  mongodb  cluster at {11.1.1.11}.....


Starting config nodes @{27117 27118 27119} ...


starting mongodb configsvr @HOMEDIR:{/data/mongo/data/config/27117}


about to fork child process, waiting until server is ready for connections.


forked process: 5569


child process started successfully, parent exiting


starting mongodb configsvr @HOMEDIR:{/data/mongo/data/config/27118}


about to fork child process, waiting until server is ready for connections.


forked process: 5652


child process started successfully, parent exiting


starting mongodb configsvr @HOMEDIR:{/data/mongo/data/config/27119}


about to fork child process, waiting until server is ready for connections.


forked process: 5737


child process started successfully, parent exiting


Starting shard nodes @{27017 27018 27019}....


starting mongodb shardsvr @HOMEDIR:{/data/mongo/data/shard/27017}


about to fork child process, waiting until server is ready for connections.


forked process: 5826


child process started successfully, parent exiting


starting mongodb shardsvr @HOMEDIR:{/data/mongo/data/shard/27018}


about to fork child process, waiting until server is ready for connections.


forked process: 5888


child process started successfully, parent exiting


starting mongodb shardsvr @HOMEDIR:{/data/mongo/data/shard/27019}


about to fork child process, waiting until server is ready for connections.


forked process: 5934


child process started successfully, parent exiting


Starting route nodes @{27217 27218 27219} with CONFIG:{11.1.1.11:27117,11.1.1.11:27118,11.1.1.11:27119}....


CONFIG_SERVERS:{11.1.1.11:27117,11.1

首页 上一页 4 5 6 7 下一页 尾页 7/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇hql优化教程 下一篇MySQL递归查询_函数语法检查_GROU..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目