@daizohn
1. In this case, what rules are there to determine the order of unit-id of any switch in the stack ?
There will be an election and some parameters will be used but you dont need to rely on that. Use the priority command to determine which switch will be the master. Use lower priority for the rest
switch 1 priority 15
With priority 15, this switch will be the master.
2. How to set priorities manually on these switches to determine the order of unit-id ?
Use the command as mentioned above
Config the port as stack.
interface range g1/0/1-2
stack port enable
3. When any switch in the stack fails, what are we specific steps for recovery ?
The step to recovery is replacing the failing switch.
Is it able to replace failure switch in the stack without stopping connections ?
If the switch is connected to each other, how do you suppose to replace one switch without stopping connection to other switch?