• 03.大数据集群必备脚本大合集


    /usr/local/bin

    sudo nano .hosts

    s101
    s102
    s103
    s104
    s105

     xcall.sh

    #!/bin/bash
    for host in `cat /usr/local/bin/.hosts` ;
    do
        tput setaf 2
             echo ======== $host ========
        tput setaf 7
            ssh $host "source /etc/profile;$@"
    done
     
    xcall.sh  "yum install -y  rsync.x86_64"
     scp -r /soft/hadoop/etc centos@s104:/soft/hadoop/   不支持软连接
       rsync -lr /soft/hadoop/etc centos@s104:/soft/hadoop/
     
    xsync.sh
    #!/bin/bash
    name=`whoami`
    # 指定文件所在文件夹名称
    dir=`dirname $1`
    # 指定文件的文件名
    filename=`basename $1`
    # 进入到dir中
    cd $dir
    # 得到当前目录的绝对路径
    fullpath=`pwd`
    
    for((i=102 ; i<=105; i++)) ; 
    do
        tput setaf 2
        echo ==================== s$i $@ ===================
        tput setaf 9
        rsync -lr $filename "$name"@s"$i":$fullpath
    
    done

     记得给文件执行权限   chmod  777    xcall.sh 

  • 相关阅读:
    分布式和集群
    c++ >>
    c++ ip地址相关
    c++ ip地址的操作 c版
    c++ 缺少动态库
    c++ dirname() basename()
    shell ulimit -n
    shell 进程查询相关的命令
    shell grep 高亮
    c++ swap 函数
  • 原文地址:https://www.cnblogs.com/star521/p/10241047.html
Copyright © 2020-2023  润新知