Remote Administration Of Domain Through WLST

For administration of the whole domain and all the servers in the domain, we can use WLST commands. This is the best way for a monitoring and managing the complete domain using nodemanager.

To start the admin server using WLST, ensure that the admin server is associated to a machine. Once done, start the WLST tool.

Start the nodemanager using the command startNodeManager() as seen in the image.

Note: Nodemanager starts and runs irrespective of the WLST tool. Even if you exit from WLST, the nodemanager will still be running.

Now you need to connect to the nodemanager using the nmConnect() command. This needs to be done because you need to start the the servers through node manager.

Example:  nmConnect(‘weblogic’, ‘weblogic’, ‘localhost’, ‘5556’, ‘example_domain’,’D:/BEA103/user_projects/domains/example_domain’,’plain’)
– The above command takes username, password, hostname, port, domain name, domain directory and nodemanager type (SSL, Plain) as arguments.

1) To start the admin server through WLST using nodemanager, type the below command:
– nmStart(‘AdminServer’)

2) To check the status of the admin/managed servers, type the command:
– nmServerStatus(‘AdminServer’)
– nmServerStatus(‘MS1’)

3) To stop/kill the server, enter the command:
– nmKill(‘AdminServer’)

Steps to start the managed servers remotely:

– On the remote machine, start the WLST tool and connect to the local running admin server:

Once connected, do the nmEnroll from the remote machine:
nmEnroll(‘D:/BEA103/wlserver_10.3/common/nodemanager’)

Now to start the managed servers from the remote machine, connect to the nodemanager using nmConnect as above and do the nmStart on the managed servers.

The servers status can be checked from the remote machine.

If you have any queries, do get back to us.

Best Regards,
Wonders Team!

21 comments

    1. Hi Sahil,

      Yes running nmenroll means the correct username and password are supplied to each managed server.

      Regards,
      Divya

    1. Hi Ravi,

      From the admin console, expand Environments, click on machines, create a new machine. Then go to the machine created, configurations -> servers tab. Click on add. There you can add the admin server.

      Regards,
      Divya

  1. Hi Divya,

    Good one, this is very import when we are using big environments having many managed servers, clusters and n number remote machine’s ,though we can do this through console we cannot trust it as command line gives you what actually going on when try to start remote managed server from different R server where admin is running

    Please keep posting such type of articles.

    Thanks,
    Ravi

  2. Hi Team, how do we know the installed weblogic is evalution or enterprise

    and one more question is how do we subit the questions in this forum

    1. Hi Kishore,

      You can monitor resources on WLS using WLST or JMX.
      You can also use some third party tools like introscope.

      Is there anything specific you are looking for?

      -Faisal

    1. Hi Suresh,

      It is not possible in weblogic to have cluster of clusters. I do not see any need of it either when you have horizontal clustering in picture.

      Regards,
      Divya

  3. Hello Wonders Team!
    I am looking for a use case, where i need to create two managed servers to running admin servers

    condition 1: Adminserver and managed_server1 will be in same machine.

    codition 2: managed_server2 will be in other machine.

    I have a code which will create two managed servers in a same machine.

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.*;
    import weblogic.management.scripting.utils.WLSTInterpreter;
    import org.python.util.InteractiveInterpreter;

    public class EmbeddedWLST
    {
    static InteractiveInterpreter interpreter = null;
    EmbeddedWLST()
    {
    System.out.println("Inside the constructor()");
    interpreter = new WLSTInterpreter();
    }
    private static void connect()
    {
    System.out.println("Inside the Connect method()");

    StringBuffer buffer = new StringBuffer();
    buffer.append("connect('weblogic','1qaz2wsx','t3://localhost:7001')");
    System.out.println("After Connect method()");
    interpreter.exec(buffer.toString());
    System.out.println("at the end of conenct method");
    }
    private static void createServers()
    {
    System.out.println("Inside the CreateServer method()");
    StringBuffer buf = new StringBuffer();
    buf.append(startTransaction());
    buf.append("man1=create('msEmbedded1','Server')\n");
    buf.append("man2=create('msEmbedded2','Server')\n");
    buf.append("mach=create('machineEmbedded','Machine')\n");
    buf.append("clus=create('clusterEmbedded','Cluster')\n");
    buf.append("man1.setListenPort(8001)\n");
    buf.append("man2.setListenPort(9001)\n");
    buf.append("man1.setCluster(clus)\n");
    buf.append("man2.setCluster(clus)\n");
    buf.append("man1.setMachine(mach)\n");
    buf.append("man2.setMachine(mach)\n");
    buf.append(endTransaction());
    //buf.append("print Script ran successfully ... \n");
    interpreter.exec(buf.toString());
    }
    private static String startTransaction() {
    StringBuffer buf = new StringBuffer();
    buf.append("edit()\n");
    buf.append("startEdit()\n");
    return buf.toString();
    }
    private static String endTransaction() {
    StringBuffer buf = new StringBuffer();
    buf.append("save()\n");
    buf.append("activate(block='true')\n");
    return buf.toString();
    }
    public static void main(String[] args) throws IOException
    {
    System.out.println("inside the main ");
    Runtime rt2 = Runtime.getRuntime();
    Process pr2 = rt2.exec("cmd /c C:\\Oracle\\Middleware\\wlserver_10.3\\server\\bin\\setWLSEnv.cmd ");
    BufferedReader br = new BufferedReader(new InputStreamReader(pr2.getInputStream()));
    String line = "";
    while ((line = br.readLine()) != null)
    {
    System.out.println(line);
    }
    new EmbeddedWLST();
    connect();

    createServers();
    }
    }

    Thanks Alok

  4. Yes, i am trying to modify the code, to create the managed servers in two different machines,

    Loooking for help

    Thanks,
    Alok G

  5. I am new to web logic.
    I have windows 32bit,64 bit,linux 32 bit 64 bit and unix 32 bit,64 bit.

    Is it possible to make cluster setup on web logic server.

    Regards,
    Raman

    1. OS and bit version should be same for servers to run of different machine and be a part of the same cluster…

  6. Hi Admin,

    suppose there are 10 box and you want to start all the nodemanager in all the 10 box from 1 box is there any wlst script we can achieve this?

    regards,
    rav

  7. Dear Admin,

    How to take inputs from excel and stop the server through remote machine. I know about starting/stopping Admin and managed servers from same or different machine. But can you please help how to take inputs from excel and stop the server

    Thanks,
    Sai Santhosh.

Leave a Reply