Overview
This section describes how to setup a WebLogic 9.2 cluster on Linux servers using the BEA WebLogic Scripting Tool (WLST). WLST is a scripting tool installed with WebLogic that allows for command-line configuration of the WebLogic server. The set of scripts provided here along with these instructions will allow you to setup a WebLogic cluster in your environment with ease.
Clustering Scripts Setup
In preparation for running the WLST scripts to create a cluster, you will need to download the WLST Clustering Scripts (ZIP, 7KB) and unzip it to a directory. After that, configure the environment variables in all of the scripts to match your environment. A description of the variables that will need to be set can be found in the section Environment Variables to Configure in the WLST Scripts. After that, copy the files to the servers that you will be using in the cluster. You will then need to navigate to this directory on a server to execute any of the scripts on that server.
Steps to Create the WebLogic Domain and Setup the Cluster
On the Server hosting the AdminServer:
Create a domain with AdminServer and a cluster of two managed servers |
WL_HOME/common/bin/wlst.sh createcluster.py DOMAIN_NAME CLUSTER_NAME |
Start the node manager and AdminServer |
WL_HOME/common/bin/wlst.sh startadminserver.py DOMAIN_NAME |
Setup JDBC Data Source |
WL_HOME/common/bin/wlst.sh createjdbc.py t3://AdminServerIP:AdminServerHttpPort CLUSTER_NAME |
Pack the domain |
WL_HOME/common/bin/pack.sh -managed=true -domain=DOMAIN_PATH -template=DOMAIN_TEMPLATE -template_name=DOMAIN_TEMPLATE_NAME |
On all servers not hosting the AdminServer:
Unpack the domain |
Copy DOMAIN_TEMPLATE from the server hosting the AdminServer to the same directory on all other servers that are apart of the cluster and then execute the following command on the servers to create the base domain: WL_HOME/common/bin/unpack.sh -domain=DOMAIN_PATH -template=DOMAIN_TEMPLATE |
Enroll the node manager with AdminServer and then start it |
Execute the following command on the servers to setup the node managers and start them: WL_HOME/common/bin/wlst.sh enrollnodemanager.py t3://AdminServerIP:AdminServerHttpPort DOMAIN_NAME |
On the Server hosting the AdminServer:
Deploy the Elastic Path code to the cluster |
WL_HOME/common/bin/wlst.sh deploy.py t3://AdminServerIP:AdminServerHttpPort DEPLOYMENT_NAME APPLICATION_PATH CLUSTER_NAME |
Start the cluster |
WL_HOME/common/bin/wlst.sh startcluster.py t3://AdminServerIP:AdminServerHttpPort CLUSTER_NAME |
Additional Useful Scripts
To create another server in the cluster, execute this command after step 1 |
WL_HOME/common/bin/wlst.sh createmanagedserver.py DOMAIN_NAME CLUSTER_NAME |
To shut down server ServerName |
WL_HOME/common/bin/wlst.sh stopserver.py DOMAIN_NAME ServerName |
To remove a deployment |
WL_HOME/common/bin/wlst.sh undeploy.py t3://AdminServerIP:AdminServerHttpPort DEPLOYMENT_NAME |
Descriptions of Constants Used in Setup Steps
BEA_HOME |
The BEA Home directory where files common to all BEA products are stored (eg. /opt/bea/) |
WL_HOME |
The WebLogic Server product installation directory (eg. /opt/bea/weblogic92/) |
AdminServerIP |
The IP address of the server that the AdminServer is on |
AdminServerHttpPort |
The port for the AdminServer to listen to http requests on |
DOMAIN_NAME |
The name of the clustered domain to be created (eg. epclusterdomain) |
DOMAIN_PATH |
BEA_HOME/user_projects/domains/DOMAIN_NAME (the path to the clustered domain) |
DOMAIN_TEMPLATE |
The filename of the domain template to be created or accessed (eg. BEA_HOME/user_templates/epclusterdomain_managed.jar) |
DOMAIN_TEMPLATE_NAME |
The descriptive name of the domain template to be created (eg. “EP Clustered Domain”) |
CLUSTER_NAME |
The name of the cluster to create (eg. wlsCluster) |
DEPLOYMENT_NAME |
The name for the deployment of Elastic Path application code (eg. epsf_cluster_deployment) |
APPLICATION_PATH |
The path to where the Elastic Path application has been setup (eg. /home/build/ep_weblogic/com.elasticpath.sf/) |
Environment Variables to Configure in the WLST Scripts
BEA_HOME |
The BEA Home directory where files common to all BEA products are stored (eg. /opt/bea/) |
WL_HOME |
The WebLogic Server product installation directory (eg. /opt/bea/weblogic92/) |
JAVA_HOME |
The root directory of the Java JDK install that is used to run WebLogic (eg. /opt/j2sdk) |
AdminServerIP |
The IP address of the server that the AdminServer is on |
AdminServerHttpPort |
The port for the AdminServer to listen to http requests on |
AdminServerHttpsPort |
The port for the AdminServer to listen to https requests on |
AdminServerPassword |
The password used to connect to the AdminServer as default user weblogic |
Machine1IP |
The IP address of the server hosting the first managed server in the cluster |
Machine1Name |
The machine name of the server hosting the first managed server in the cluster |
Server1HttpPort |
The port for the first managed server to listen to http requests on |
Server1HttpsPort |
The port for the first managed server to listen to https requests on |
Server1Name |
The name to use for the first managed server in the cluster (eg. epServer1) |
Machine2IP |
The IP address of the server hosting the second managed server in the cluster |
Machine2Name |
The machine name of the server hosting the second managed server in the cluster |
Server2HttpPort |
The port for the second managed server to listen to http requests on |
Server2HttpsPort |
The port for the second managed server to listen to https requests on |
Server2Name |
The name to use for the second managed server in the cluster (eg. epServer2) |
JdbcName |
The descriptive name of the JDBC data source (eg. EP) |
JndiName |
The JNDI name of the JDBC data source (eg. jdbc/epjndi) |
Url |
The JDBC connection URL (eg. jdbc:oracle:thin:@11.11.1.111:1111:ep) |
JdbcDriverName |
The name of the JDBC driver (eg. oracle.jdbc.OracleDriver) |
DbUserName |
The username for accessing the database |
DbUserPassword |
The password for accessing the database |
Awesome article.It helped me to create and configure weblogic cluster.
LikeLike
Thanks!
LikeLike
Hi Sir,
Awesome article.But some time i face one problem when i Start the node manager and Admin-server.
Got the following message:
“WLSTException: Error occured while performing nmConnect : Cannot connect to Node Manager. : Connection refused. Could not connect to NodeManager. Check that it is running at localhost:5556.
Use dumpStack() to view the full stacktrace”.
Can you tell me what is reason behind this.??
LikeLike
Hi Sudhanshu,
Apologize for the delay in replying back. Based on the exception trace it certainly looks like the WLST script is not able to connect to the Node Manager.
Are u executing the script in the same box where the Node Manager is running or executing it remotely.
If it is the same box, then the situation is kind of complex and would need further insight. If you are connecting to a remote machine then one explanation can be the Network. Try to ping the machine that runs your Node Manager from the box you are executing the WLST script and see what kind of packets are being sent and received. If your pings are replied back to, then execute the script to start the Nodemanager and see if you are getting the same exception again.
Cheers
Arun
LikeLike