Ever gone to login to your MDM SCLI and come up with this error?:
Error: Failed to connect to MDM 127.0.0.1:6611
Normally in this case, you can just use the –mdm_ip x.x.x.x command to force it to login to the other MDM, however you’ll then probably need to setup an alias as well so that you do not need to add the –mdm_ip entry to every single commnad.
Regardless of that, fret no more! Just copy and paste this into a file on each of your MDM’s, and adjust the MDM IP values accordingly (**Update, before doing this, please skip straight to the bottom to see a much easier method):
#!/bin/bash # This bash script is to make your life even more efficient. # This script needs to be executed with "source ./login" or ". ./login" to allow the alias insert to the parent shell read -p "Good day sir, what is your username?: " user # Use these first two lines if you don't wish to see the "Error: Failed to connect to MDM 127.0.0.1:6611" error. scli --login --username $user --mdm_ip <MDM #1 MGMT IP> 2> /dev/null scli --login --username $user --mdm_ip <MDM #2 MGMT IP> 2> /dev/null #Otherwise use these if you wish to see connect errors: #scli --login --username $user --mdm_ip <MDM #1 MGMT IP> #scli --login --username $user --mdm_ip <MDM #2 MGMT IP> # Check which MDM is the master and add SCLI alias command if necessary if scli --query_all &> /dev/null; then quit else alias scli="scli --mdm_ip <MDM #2 MGMT IP>" echo "SCLI alias has been set, your MDM is Master on another node" fi # echo "Done, I am a happy user"
- Please take note of the requirement to execute this command with the “source ./login” or “. ./login” method.
- You will need to flip the MDM #1 and MDM #2 IP’s around on the opposite MDM.
If you have an even lazier method of achieving this goal, please let us know in the comments!
Update: and of course we found a much simpler method – just add this to your .bashrc file on both MDMs:
alias=scli='scli --mdm_ip <Virtual IP #1>,<Virtual IP #2>'
You can find your existing virtual IP’s by running the following command
scli --query_cluster