当前位置: 首页 > news >正文

嘉兴网站建设技术开发快刷网站

嘉兴网站建设技术开发,快刷网站,在火炉做网站公园坐什么车,网站建设 绵阳1、SSH 工具本身支持多窗口 比如 MobaXterm: 2、编写脚本通过 ssh 在多台机器批量执行shell命令 创建 ssh_hosts 配置文件,定义需要批量执行的节点(必须能够通过 ssh 免密登录,且存在同名用户) vim ssh_hostsbig…

1、SSH 工具本身支持多窗口

比如 MobaXterm:
在这里插入图片描述
在这里插入图片描述

2、编写脚本通过 ssh 在多台机器批量执行shell命令

创建 ssh_hosts 配置文件,定义需要批量执行的节点(必须能够通过 ssh 免密登录,且存在同名用户)

vim ssh_hosts
bigdata0
bigdata1

创建 dosshcmd.sh 脚本:

vim dosshcmd.sh
#! /bin/shdoSshCmd() {hosts=`sed -n '/^[^#]/p' /home/z/scripts/ssh_hosts`for host in $hostsdo echo \[**************** HOST: $host ****************]ssh $host "$@"echo ""donereturn 0
}if [ $# -lt 1 ]
thenecho "$0 cmd"exit
fiecho CMD: "$@"
doSshCmd "$@

赋予执行权限

chmod u+x dosshcmd.sh

3、验证:

1) 验证简单命令:
[root@bigdata0 scripts]# ./dosshcmd.sh free -g
CMD: free -g
[**************** HOST: bigdata0 ****************]total        used        free      shared  buff/cache   available
Mem:             93          13          31           0          49          79
Swap:             3           0           3[**************** HOST: bigdata1 ****************]total        used        free      shared  buff/cache   available
Mem:             93          15           2           0          75          77
Swap:             3           0           3
2) 验证脚本执行:

编写一个通过 jps 找到 pid,然后通过 ps 查看进程信息的简单脚本:

vim find_java_resources.sh
#! /bin/shpids=`jps|grep -i "$1"| cut -d ' ' -f 1`
echo ----find pids: $pids
for pid in $pids
doecho ----PID: $pid----if [ $# -eq 1 ];then ps -q $pid -aux|awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}'|column -t elseps -q $pid ${@:2}|awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}'|column -tfiecho " "
done

赋予执行权限

chmod u+x find_java_resources.sh

分发:

[root@bigdata0 scripts]# scp find_java_resources.sh bigdata1:`pwd`
find_java_resources.sh                              100%  265     0.3KB/s   00:00    
[root@bigdata0 scripts]#

查看集群每个节点 yarn 任务资源占用

[root@bigdata0 scripts]# ./dosshcmd.sh /home/z/scripts/find_java_resources.sh yarn
CMD: /home/z/scripts/find_java_resources.sh yarn
[**************** HOST: bigdata0 ****************]
----find pids: 31878 31879
----PID: 31878----
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
root     31878 24.7  1.2 26774340 1204428 ?    Sl   11:10   2:49 ----PID: 31879----
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
root     31879 25.9  1.2 26743664 1210208 ?    Sl   11:10   2:57​
[**************** HOST: bigdata1 ****************]
----find pids: 30703
----PID: 30703----
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
root     30703 24.4  2.9 26776844 2854336 ?    Sl   11:14   2:48 

也可以用 watch 监控

watch "./dosshcmd.sh /home/z/scripts/find_java_resources.sh yarn"
http://www.hrbkazy.com/news/15154.html

相关文章:

  • 做外贸英语要什么网站免费seo视频教学
  • 张家港市网站制作中国新闻发布
  • 山东省城乡住房建设厅网站中国最大的企业培训公司
  • 江苏省建设工程招投标网站今日国内新闻最新消息10条新闻
  • 潢川网站建设公司真正免费的网站建站平台推荐
  • 做金融资讯网站需要哪些牌照营销方案网站
  • 做外贸批发开什么网站app推广拉新平台
  • 03340网站建设与管理怎么在百度上推广自己的产品
  • 网站开发三个流程无锡今日头条新闻
  • 大连b2c网站建设淘宝seo推广优化
  • 上海工商网站搜索引擎优化好做吗
  • wordpress新闻源码aso优化榜单
  • 怎么开网店?去哪里注册?萧山市seo关键词排名
  • 上海城市建设和交通委员会网站安卓优化大师旧版本下载
  • 收款网站怎么建设找资源
  • 搜狗站群系统怀化网站seo
  • 专业建站公司加盟百度推广页面投放
  • 泰州网站设计咨询谷歌seo教程
  • 手机网站设计占工程比重东莞做网站哪家公司好
  • 网站建设电话销售术语seo博客写作
  • 个人网站备案要多久网络营销企业网站优化
  • android手机网站开发如何制作网站赚钱
  • wordpress关闭自动保存插件广东网络seo推广公司
  • 青岛建设项目环评公示网站怎么做关键词排名靠前
  • 网站没有备案可以做百度推广吗湖南网站设计外包服务
  • 网络优化属于什么部门黑帽seo
  • 响应式自适应网站苏州seo怎么做
  • 校园网站建设工作总结关联词有哪些五年级
  • 温州做网站哪家公司好拉新注册app拿佣金
  • 日本做h动漫电影网站有哪些如何创建个人网站免费