1. View the current compute node naming method as follows
[email protected] ~]# Rocks list Host
HOST Membership CPUS RACK RANK runaction installaction
Cluster:frontend 1 0 0 OS Install
Compute-0-0:compute 1 0 0 OS Install
Compute-0-1:compute 1 0 1 os Install
2. To change the compute-0-* to node* now, proceed as follows
Under any path, create a script named Rename.sh, which reads as follows
[email protected] addhost]# cat rename.sh
#!/bin/bashorder=0sum=2 //total number of nodes new=1# #while [ $ORDER -lt $SUM ]; do rocks set host name compute-0-$ORDER node$new; rocks set host interface name node$new eth0 node$new; let order++; let new++; done### #Sync configrocks sync config# #SUM =2new=1## #Set for hosts filefor i in ' seq $NEW $SUM ';d o ssh node$i sed -i -e "s/compute-0-.*.local/node$i.local/g" -e "s/compute-0-.*/node$i/g" /etc/hosts;done#for i in ' seq $NEW $SUM ';d o ssh node$i hostname node$i.local;done# for i in ' seq $NEW  , $SUM ';d o ssh node$i sed -i "/hostname/c\hostname=node$i.local" /etc/ Sysconfig/network;done
Note: The script content changes according to the actual situation
For example: Now there are 10 nodes, now you need to compute-0-0 to compute-0-9, rename Node1 to Node10, the steps are as follows
1. There are two places in the script that need to be changed, please see the note for specific location
[email protected] addhost]# cat rename.sh
#!/bin/bashorder=0sum=10 //change the number of nodes here new=1## while [ $ORDER -lt "$SUM" ]; do rocks set host name compute-0-$ORDER node$new; rocks set host interface name node$new eth0 node$new; let order++; let new++; done### #Sync Configrocks sync config# #SUM =10 //This place also needs to change new=1## #Set For hosts filefor i in ' seq $NEW $SUM ';d o ssh node$i sed -i -e "s/compute-0-.*.local/node$i.local/g" -e "s/ Compute-0-.*/node$i/g " /etc/hosts;done#for i in ' seq $NEW $SUM ';d o ssh node$i hostname node$i.local;done#for i in ' seq $NEW $SUM ';d o ssh node$i sed -i "/hostname/c\hostname=node$i.local" /etc/sysconfig/network;done
2. Execute the script to
[Email protected] addhost]# sh rename.sh
This article is from the "Never Stop" blog, please be sure to keep this source http://wjcaiyf.blog.51cto.com/7105309/1690846
Rocks changing the computer point name