This discussion is archived
5 Replies Latest reply: Oct 3, 2011 6:40 AM by RenévanWijk RSS

WLSIFCONFIG in Windows doesnt works. Weblogic Cluster

716557 Newbie
Currently Being Moderated
I am trying to configure a cluster with 2 nodes in Windows WLS10.3.5.

I have configured nodemanager.properties
Interface=eth0
NetMask=255.255.255.0

and i have activated the option "Automatic Migration" of each server.

When i try to init the servers i have problems with the command "wlsifconfig.cmd". it looks that have unix commands like grep, rm, etc...
¿Anyone have the correct command for windows?

thanks a lot
  • 1. Re: WLSIFCONFIG in Windows doesnt works. Weblogic Cluster
    RenévanWijk Oracle ACE
    Currently Being Moderated
    Note that on Windows your interface name is probably not 'eth0'.

    To retrieve the network name, click the start menu, settings, network connection. It is probably called something like ' Local Area Network'.

    "When i try to init the servers i have problems with the command wlsifconfig.cmd..."
    - The wlsifconfig.cmd script is used to transfer IP addresses from one machine to another during migration.
    - http://download.oracle.com/docs/cd/E21764_01/web.1111/e13709/migration.htm
    - wlsifconfig.cmd uses the NETSH command to configure the network configuration:
    - http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/netsh_int_ip.mspx?mfr=true

    Before you go down the path of whole server migration you can think about making the cluster redundant enough to handle
    failures gracefully, such that applications do not experience service level degradation when one of the managed servers fails.
    Some notes about scaling are discussed here: http://middlewaremagic.com/weblogic/?p=7265
  • 2. Re: WLSIFCONFIG in Windows doesnt works. Weblogic Cluster
    716557 Newbie
    Currently Being Moderated
    I changed the name of the Interface to eth0.

    The problems is unix commands in windows commands. This is my wlsifconfig.cmd


    @ECHO OFF
    if defined DEBUG @echo on

    @REM
    @REM Additional commands to support node manager ip migration.
    @REM

    @REM Parse command and options
    if [%1]==[] CALL :usage_error

    set COMMAND=
    set INTERFACE=
    set ADDRESS=
    set NETMASK=
    set ERRORLEVEL=

    if [%1] == [-addif] (
    set COMMAND=addif
    set INTERFACE=%2%
    set ADDRESS=%3%
    set NETMASK=%4%
    if not defined INTERFACE call :usage_error
    if not defined ADDRESS call :usage_error
    if not defined NETMASK call :usage_error
    )


    if [%1] == [-removeif] (
    set COMMAND=removeif
    set INTERFACE=%2%
    set ADDRESS=%3%
    if not defined INTERFACE call :usage_error
    if not defined ADDRESS call :usage_error
    )

    if [%1] == [-listif] (
    set COMMAND=listif
    set INTERFACE=%2%
    if not defined INTERFACE call :usage_error
    )

    @REM Must have specified at least one command
    if not defined COMMAND CALL :usage_error

    set NullDevice=nul

    @REM *********************************************************************
    @REM Set this to true if IP address should not be online before starting
    @REM a server. Otherwise, presence of an IP address in an interface will
    @REM cause the script to report success on IP addif
    set ENABLESTRICTIPCHECK=N

    if not defined ServerName set ServerName=myserver
    if not defined ServerDir set ServerDir=%CD%
    if not exist "%ServerDir%\data\nodemanager" mkdir "%ServerDir%\data\nodemanager"

    set addrFile=
    set addrFile=%ServerDir%\data\nodemanager\%ServerName%.addr

    call :%COMMAND%
    GOTO :EOF

    @REM --- Start Functions ---

    @REM *********************************************************************
    @REM Show an error if the address does not show up in the address file
    :address_error
    SETLOCAL
    ECHO Cannot remove %ADDRESS% - not brought online >&2
    exit 1

    @REM *********************************************************************
    @REM Remove the given address from the interface specified
    :removeif
    SETLOCAL

    @REM Store the contents of the address file as the %addr% var
    if exist "%AddrFile%" (
    grep %ADDRESS% %AddrFile% > null || call :address_error
    )
    netsh interface ip delete address %INTERFACE% addr=%ADDRESS%
    set remExitVal=%ERRORLEVEL%
    if not %remExitVal% == 0 (
    echo Unable to remove %ADDRESS% - Check command output for more details >&2
    call :cleanupAddressFile
    exit %remExitVal%
    )
    echo Successfully removed %ADDRESS% from %INTERFACE%.
    call :cleanupAddressFile
    GOTO :EOF



    @REM *********************************************************************
    @REM Show the correct message (info or error) if the given address is already
    @REM on the specified interface. This is normally an informative message
    @REM unless ENABLESTRICTIPCHECK is set to something other then the default 'N'.
    :already_online
    if [%ENABLESTRICTIPCHECK%] == [N] (
    echo %ADDRESS% already online on %INTERFACE%. Please make sure that the IP address specified is not used by other servers/applications. Continuing...
    ) ELSE (
    echo %ADDRESS% already online on %INTERFACE%. Please make sure that the IP address specified is not used by other servers/applications >&2
    call :cleanupAddressFile
    exit 1
    )
    GOTO :EOF

    @REM *********************************************************************
    @REM Show that an error occured calling the netsh utility
    :add_error
    SETLOCAL
    echo Failed to bring %ADDRESS% with %NETMASK% online on %INTERFACE% >&2
    echo Check command output for more details >&2
    exit 1
    ENDLOCAL


    @REM *********************************************************************
    @REM Add the given address to the specified interface
    :addif
    SETLOCAL
    set newif=
    netsh interface ip show address %INTERFACE% | grep -e '[^      ]*IP' > tmp_ip_file
    for /F "usebackq tokens=3" %%G in ( tmp_ip_file ) do (
    if %%G == %ADDRESS% set newif=already-online
    )
    if not defined newif set newif=unmatched
    del tmp_ip_file

    if [%newif%] == [unmatched] (
    call :addnew
    ) ELSE call :already_online

    if exist "%AddrFile%" call :cleanupAddressFile
    echo %ADDRESS%>> "%AddrFile%"
    ENDLOCAL
    GOTO :EOF



    @REM *********************************************************************
    @REM For some reason catching the error value has problems when it is not in
    @REM its own subroutine. Setting addExitVal in the :addif routine leaves the
    @REM variable as undefined causing extra error messages in the script output
    @REM
    :addnew
    SETLOCAL
    netsh interface ip add address %INTERFACE% %ADDRESS% %NETMASK%
    set addExitVal=%ERRORLEVEL%
    if not %addExitVal% == 0 call :add_error %addExitVal%
    echo Successfully brought %ADDRESS% with %NETMASK% online on %INTERFACE%
    ENDLOCAL
    GOTO :EOF


    @REM *********************************************************************
    @REM Check the %AddrFile% for %ADDRESS% and if it is there, then call the
    @REM subroutine to delete it
    @REM
    :cleanupAddressFile
    SETLOCAL
    if exist "%AddrFile%" (
    grep -x %ADDRESS% %AddrFile% > nul & CALL :removeAddressFromFile
    )
    ENDLOCAL
    GOTO :EOF


    @REM *********************************************************************
    @REM Delete %ADDRESS% from the %AddrFile%
    @REM
    :removeAddressFromFile
    SETLOCAL
    set tmpAddr=addresses.tmp
    for /F "delims=" %%a in (%AddrFile%) DO (
    if not %%a == %ADDRESS% (
         echo %%a>> %tmpAddr%
    )
    )
    del -f %AddrFile%
    if exist %tmpAddr% (
    move %tmpAddr% %AddrFile%
    del -f %tmpAddr%
    )

    ENDLOCAL
    GOTO :EOF



    @REM *********************************************************************
    @REM List the IP addresses that are currently on the interface
    :listif
    netsh interface ip show address %INTERFACE% | grep -e '[^      ]*IP'
    GOTO :EOF


    @REM *********************************************************************
    @REM Show the correct usage of this script in the instance that someone
    @REM called the script incorrectly
    :usage_error
    ECHO Usage: wlsifconfig.cmd >&2
    ECHO -addif {interface-name} {ip-address} {netmask} >&2
    ECHO -removeif {interface-name} {ip-address} >&2
    ECHO -listif {interface-name} >&2
    ECHO 'addif' adds {ip-address} to next available sub-interface of {interface-name}. >&2
    ECHO 'removeif' removes {ip-address} from sub-interface of {interface-name}. >&2
    ECHO 'listif' lists last used sub-interface of {interface-name} and its corresponding {ip-address} >&2
    ECHO To grep the list of interfaces, use your following command to list the interface names- >&2
    ECHO netsh interface show interface. >&2
    exit -101
    GOTO :EOF

    :ENDFUNCTIONS

    @REM --- End Functions ---
  • 3. Re: WLSIFCONFIG in Windows doesnt works. Weblogic Cluster
    RenévanWijk Oracle ACE
    Currently Being Moderated
    and where are those Unix commands?

    (:listif netsh interface ip show address %INTERFACE% | grep -e '[^ ]*IP')

    You did put the right wlsifconfig in your PATH? From the documentation:
    Ensure that the following commands are included in your machine PATH:
    - wlsifconfig.sh (UNIX) or wlsifconfig.cmd (Windows)
    - wlscontrol.sh (UNIX)
    - nodemanager.domains
  • 4. Re: WLSIFCONFIG in Windows doesnt works. Weblogic Cluster
    716557 Newbie
    Currently Being Moderated
    grep %ADDRESS% %AddrFile% > null || call :address_error

    netsh interface ip show address %INTERFACE% | grep -e '[^ ]*IP' > tmp_ip_file

    grep -x %ADDRESS% %AddrFile% > nul & CALL :removeAddressFromFile

    netsh interface ip show address %INTERFACE% | grep -e '[^ ]*IP'
  • 5. Re: WLSIFCONFIG in Windows doesnt works. Weblogic Cluster
    RenévanWijk Oracle ACE
    Currently Being Moderated
    Good to know the script has been tested on a regular Windows PC.

    Can you try to install 'Grep for Windows' - http://gnuwin32.sourceforge.net/packages/grep.htm - To see if that resolves the issue.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points