如何命令級安裝weblogic11g叢集

jaymarco發表於2020-09-23

1    前言

今天筆記開始為大家介紹weblogic日常運維實踐內容,先簡單來介紹一下Weblogic叢集安裝這一塊內容,其實weblogic的安裝是一項比較簡單的工作,每個人的安裝習慣方式不一定,所以也會存在有很多種不同安裝方案。我們們在工作中比較常用的安裝方式就是圖形嚮導,這種方案方式比較直觀與簡單比較適合weblogic初學者。接下來重點為大家接下文字式命令級安裝weblogic11g叢集。


2    環境準備

  • 兩臺服務配置規格

作業系統:X86 64 位redhat7.2

硬體規格:CPU:2C,記憶體:8G,儲存:200G

  • 軟體介質

JDK介質:jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-x64.bin

Weblogic介質:wls1036_generic.jar


3       Weblogic 軟體安裝

3.1   JDK軟體安裝

要安裝 JRockit ,請在此處下載最新的 Linux x86-64 版本,然後使該檔案可執行並執行:

mkdir  -p /u01/app/oracle/middleware

cd  /u01/app/oracle/middleware

chmod  +x jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-x64.bin

./jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-x64.bin

 

配置當前環境變數並確保 Java 引用的是 JRockit JDK

echo  “export JAVA_HOME=/u01/app/oracle/middleware/jrockit-jdk1.6.0_37-R28.2.5-4.1.0”  >>/etc/profile

echo  “export PATH=$JAVA_HOME/bin:$PATH” >>/etc/profile

  source  /etc/profile

 

驗證環境變數是否生效

Java  -version

  3.2    Weblogic 軟體安裝

1 wls 軟體安裝

cd  /u01/app/oracle/middleware

$JAVA_HOME/bin/java -d64 -Xmx1024m -jar  wls1036_generic.jar

Extracting 0%.............NOTE:  You need to use the -d64 flag above when  using 32/64-bit hybrid JDKs, but I specify it just in case here ;)

Once the GUI starts, respond as  follows:

Welcome

Next

Choose Middleware Home Directory

Create a new Middleware Home

Middleware Home Directory:  /u01/app/oracle/middleware

Next

Accept the warning about the directory  not being empty, click Yes

Register for Security Updates

Uncheck ‘I wish to receive security  updates via My Oracle Support’

Confirm you wish to bypass this, click  Yes

There is a known bug within the  installer at this stage.  If you get caught  in a loop where you cannot bypass this, leave the box ticked and click Yes  and Yes again.

When the ‘Connection failed’ dialog  appears, tick the ‘I wish to remain uninformed…’ box, then Continue and you  should then make it to the next screen!

Next

Choose Install Type

Custom

Next

Choose Products and Components

Untick the ‘Oracle Coherence’ option  (unless you plan to use it)

Next

JDK Selection

Local JDK: Oracle 1.6.0_37 (your  JRockit JDK installation)

Next

Choose Product Installation Directories

WebLogic Server:   /u01/app/oracle/middleware/wls_10.3.6

Next

Installation Summary

Next to install

Installation Complete

Once the installation has finished,  remove the tick next to ‘Run Quickstart’

Done

----------------------------------------------------------------------------------------

  2 、新建 set_wls11.env 檔案交將環境變數配置到 oracle 使用者中 :

----------------------------------------------------------------------------------------

vi ~/set_wls11.env

# WebLogic 11g environment file

export  JAVA_HOME=/u01/app/oracle/middleware/jrockit-jdk1.6.0_37-R28.2.5-4.1.0

export PATH=$JAVA_HOME/bin:$PATH

export  MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

. ./set_wls11.env

----------------------------------------------------------------------------------------

  3 apply 最新的 PSU 補丁

----------------------------------------------------------------------------------------

Patch ID: HYKC

Patch No: 14736139

Download the patch from MOS (no OPatch  utility required).

Create the cache_dir and unzip the  patch:

 

mkdir $MW_HOME/utils/bsu/cache_dir

cd $MW_HOME/utils/bsu/cache_dir

cp  /u01/app/oracle/software/p14736139_1036_Generic.zip  $MW_HOME/utils/bsu/cache_dir

unzip p14736139_1036_Generic.zip

----------------------------------------------------------------------------------------

cd $MW_HOME/utils/bsu

./bsu.sh -install  -patch_download_dir=$MW_HOME/utils/bsu/cache_dir -patchlist=HYKC  -prod_dir=$WLS_HOME

----------------------------------------------------------------------------------------

  4 、檢查 PSU 補丁

----------------------------------------------------------------------------------------

. $WLS_HOME/server/bin/setWLSEnv.sh

java weblogic.version|grep PSU

WebLogic Server 10.3.6.0.3 PSU Patch  for BUG14736139 Fri Mar 22 10:16:54 IST 2012

That’s it, WebLogic is installed and  patched up-to-date, ready for creation of your domain(s).

 

以上補丁軟體需要在兩臺主機上面完成

 

4   weblogic 域配置

4.1   新建domain

mkdir  ~/scripts

 

vi ~/scripts/stop_ClusterDomain.sh

# Set environment variables

export  MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

export DOMAIN_NAME=ClusterDomain

export DOMAIN_HOME=$MW_HOME/user_projects/domains/$DOMAIN_NAME

echo Stopping WebLogic Managed  Servers...

echo Stopping WebLogic Managed Server :  Server_1

$DOMAIN_HOME/bin/stopManagedWebLogic.sh  Server_1

echo Stopping WebLogic Admin Server...

$DOMAIN_HOME/bin/stopWebLogic.sh

echo Stopping Node Manager...

nm_pid=`ps -ef | grep [N]odeManager |  awk '{print $2}'`

if [ "$nm_pid" = ""  ];

then echo Node Manager not running

else echo Killing Node Manager  processes: $nm_pid

kill -9 $nm_pid 2>&1 > /dev/null

fi

echo "Tidying up temp files..."

find $DOMAIN_HOME/servers -name  "*.lok" -exec rm -f {} ;

find $DOMAIN_HOME/servers -name  "*.DAT" -exec rm -f {} ;

echo Done!


4.2   配置免密碼啟動載入

建立一個 boot.properties 啟動管理伺服器的檔案(加密的密碼檔案):

export  DOMAIN_HOME=/u01/app/oracle/middleware/user_projects/domains/ClusterDomain

mkdir -p $DOMAIN_HOME/servers/AdminServer/security

vi  $DOMAIN_HOME/servers/AdminServer/security/boot.properties

 

username=weblogic

password=weblogic1

一旦 WebLogic 伺服器重新啟動,密碼將被加密。


4.3 Weblogic服務啟動

啟動 nodemanger

nohup  $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 &

 

啟動 Admin  Server

nohup $DOMAIN_HOME/startWebLogic.sh  > /dev/null 2>&1 &sleep 10

tail -f $DOMAIN_HOME/servers/AdminServer/logs/AdminServer.log


4.4 節點同步

1 、打包並解包域配置

WebLogic 提供了兩個命令列實用程式pack unpack 。這兩個實用程式提供了一種快速打包現有域的方法用於在群集中的其他計算機上分佈的配置。

cd  $WL_HOME/common/bin

./pack.sh -managed=true -domain=$DOMAIN_HOME  -template=${DOMAIN_HOME}-template.jar -template_name=ClusterDomain

 

2、將jar檔案複製到域中的另一臺機器(linux-web02)

scp ${DOMAIN_HOME}-template.jar linux -web02:/u01/app/oracle/middleware/user_projects/domains

  然後在 linux-web02 使用 unpack 為您的群集域寫入必要的配置檔案:

export  DOMAIN_HOME=/u01/app/oracle/middleware/user_projects/domains/ClusterDomain

cd $WL_HOME/common/bin

./unpack.sh -domain=$DOMAIN_HOME  -template=${DOMAIN_HOME}-template.jar

 

3、註冊第二臺主機linux-web02

現在我們需要將第二臺主機註冊到WebLogic 域中。從第二臺機器(linux-web02 )使用WebLogic 指令碼工具(WLST )連線上去。

$WLS_HOME/common/bin/wlst.sh

connect('weblogic','password1','t3://linux01.vbox:7004')

nmEnroll  ('/u01/app/oracle/middleware/user_projects/domains/ClusterDomain','/u01/app/oracle/middleware/wls_10.3.6/common/nodemanager')

disconnect()

exit()

 

4、新增boot.properties啟動託管伺服器的檔案

vi  ~/scripts/start_ClusterDomain.sh

 

# Set environment variables

export MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

export DOMAIN_NAME=ClusterDomain

export  DOMAIN_HOME=$MW_HOME/user_projects/domains/$DOMAIN_NAME

echo Starting Node Manager...

nohup  $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 &

sleep 10

echo Starting WebLogic Admin Server...

nohup $DOMAIN_HOME/bin/startWebLogic.sh  > /dev/null 2>&1 &

sleep 120

echo Starting WebLogic Managed  Servers...

echo Starting WebLogic Managed Server :  Server_2

nohup  $DOMAIN_HOME/bin/startManagedWebLogic.sh Server_2 > /dev/null 2>&1  &

echo Done!


5、檢查域是否已正確註冊

在兩臺伺服器上,透過檢視以下檔案,檢查域是否已正確註冊到節點管理器服務:

grep $DOMAIN_HOME  $MW_HOME/domain-registry.xml

 u01/app/oracle/middleware/user_projects/domains/ClusterDomain"/>

grep $DOMAIN_HOME  $WLS_HOME/common/nodemanager/nodemanager.domains

clusterDomain=/u01/app/oracle/middleware/user_projects/domains/ClusterDomain

  最後,確保節點管理器服務已在兩臺計算機上啟動並執行,如果沒有,請啟動它們:

ps -ef|grep  NodeManager

nohup $WLS_HOME/server/bin/startNodeManager.sh >  /dev/null 2>&1 &


5  Weblogic啟停指令碼配置

1、Linux-web01 節點停止 domain 指令碼

mkdir  ~/scripts

 

vi ~/scripts/stop_ClusterDomain.sh

# Set environment variables

export  MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

export DOMAIN_NAME=ClusterDomain

export DOMAIN_HOME=$MW_HOME/user_projects/domains/$DOMAIN_NAME

echo Stopping WebLogic Managed  Servers...

echo Stopping WebLogic Managed Server :  Server_1

$DOMAIN_HOME/bin/stopManagedWebLogic.sh  Server_1

echo Stopping WebLogic Admin Server...

$DOMAIN_HOME/bin/stopWebLogic.sh

echo Stopping Node Manager...

nm_pid=`ps -ef | grep [N]odeManager |  awk '{print $2}'`

if [ "$nm_pid" = ""  ];

then echo Node Manager not running

else echo Killing Node Manager  processes: $nm_pid

kill -9 $nm_pid 2>&1 > /dev/null

fi

echo "Tidying up temp files..."

find $DOMAIN_HOME/servers -name  "*.lok" -exec rm -f {} ;

find $DOMAIN_HOME/servers -name  "*.DAT" -exec rm -f {} ;

echo Done!

 

2、   Linux-web02 節點停止 domain 指令碼

mkdir  ~/scripts

 

vi ~/scripts/stop_ClusterDomain.sh

# Set environment variables

export  MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

export DOMAIN_NAME=ClusterDomain

export DOMAIN_HOME=$MW_HOME/user_projects/domains/$DOMAIN_NAME

echo Stopping WebLogic Managed  Servers...

echo Stopping WebLogic Managed Server :  Server_2

$DOMAIN_HOME/bin/stopManagedWebLogic.sh  Server_2

echo Stopping WebLogic Admin Server...

$DOMAIN_HOME/bin/stopWebLogic.sh

echo Stopping Node Manager...

nm_pid=`ps -ef | grep [N]odeManager |  awk '{print $2}'`

if [ "$nm_pid" = ""  ];

then echo Node Manager not running

else echo Killing Node Manager  processes: $nm_pid

kill -9 $nm_pid 2>&1 > /dev/null

fi

echo "Tidying up temp files..."

find $DOMAIN_HOME/servers -name  "*.lok" -exec rm -f {} ;

find $DOMAIN_HOME/servers -name  "*.DAT" -exec rm -f {} ;

echo Done!

 

3、   Linux-web01 節點啟動 domain 服務

vi  ~/scripts/start_ClusterDomain.sh

 

# Set environment variables

export MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

export DOMAIN_NAME=ClusterDomain

export  DOMAIN_HOME=$MW_HOME/user_projects/domains/$DOMAIN_NAME

echo Starting Node Manager...

nohup  $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 &

sleep 10

echo Starting WebLogic Admin Server...

nohup $DOMAIN_HOME/bin/startWebLogic.sh  > /dev/null 2>&1 &

sleep 120

echo Starting WebLogic Managed  Servers...

echo Starting WebLogic Managed Server :  Server_1

nohup  $DOMAIN_HOME/bin/startManagedWebLogic.sh Server_1 > /dev/null 2>&1  &

echo Done!

 

4、   Linux-web02 節點啟動 domain 服務

vi  ~/scripts/start_ClusterDomain.sh

 

# Set environment variables

export MW_HOME=/u01/app/oracle/middleware

export WLS_HOME=$MW_HOME/wls_10.3.6

export DOMAIN_NAME=ClusterDomain

export  DOMAIN_HOME=$MW_HOME/user_projects/domains/$DOMAIN_NAME

echo Starting Node Manager...

nohup  $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 &

sleep 10

echo Starting WebLogic Admin Server...

nohup $DOMAIN_HOME/bin/startWebLogic.sh  > /dev/null 2>&1 &

sleep 120

echo Starting WebLogic Managed  Servers...

echo Starting WebLogic Managed Server :  Server_2

nohup  $DOMAIN_HOME/bin/startManagedWebLogic.sh Server_2 > /dev/null 2>&1  &

echo Done!

 

有需要的朋友可以關注我的公眾號,文章每日一更


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28833846/viewspace-2723540/,如需轉載,請註明出處,否則將追究法律責任。

相關文章