繁体   English   中英

weblogic.Server创建域但不启动域(厨师手册)

[英]weblogic.Server to create domain but don't start it (Chef cookbook)

当我与Chef合作进行自动化时,需要为Weblogic创建一个菜谱。 事实是,执行该菜谱时,它会挂在最后一步,这是完全正常的,因为该步骤运行weblogic.Server Java类以创建新域,然后运行服务器。 因此,我想运行weblogic.Server仅创建域并继续进行最后的步骤。 有没有办法做到这一点?

我已经尝试使用参数weblogic.management.startupMode = SHUTDOWN但它不起作用。 我知道要考虑的参数,因为什么时候做tail -n 1000 | grep SHUTDOWN tail -n 1000 | grep SHUTDOWN在日志文件中,我看到:

ip-addres-root:~ # tail -n 1000 -f /opt/middleware/weblogic/mydomain/servers/myserver/logs/myserver.log | grep SHUTDOW
weblogic.management.startupMode = SHUTDOWN

我正在使用它来创建域:

$JAVA_HOME/bin/java $JAVA_OPTIONS -Xmx1024m -Dweblogic.management.username=myuser \ 
-Dweblogic.management.password=mypassword1 \
-Dweblogic.management.GenerateDefaultConfig=true \
-Dweblogic.management.startupMode=SHUTDOWN weblogic.Server

如果我执行运行weblogic的步骤,并且尝试在输出末尾创建一个新域(使用先前的命令),则会看到:

<06-jul-2014 04H35' UTC> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> 
<06-jul-2014 04H35' UTC> <Warning> <Store> <BEA-280101> <The persistent file store "_WLS_myserver" is forced to use buffered I/O and so may have significantly degraded performance. Either the OS/hardware environment does not support the chosen write policy or the native wlfileio library is missing. See store open log messages for the requested and final write policies. See the documentation on store synchronous write policy configuration for advice.> 
<06-jul-2014 04H35' UTC> <Warning> <HTTP> <BEA-101296> <Unable to load the default compiler class "com.sun.tools.javac.Main". Using the default javac compiler to compile JSPs.> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> 
<06-jul-2014 04H35' UTC> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.> 
<06-jul-2014 04H35' UTC> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 127.0.0.2:7001 for protocols iiop, t3, ldap, snmp, http.> 
<06-jul-2014 04H35' UTC> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 10.101.1.63:7001 for protocols iiop, t3, ldap, snmp, http.> 
<06-jul-2014 04H35' UTC> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "myserver" for domain "mydomain" running in Development Mode> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING> 
<06-jul-2014 04H35' UTC> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

这使我认为startupMode = SHUTDOWN被忽略了,因为它说到最后<Server started in RUNNING mode>

有一种方法可以创建一个域,但不要启动它,或者告诉厨师,在我不知道15分钟的等待后继续前进吗?

如果您只是不想启动它,一种解决方案是使用weblogic的配置GUI创建域“模板”,例如/opt/ora/mw/wlserver_10.3/common/bin/config.sh。 有了模板jar文件后,您可以从Chef调用以下命令:

`/opt/ora/mw/wlserver_10.3/common/bin/unpack.sh -template=<path to your template.jar>
-domain=<path to where you want to install the domain`

这将创建域,但不会启动服务器。

解决服务器问题的一种快速/简便的解决方案是在后台调用以创建域并将其发送到日志文件。 然后监视监视RUNNING状态的日志,以通过类似bach脚本成功退出:

execute "start weblogic in #{weblogic_home}/WLSDomains/#{node[:som][:domain_name]}" do
  command "$JAVA_HOME/bin/java $JAVA_OPTIONS ... weblogic.Server > /tmp/start-weblogic.log 2>&1 &"
  action :run
end

execute "waitForRunning -- #{weblogic_bin}/waitForRunning.sh" do
    Chef::Log.debug("Waiting for WebLogic server to start")
    command "waitForRunning.sh"
    cwd "#{weblogic_bin}"
    action :run
end

其中, waitForRunning.sh将循环X倍的时间,将您的日志文件waitForRunning.sh为RUNNING状态,然后在达到该状态时exit 1如果达到时间限制,则exit 1

编辑


2>&1 &基本上将标准错误重定向到stdout并将它们都重定向到文件,因此该过程已完全后台运行,这将导致Chef继续进行下一步。 下一步,创建一个脚本来监视日志,您需要执行while循环,然后在满足条件时显式退出循环,然后Chef将知道该步骤已完成并继续进行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM