Pages

Wednesday, November 5, 2008

Build your own WebLogic 10.3 cluster

For one of my customer I had to build a JMS cluster to provide High Availablility for one of the customer applications. The choice to do this with WebLogic is very easy. WebLogic is excellent with JMS and clustering so let's make a cluster first and then add a JMS ConnectionFactory and a Distributed Queue to this cluster.
Download and install WebLogic 10.3 on the servers of the cluster and don't forget the install the nodemanager. You don't have to install Workshop for WebLogic
Start the "Configuration Wizard" to create a new WebLogic domain.
Choose Yes, so we can add our own cluster, node managers and managed servers.
WebLogic will use a database as domain repository. In my case I will use MySQL as database. Off course you can use an Oracle database too. In the bea_home\wlserver_10.3\server\lib folder there are some scripts to create the weblogic repository. For Oracle is this the "rdbms_security_store_oracle.sql" file. Too bad there isn't a script for the MySQL database so I changed one of the scripts so it matches MySQL ddl.
Add two or more managed servers to this domain.
Create a new cluster and add the two managed servers to this cluster.
Add the node managers to this domain.
Add the AdminServer and Managed Server 1 to the first machine and Managed Server 2 to the second.
The last step is to give this domain a name and storing this domain in the user_projects folder
Start the Admin Server and after this you can start the Admin Server Console.

Go the control tab of the Servers where we can start the first managed server. Make Sure the node manager is running on this server.
To start the second managed server we have to do a little more. We need to pack the domain configuration on the first machine and unpack this on the second machine. After this we can start this second managed server.
go to this folder D:\Apps\bea\wlserver_10.3\common\bin>

pack -managed=true -domain=D:\Apps\bea\user_projects\domains\mhs_domain -template=d:\apps\mhs_domain_template.jar -template_name="mhs domain"

On the second machine we can unpack this domain
unpack -domain=D:\Apps\bea\user_projects\domains\mhs_domain -template=mhs_domain_template.jar

Now we can go back the console and start the second managed server. ( Be sure that the node manager is started on this machine)

If you want JMS clustering then you need to make a JMS server on all managed nodes.


Create a Connection Factory which has the Cluster as subdeployment. The last step is to create a distributed Queue or Topic.

That's all.

29 comments:

  1. Hi! How about linux (RHEL)?

    1. I have problem with starting managed servers from web admin console. But command ./startManagedWeblogic.sh ESB1_ManagedServer http://esb1:7001 executes normally (with StartScriptEnabled=true in nodemanager properties and correct credentials in boot.properties).

    ReplyDelete
  2. Hi,

    Yeah I know, we have the same problem. It has something to do with the path of the nodemanager.

    I know thursday more details what the problem.

    thanks

    ReplyDelete
  3. Hi Edwin,
    Have you had the time to fix the problem of starting and stopping the servers from admin console? I am having the same problem.

    Thanks,
    Chandra

    ReplyDelete
  4. Hi Edwin, is there a way to start the managed servers automatically once the administration server is started?

    Also, I tried to start a remote managed server from the admin server using the startManagedServer command, but this gave me an error. Is this normal?

    Thanks for your helpful guide - I was able to do clustering very easily.

    ReplyDelete
  5. Hi,

    you got a utility beasvc in wlserver_10.3\server\bin

    yep the error is normal , I think wls start the managed server from the domain folder instead of domain\bin

    ReplyDelete
  6. Hi Edwin,

    I am trying to build a clustered environment for WL 10.3 with two machines (MS1 and MS2 - each one in a different hardware). I tried the way you have explained.
    1. Packed the domain created in first machine with the template of the domain.
    2. Unpacked it in the second machine using the same template.

    But however, i always get the following exception when I tried to start the second managed server on machine MS2 from the Admin Console of the First machine.

    Starting "async" replication service with remote cluster address "null".
    Server failed to bind to the configured Admin port. The port may already be used by another process.
    Unable to create a server socket for listening on channel "Default". The address 152.16.210.67 might be incorrect or another process is using port 7011: java.net.BindException: Cannot assign requested address: JVM_Bind.

    I also made sure the Node Manager on MS1 is running and the port is not used by any other process.

    Am I missing anything here?

    Thanks,
    Raj.

    ReplyDelete
  7. Hi ,

    Is your node manager on the second server running. did you start the admin server and has the second manager the right ip and running on the correct machine / node manager

    thanks Edwin

    ReplyDelete
  8. Hi Edwin,

    Thanks for your reply.
    Following is the setup i have.

    1. Admin server in the first hardware is up and running.
    2. Two Managed Servers MS1 and MS2 each mapped to machines M1 and M2 (this one in a different hardware) respectively.
    3. Managed Server MS2 and Machine M2 are configured in the same cluster (in the first hardware) with its own IP and port.
    4. The Node Manager is running on both 1st and 2nd machines (both point to port 5556 in their respective boxes).
    5. The Admin Server is NOT running on 2nd machine. I read in a different article that the Admin server in 2nd hardware should not run.
    Will that have to run too? i started it, but resulted in the same issue.

    Kindly let me know whats going wrong here or if you need any other info.

    Thanks,
    Raj.

    ReplyDelete
  9. Ok,

    you don't need to start the admin on the second server.

    When you start the 2nd managed server then you get this error.

    and copy again the user_projects folder to the second server

    please take a look at this post hope this helps

    http://biemond.blogspot.com/2009/02/high-available-weblogic-cluster.html

    thanks Edwin

    ReplyDelete
  10. Thanks Edwin,

    It worked finally, there seems to be some issue with the node manager in the second machine. I recreated the setup in the second machine and that solved the problem.

    Really appreciate your help.

    thanks,
    Raj.

    ReplyDelete
  11. Hi,

    Topic : Weblogic 10.3.0.0 cluster and plugin with Apache2.2 on 2 Windows xP machines

    Machine 1 (mc1 - 1.1.1.1) (also NodeManager running on port 5556)
    machine 1 (m1) - ip as 1.1.1.1 and port 5556 for nodemanager
    machine 2 (m2) - ip as 2.2.2.2 and port 5556 for nodemanager

    domain name - cluster_domain (which has the following server instances)
    Admin server - admin ip as 1.1.1.1 and port :9001
    Managed Server1(MS1) - ip as 1.1.1.1 and port:7001
    Managed Server2(MS2) - ip as 2.2.2.2 and port:7002



    Machine 2 (mc2 - 2.2.2.2) (also NodeManager running on port 5556)
    machine 1 (m1) - ip as 2.2.2.2 and port 5556 for nodemanager

    domain name - some_domain (which has the following server instances)
    Admin server - admin ip as 2.2.2.2 and port :9001
    Managed Server1(MS1) - ip as 2.2.2.2 and port:7001

    looking at the setup above - i deployed the app in cluster domain and can able to run application with load-balancing
    shutdown MS1 and app still works and shutdown MS2 still works but during this time i havn't started the MS1 on mc2
    is it really a cluster? but i can see a folder created for MS2 on mc2 can see console o/p on node mgr window on mc2

    but i'm thinking that somehow i need to sync the MS1 with MS2 also should i deploy the app on both systems or only on the
    system where cluster is there?

    I don't get the linking of remote m/c instance with the instance for the remote m/c in the first m/c - also how the
    deployment will be - because i'm using apache the serving ip is showing only mc1 always but when i use the link with port
    no separately then it works as separate ip

    Any help would be much appreciated..

    Thanks,
    Kumar

    ReplyDelete
  12. Hi Kumar,

    Did you read this http://biemond.blogspot.com/2009/02/high-available-weblogic-cluster.html

    because you need to have migratable targets as servers and the servers need to have a own dynamic ip address so then it can be moved to the other server in case of a failure.

    and in the webapp you need to specify the synchronisation method of the http sessions.

    thanks Edwin

    ReplyDelete
  13. Edwin,
    Thanks for the reply.
    But I can't start the remote managed server instance itself - I did the pack/unpack and then starting the remote instance from the local cluster console but it is not starting throwing some security exception - access denied - I changed the boot.properties by entering user/pass but it is not accepting...so i'm still stuck with starting remote server only ...but i tested the fail-over via apache and it is working though for instances running in local clusters..
    did you get my question - i can't start the remote managed server from the local cluster console ? any suggestions- i'm almost there just need to fix this security exception i guess.
    Thanks,
    Kumar.

    ReplyDelete
  14. Hi Kumar,

    Can you start it manually, go to the bin folder of your domain and use startManagedServer xxxxxx

    if you do it from the nodemanager then you can try to turn off security in the nodemanager

    thanks Edwin

    ReplyDelete
  15. Hi,
    Thanks again for the reply.

    I can start teh managed server somehow from the cmd prompt startManagedWebLogic "ms" "ip" but the thing is eventhough i can start managed server in remote m/c also in the cluster m/c both having the same ip & port - i don't see any link or sync between them ...this is where i'm stuck and what i tried to do is change the war in remotem/c and see if i can see the change when i shutdown the first instance in cluster but i don't see it....

    But can you get my issue like what exactly i'm saying otherwise I can send you more details if you require ..

    thanks for your support again,

    Thanks,
    Kumar.

    ReplyDelete
  16. Hi Kumar,

    Ok let's verify this, every server in the cluster need to have its own ip address or at least a different port number, the managed servers don't share the same ip / port.

    for 1 ip cluster address you need a different server with apache with a ip /port number and this web server re-directs ( round robin ) the request to one of the managed servers.

    and in the webapp (weblogic-application.xml ), you need to configure how the http session synchronisation has to work.

    hope this helps

    ReplyDelete
  17. Hi Edwin,
    Thanks for the response,

    It does help a bit.

    i have 2 server instances in cluster m/c - first one is same ip as the cluster m/c - second one is having ip/port as second m/c and also i created a server instance in remote m/c which match up with second instance in cluster m/c..

    Actually, I'm confused with the managed server instance in remote m/c - i create a new server with the same ip and now i'm trying to test it ...should i deploy the eAR in cluster as well as remote mgd server or only in cluster or only in remote msg server ?

    because when i start the cluster it starts the two instances in the cluster(one is having local ip & second is remot m/c ip) but not the managed server instance on the remote m/c ?

    Thanks,
    Kumar.

    ReplyDelete
  18. Hi

    Clusters does not exists in weblogic ( as a java process and don't have a ip ). wls managed servers can be combined in a cluster (it is a definition) and managed servers can work together ( jms, ejb, webapps) ( if you configure this ).

    you can deploy to this cluster. then wls will deploy it in every managed server of this cluster

    normal you would have 2 servers (ip1), one for admin (7001) and the 1st managed server of the cluster (port 8001) plus a node manager (port 5556)
    on the second (ip2) you only have one managed server (port 8001), this is the 2nd server of the cluster and the node manager (port 5556)
    that's all , deploy your webapp to the cluster and configure apache with the two ip and use 8001 as port and configure your load balancer policy.

    can you make a picture of your configuration and send me also the config.xml

    send it to biemond at gmail dot com

    ReplyDelete
  19. Hi Edwin,

    Thanks again for your reply.
    Theoritically , whatever you say is right practically also right but with slight changes i guess.

    the second (ip2) by default will have an admin server right? or is it possible to have only managed server 2? and also mainly how would i add this ms2 to the cluster which is in (ip1) again i need to create a server instance which points to ip2 isn't?

    i just deleted my old settings and tried to follow your steps then i was stuck in adding the ms2 in ip2 to the cluster which is in ip1 ?

    In the meantime, I'll try to recreate my old settins or similar and send you the config.xml

    Thanks,
    Kumar.

    ReplyDelete
  20. Hi Edwin, I'm trying to understand how vertical clustering can be configured for weblogic. can you tell how the configuration would be different from what you explained for clustering multiple machines. thanks for your time, your clustering example was very helpful. Mike

    ReplyDelete
  21. Hi Mike,

    vertical clustering, do you mean all on 1 machine.

    it will be same on you got one nodemanager and the managed server should run on different ports.

    thanks

    ReplyDelete
  22. Hi Edwin, Thanks for the response on vertical clustering. Yes, I do mean one machine with multiple JVM's. could you possible step me though the process? do i have on nodemanager and two managed servers with differnt ports? then do I create a cluster for those two managed servers eventhough they are running on the same physical machine? Can i add the adminserver to this cluster? Sorry for being so ignorant on this topic.
    All your help is greatly appriciated.
    Mike

    ReplyDelete
  23. Hi Edwin,
    here is my request.
    I already have weblogic admin server and soa managed server in machine 1, both of them are working fine. Now my request is to add a one more managed soa server and make both of them in a cluster.
    Can you send me a link which explains this scenario.

    ReplyDelete
  24. Hi,
    How to setup weblogic cluster in single machine with 2 instance.

    I have a PC with weblogic installed in it.

    Thanks,
    senthil

    ReplyDelete
  25. Hi Senthil,
    If you follow the steps in this blog and i've already put my steps there to create two instances though.
    Anyways, using weblogic console just create two instances which has same ip address but different ports and then create a cluster and add these 2 instances to it. and follow the rest of the steps.

    NB: whether it is same system or different systems any number of instances can be created with differences in ip address/port or combinations

    All the Best,
    Kumar.

    ReplyDelete
  26. Hi Edwin.
    I have a cluster with 2 managed servers with 6Gb heap for each server. My hardware has 32Gb RAM, so I want to add more managed server for increasing HA of my cluster. Can you give me some guide to determine how many managed server should I choose?
    Thank in advance
    Cuong Pham

    ReplyDelete
    Replies
    1. Hi,

      its a bit tricky , your machine can only handle a certain number of concurrent threads, so if one server can already handle the load then you already have enough. When 1 server goes down and you can handle the load with the others then you know you have enough

      6gb is huge, did you take a look at the memory , 2 or 3gb is mostly enough, or do you have a big xml payloads or many concurrent web sesssions.

      thanks

      thanks

      Delete
    2. Hi Edwin,

      its very nice blog... we do have same kind of requirement.
      like we have 3 SPARK 3.0Gz mechines with 128gb each. we are creating 3 domians with application boundaries as the criteri.

      Now in each Doamin, how many managed servers do i need to create to handle 860 Transactions per secodnd. please advise, it will of great help.

      or guide me where i can get the details.

      thanks
      Venakt

      Delete
    3. Hi,

      it all depends what the transaction is , writing to a database or do something else. In this case your database or network can be your bottleneck. if that is ok how many cores you have and what is the max concurrent transactions of your machines. Then you know if you need to add some extra cores.

      good luck

      Delete