文章详情

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

mysql cluster 安装脚本

时间:2008-08-28  来源:oychw

    本脚本要求把mysql-cluster-com-6.2.15-linux-x86_64-glibc23.tar.gz 放置在根目录,安装mysql节点的时候,事先配置好/etc/my.cnf。
    本脚本有待学完bash之后更新。

#!/bin/bash
    #------- write by Neil.xu 2008.0828--------
    #save configurations

    if [ -f /var/lib/mysql-cluster/config.ini ]
    then
        cp /var/lib/mysql-cluster/config.ini ~/config.ini_`date +"%Y%m%d-%T"`
    fi
    if [ -f /etc/my.cnf ]
    then
        cp /etc/my.cnf  ~/my.cnf_`date +"%Y%m%d-%T"`
    fi

    # stop service and kill process
      service mysql.server stop
    killall -9 mysqld_safe mysqld  ndb_mgmd ndbd
   
    #clear old files
    rm -rf /usr/local/mysql* /var/lib/mysql* /data/mysql-cluster/

    #check mysql usee
    if ! [ `grep mysql /etc/passwd` ]
    then
          groupadd -f mysql
          useradd  -g mysql mysql
    fi   

    #install mysql files
      cd ~
      tar xzvf mysql-cluster-com-6.2.15-linux-x86_64-glibc23.tar.gz
      mv -f ~/mysql-cluster-com-6.2.15-linux-x86_64-glibc23 /usr/local
    ln -s /usr/local/mysql-cluster-com-6.2.15-linux-x86_64-glibc23 /usr/local/mysql
    cd /usr/local/mysql
    chown -R mysql .
    chgrp -R mysql .
     scripts/mysql_install_db --user=mysql
    chown -R root .
    chown -R mysql data

    #install mgmd
    echo " Would you like to run mgmd ? y/n "
    read mgmd
    if  [ $mgmd == "y" ]
    then
        mkdir -p /var/lib/mysql-cluster
        cp /usr/local/mysql/bin/ndb* /usr/local/bin
        chmod +x /usr/local/bin/ndb*
    fi

    #install ndbd
    echo " Would you like to run ndbd ? y/n "
    read ndbd
    if  [ $ndbd == "y" ]
    then
        mkdir -p /data/mysql-cluster/
        cp /usr/local/mysql/bin/ndb* /usr/local/bin
        chmod +x /usr/local/bin/ndb*
    fi

    echo " Would you like to run mysqld ? y/n "
    read mysqld
    if  [ $mysqld == "y" ]
    then
        cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
        chkconfig --add mysql
        echo " Please wait "
        sleep 5
        service mysql start
    fi
   
    #bin/mysqld_safe --user=mysql &
   

exit 0
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载