|
你可以使用正则表达式而不是使用完整主机名和 IP:
$ clush -w 192.168.1.[4,9] uname -r192.168.1.9: 4.15.0-45-generic192.168.1.4: 3.10.0-957.el7.x86_64
或者,如果服务器位于同一 IP 系列中,则可以使用以下格式:
$ clush -w 192.168.1.[4-9] date192.168.1.6: Mon Mar 4 21:08:29 IST 2019192.168.1.7: Mon Mar 4 21:08:29 IST 2019192.168.1.8: Mon Mar 4 21:08:29 IST 2019192.168.1.5: Mon Mar 4 09:16:30 CST 2019192.168.1.9: Mon Mar 4 21:08:29 IST 2019192.168.1.4: Mon Mar 4 09:16:30 CST 2019
clustershell 允许我们以批处理模式运行命令。使用以下格式来实现此目的:
$ clush -w 192.168.1.4,192.168.1.9 -bEnter 'quit' to leave this interactive modeWorking with nodes: 192.168.1.[4,9]clush> hostnamectl---------------192.168.1.4--------------- Static hostname: CentOS7.2daygeek.com Icon name: computer-vm Chassis: vm Machine ID: 002f47b82af248f5be1d67b67e03514c Boot ID: f9b37a073c534dec8b236885e754cb56 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-957.el7.x86_64 Architecture: x86-64---------------192.168.1.9--------------- Static hostname: Ubuntu18 Icon name: computer-vm Chassis: vm Machine ID: 27f6c2febda84dc881f28fd145077187 Boot ID: f176f2eb45524d4f906d12e2b5716649 Virtualization: oracle Operating System: Ubuntu 18.04.2 LTS Kernel: Linux 4.15.0-45-generic Architecture: x86-64clush> free -m---------------192.168.1.4--------------- total used free shared buff/cache availableMem: 1838 641 217 19 978 969Swap: 2047 0 2047---------------192.168.1.9--------------- total used free shared buff/cache availableMem: 1993 352 1067 1 573 1473Swap: 1425 0 1425clush> w---------------192.168.1.4--------------- 09:21:14 up 3:21, 3 users, load average: 0.00, 0.01, 0.05USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATdaygeek :0 :0 06:02 ?xdm? 1:28 0.30s /usr/libexec/gnome-session-binary --session gnome-classicdaygeek pts/0 :0 06:03 3:17m 0.06s 0.06s bashdaygeek pts/1 192.168.1.6 06:03 52:26 0.10s 0.10s -bash---------------192.168.1.9--------------- 21:13:12 up 3:12, 1 user, load average: 0.08, 0.03, 0.00USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATdaygeek pts/0 192.168.1.6 20:42 29:41 0.05s 0.05s -bashclush> quit
(编辑:清远站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|