程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> MySQL Cluster驗證管理節點配置中內存是否超標的腳本

MySQL Cluster驗證管理節點配置中內存是否超標的腳本

編輯:MySQL綜合教程

MySQL Cluster驗證管理節點配置中內存是否超標的腳本   驗證管理節點config.ini參數配置的shell腳本,看memory是否超標,運行的時候需要附帶上面data node id, 而且cluster要處於工作狀態,最起碼manage node和data node要處於啟動狀態   run check_memery.sh 腳本內容下:

#!/bin/bash


usage()
{
   echo "-----------------------------"
   echo "Usage:$(basename $0) NodeId"  #數據節點的ID
   echo "-----------------------------"
   echo
   exit 1
}


print_size ()
{
string1=$(echo $1|sed -e :a -e 's/^.\{1,40\}$/&./;ta')
echo -e "$string1 (MB):\t$2"
}






if [ "$1" == "" ]; then
    usage
fi
string1=$(echo $1|egrep "^[0-9]+$")
if [ "$1" != "$string1" ]; then
    usage
fi



# GETVAL="ndb_config  --id=$1 -q"
GETVAL="/root/mysql-cluster-gpl-7.2.7-linux2.6-x86_64/bin/ndb_config  --id=$1 -q"
#ndb_config  --id=12 -q MaxNoOfAttributes
ksize=1024
msize=$(echo "scale=2; 1024*1024" | bc -l 2>/dev/null)
gsize=$(echo "scale=2; 1024*1024*1024" | bc -l 2>/dev/null)
echo "KB:$ksize MB:$msize GB:$gsize"


MEMSIZE=0


#Attributes
TSIZE=$($GETVAL MaxNoOfAttributes)
TSIZE=$(echo "scale=0; $TSIZE*200" | bc -l 2>/dev/null)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "MaxNoOfAttributes" $TSIZE


#Attributes
TSIZE=$($GETVAL MaxNoOfTables)
TSIZE=$(echo "scale=0; $TSIZE*20*$ksize" | bc -l 2>/dev/null)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "MaxNoOfTables" $TSIZE




#Attributes
TSIZE=$($GETVAL MaxNoOfOrderedIndexes)
TSIZE=$(echo "scale=0; $TSIZE*10*$ksize" | bc -l 2>/dev/null)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "MaxNoOfOrderedIndexes" $TSIZE


#Attributes
TSIZE=$($GETVAL MaxNoOfUniqueHashIndexes)
TSIZE=$(echo "scale=0; $TSIZE*10*$ksize" | bc -l 2>/dev/null)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "MaxNoOfUniqueHashIndexes" $TSIZE




#Attributes
TSIZE=$($GETVAL MaxNoOfConcurrentOperations)
TSIZE=$(echo "scale=0; $TSIZE*1*$ksize" | bc -l 2>/dev/null)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "MaxNoOfConcurrentOperations" $TSIZE


#Attributes
TSIZE=$($GETVAL TransactionBufferMemory)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "TransactionBufferMemory" $TSIZE


#Attributes
TSIZE=$($GETVAL IndexMemory)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "IndexMemory" $TSIZE


#Attributes
TSIZE=$($GETVAL DataMemory)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "DataMemory" $TSIZE


#Attributes
TSIZE=$($GETVAL UndoIndexBuffer)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "UndoIndexBuffer" $TSIZE


#Attributes
TSIZE=$($GETVAL UndoDataBuffer)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "UndoDataBuffer" $TSIZE


#Attributes
TSIZE=$($GETVAL RedoBuffer)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "RedoBuffer" $TSIZE


#Attributes
TSIZE=$($GETVAL LongMessageBuffer)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "LongMessageBuffer" $TSIZE


#Attributes
TSIZE=$($GETVAL DiskPageBufferMemory)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "DiskPageBufferMemory" $TSIZE


#Attributes
TSIZE=$($GETVAL SharedGlobalMemory)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "SharedGlobalMemory" $TSIZE


#Attributes
TSIZE=$($GETVAL BackupMemory)
MEMSIZE=$(echo "scale=2; $MEMSIZE+$TSIZE" | bc -l 2>/dev/null)
TSIZE=$(echo "scale=0; $TSIZE/$msize" | bc -l 2>/dev/null)
print_size "BackupMemory" $TSIZE


MEMSIZE=$(echo "scale=2; $MEMSIZE/$gsize" | bc -l 2>/dev/null)


echo
echo  "******Total Memory size: ${MEMSIZE}GB******"

 

   

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved