MySQLCluster verifies whether the memory in the management node configuration exceeds the standard script

Source: Internet
Author: User
Verify the shell script configured by the config. ini parameter of the Management node to check whether memory has exceeded the memory limit. The above datanodeid must be included during running and the cluster must be in the working state.

Verify the shell script configured by the config. ini parameter of the Management node to check whether memory has exceeded the value. The above data node id must be included during running and the cluster must be in the working state.

Verify the config. the shell script configured by the ini parameter to check whether memory has exceeded the memory quota. The above data node id must be included during running and the cluster must be in the working state. At least the manage node and data node must be in the starting state.

Run check_memery.sh

Script content:

# Note: it is from the netizen Feihong's eldest brother who has passed the change and operation. There must be a lot of improvements. You are welcome to give your valuable comments.

#! /Bin/bash

Usage ()
{
Echo "-----------------------------"
Echo "Usage: $ (basename $0) NodeId" # ID of the Data Node
Echo "-----------------------------"
Echo
Exit 1
}


Print_size ()
{
String1 = $ (echo $1 | sed-e: a-e's/^. \ {\} $/&./; 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 ******"

MySQL Cluster details: click here
MySQL Cluster: click here

Recommended reading:

MySQL Cluster backup and recovery

Create a Cluster environment using three MySQL clusters. DOC

MySQL Cluster7.2 online addition of data nodes has major drawbacks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.