WebLogic集群架构
Weblogic角色
AdminServer:
172.16.65.130
NodeServer:
172.16.65.131、172.16.65.132
版本
weblogic 12.2.1.3.0
centos 7.3
通用安装步骤
-- 创建账号和目录 --
/usr/sbin/groupadd -g 666 wladmin
/usr/sbin/useradd -u 666 -g wladmin -G wladmin wladmin
/usr/bin/echo -e "P@ssw0rd\nP@ssw0rd" | (/usr/bin/passwd --stdin wladmin)
/usr/bin/mkdir -p /WebLogic/oracle/inventory
/usr/bin/chown -R wladmin:wladmin /WebLogic
/usr/bin/chmod -R 775 /WebLogic
/usr/bin/su - wladmin -c "/usr/bin/mkdir -p /WebLogic/oracle/middleware"
-- 创建oraInst.loc配置文件 --
/usr/bin/touch /etc/oraInst.loc
/usr/bin/echo "inventory_loc=/WebLogic/oracle/inventory" > /etc/oraInst.loc
/usr/bin/echo "inst_group=wladmin" >> /etc/oraInst.loc
/usr/bin/chown wladmin:wladmin /etc/oraInst.loc
/usr/bin/chmod 775 /etc/oraInst.loc
-- 创建Install.rsp配置文件 --
/usr/bin/cat > /WebLogic/oracle/Install.rsp << EOF
[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/WebLogic/oracle/middleware
#Set this variable value to the Installation Type selected. e.g. Fusion Middleware Infrastructure, Fusion Middleware Infrastructure With Examples.
INSTALL_TYPE=WebLogic Server
#Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name.
MYORACLESUPPORT_USERNAME=
#Provide the My Oracle Support Password
MYORACLESUPPORT_PASSWORD=<SECURE VALUE>
#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
DECLINE_SECURITY_UPDATES=true
#Set this to true if My Oracle Support Password is specified
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
#Provide the Proxy Host
PROXY_HOST=
#Provide the Proxy Port
PROXY_PORT=
#Provide the Proxy Username
PROXY_USER=
#Provide the Proxy Password
PROXY_PWD=<SECURE VALUE>
#Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port]
COLLECTOR_SUPPORTHUB_URL=
EOF
/usr/bin/chown wladmin:wladmin /WebLogic/oracle/Install.rsp
-- 开始安装 --
export WL_HOME=/WebLogic/oracle/middleware/wlserver
/usr/bin/cp /root/fmw_12.2.1.3.0_wls.jar /home/wladmin/
/usr/bin/chown wladmin:wladmin /home/wladmin/fmw_12.2.1.3.0_wls.jar
/usr/bin/su - wladmin -c "java -jar /home/wladmin/fmw_12.2.1.3.0_wls.jar -silent -invPtrLoc /etc/oraInst.loc -responseFile /WebLogic/oracle/Install.rsp"
/usr/bin/ls -ltr /WebLogic/oracle/middleware
-- 关闭防火墙 --
service firewalld stop
systemctl disable firewalld
AdminServer配置部分
-- 创建Adminserver --
/usr/bin/su - wladmin -c "/WebLogic/oracle/middleware/oracle_common/common/bin/wlst.sh" << EOF
readTemplate('/WebLogic/oracle/middleware/wlserver/common/templates/wls/wls.jar')
cd('Servers/AdminServer')
cmo.setListenAddress("172.16.65.130")
set('ListenPort', 7001)
cd('/')
cd('Security/base_domain/User/weblogic')
cmo.setPassword('weblogic123')
setOption('ServerStartMode','prod')
setOption('OverwriteDomain', 'true')
writeDomain('/WebLogic/oracle/middleware/user_projects/domains/base_domain')
closeTemplate()
exit()
EOF
-- 创建Node节点:MS-01 MS-02 --
/usr/bin/touch /tmp/answers.txt
/usr/bin/cat >> /tmp/answers.txt << EOF
readDomain('/WebLogic/oracle/middleware/user_projects/domains/base_domain')
cd('/')
create('MS-01', 'Server')
cd('Servers')
cd('MS-01')
set('ListenPort', 7004)
set('ListenAddress', '172.16.65.131')
cd('/')
create('MS-02', 'Server')
cd('Servers')
cd('MS-02')
set('ListenPort', 7004)
set('ListenAddress', '172.16.65.132')
cd('/')
create('basecluster', 'Cluster')
assign('Server', 'MS-01','Cluster','basecluster')
assign('Server', 'MS-02','Cluster','basecluster')
cd('Cluster/basecluster')
set('ClusterMessagingMode', 'unicast')
set('WeblogicPluginEnabled', 'true')
cd('/')
create('Machine01', 'Machine')
assign('Server', 'MS-01','Machine','Machine01')
cd('Machines/' + 'Machine01/')
create('Machine01', 'NodeManager')
cd('NodeManager/' + 'Machine01')
set('NMType', 'Plain')
set('ListenAddress', '172.16.65.130')
set('DebugEnabled', 'false')
cd('/')
create('Machine02', 'Machine')
assign('Server', 'MS-02','Machine','Machine02')
cd('Machines/' + 'Machine02/')
create('Machine02', 'NodeManager')
cd('NodeManager/' + 'Machine02')
set('NMType', 'Plain')
set('ListenAddress', '172.16.65.131')
set('DebugEnabled', 'false')
updateDomain()
closeDomain()
disconnect()
exit()
EOF
/usr/bin/su - wladmin -c "/WebLogic/oracle/middleware/oracle_common/common/bin/wlst.sh < /tmp/answers.txt"
-- 安全配置 --
export DOMAIN_HOME=/WebLogic/oracle/middleware/user_projects/domains/base_domain
export WL_HOME=/WebLogic/oracle/middleware/wlserver
/usr/bin/su - wladmin -c "/usr/bin/sed -i -e 's/SecureListener=true/SecureListener=false/g' /WebLogic/oracle/middleware/user_projects/domains/base_domain/nodemanager/nodemanager.properties"
/usr/bin/su - wladmin -c "/usr/bin/mkdir -p /WebLogic/oracle/middleware/user_projects/domains/base_domain/servers/AdminServer/security"
/usr/bin/su - wladmin -c "/usr/bin/cat > /WebLogic/oracle/middleware/user_projects/domains/base_domain/servers/AdminServer/security/boot.properties" << EOF
username=weblogic
password=weblogic123
EOF
-- pack node配置 --
/usr/bin/su - wladmin -c "/WebLogic/oracle/middleware/oracle_common/common/bin/pack.sh -managed=true -domain=/WebLogic/oracle/middleware/user_projects/domains/base_domain -template=/WebLogic/oracle/middleware/user_projects/domains/base_domain-wlsTemplate.jar -template_name=base_domain"
-- 将配置复制到node节点 --
/usr/bin/su - wladmin -c "sshpass -p 'P@ssw0rd' scp -o StrictHostKeyChecking=no /WebLogic/oracle/middleware/user_projects/domains/base_domain-wlsTemplate.jar wladmin@172.16.65.131:/WebLogic/"
------ Start Server ------
/usr/bin/su - wladmin -c "nohup /WebLogic/oracle/middleware/user_projects/domains/base_domain/bin/startNodeManager.sh &"
/usr/bin/su - wladmin -c "nohup /WebLogic/oracle/middleware/user_projects/domains/base_domain/bin/startWebLogic.sh &"
----- Node Server配置部分 -----
/usr/bin/su - wladmin -c "/usr/bin/mkdir -p /WebLogic/oracle/middleware/user_projects/domains/base_domain"
/usr/bin/su - wladmin -c "/WebLogic/oracle/middleware/oracle_common/common/bin/unpack.sh -domain=/WebLogic/oracle/middleware/user_projects/domains/base_domain -template=/WebLogic/base_domain-wlsTemplate.jar"
/usr/bin/su - wladmin -c "nohup /WebLogic/oracle/middleware/user_projects/domains/base_domain/bin/startNodeManager.sh &"
效果验证
登录WebLogic
手动将两个Node启动
集群启动成功
![](https://i-blog.csdnimg.cn/blog_migrate/81c4d4b27410fcc525eb2491dcfaa9af.png)
参考链接:
https://www.sajaldebnath.com/oracle-weblogic-service-vrealize-automation/