1. Create a folder under any path such as: Addhost
[Email protected] ~]# mkdir addhost
2. Create a addhost.sh script file and a Mac.txt host MAC address list under the Addhost directory
[[email protected] addhost] #touch addhost.sh mac.txt
3. Where the addhost.sh script content is as follows
#!/bin/baship=254rank=0node=1count=6 // 6 meaning to add 5 nodes cores=1 //1 cores per node # # #Add host #for MAC in ' cat ./mac.txt ' dowhile [ $NODE -lt "$COUNT" ]; do echo "Adding host node$node."; rocks add host node$node cpus= $CORES membership=compute os=linux rack =0 rank= $RANK; rocks add host interface node$node iface=eth0 ip= 10.1.255. $IP subnet=private name=node$node mac= $MAC; let ip--; let rank++; let node++; break; donedone## #Set host boot actionrocks set host boot compute action=install## #Sync Configrocks sync Config
Note: The above script needs to change according to the actual situation
For example: To add 10 nodes, 8 cores per node, the steps are as follows
1. See the comments where the script needs to be changed
#!/bin/baship=254rank=0node=1count=11 // Change Place 1cores=8 //Change Place 2## #Add host#for MAC in ' cat ./mac.txt ' dowhile [ $NODE -lt "$COUNT" ]; do echo "Adding host node$node."; rocks add host node$node cpus= $CORES membership=compute os=linux rack =0 rank= $RANK; rocks add host interface node$node iface=eth0 ip= 10.1.255. $IP subnet=private name=node$node mac= $MAC; let ip--; let rank++; let node++; break; donedone## #Set host boot actionrocks set host boot compute action=install## #Sync Configrocks sync Config
2.mac.txt Add the MAC address of these 10 nodes in one line, such as
[email protected] addhost]# cat Mac.txt
00:50:56:33:b5:c0
00:50:56:33:b5:c1
00:50:56:33:b5:c2
00:50:56:33:b5:c3
00:50:56:33:b5:c4
00:50:56:33:b5:c5
00:50:56:33:b5:c6
00:50:56:33:b5:c7
00:50:56:33:b5:c8
00:50:56:33:b5:c9
3. Execute the script to
[Email protected] addhost]# sh addhost.sh
Adding Host Node1.
Adding Host Node2.
Adding Host Node3.
Adding Host node4.
Adding Host Node5.
Adding Host Node6.
Adding Host Node7.
Adding Host Node8.
Adding Host Node9.
Adding Host Node10.
4. View the list of added hosts
[email protected] addhost]# Rocks list Host
HOST Membership CPUS RACK RANK runaction installaction
Cluster:frontend 1 0 0 OS Install
Node1:compute 8 0 0 OS Install
Node2:compute 8 0 1 OS Install
Node3:compute 8 0 2 os Install
Node4:compute 8 0 3 OS Install
Node5:compute 8 0 4 OS Install
Node6:compute 8 0 5 os Install
Node7:compute 8 0 6 OS Install
Node8:compute 8 0 7 OS Install
Node9:compute 8 0 8 OS Install
Node10:compute 8 0 9 os Install
5. Each node starts from the network, can obtain the corresponding IP, and starts to install the system
This article is from the "Never Stop" blog, please be sure to keep this source http://wjcaiyf.blog.51cto.com/7105309/1690847
Rocks Quick Add Node