简体   繁体   English

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

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

As i'm working with Chef for automation, i'm required to create a cookbook for weblogic. 当我与Chef合作进行自动化时,需要为Weblogic创建一个菜谱。 The thing is that, when the cookbook is executed it hangs at the final step, and that's totally normal since that step runs weblogic.Server Java Class to create a new domain and then it runs the server. 事实是,执行该菜谱时,它会挂在最后一步,这是完全正常的,因为该步骤运行weblogic.Server Java类以创建新域,然后运行服务器。 So, i want to run weblogic.Server to only create the domain and keep going with the last steps. 因此,我想运行weblogic.Server仅创建域并继续进行最后的步骤。 Is there a way to do that? 有没有办法做到这一点?

I have tried with the argument weblogic.management.startupMode = SHUTDOWN but it doesn't work. 我已经尝试使用参数weblogic.management.startupMode = SHUTDOWN但它不起作用。 I know the argument where considered, since when do a tail -n 1000 | grep SHUTDOWN 我知道要考虑的参数,因为什么时候做tail -n 1000 | grep SHUTDOWN tail -n 1000 | grep SHUTDOWN in the log file, i see: 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

I'm using this to create the domain: 我正在使用它来创建域:

$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

If i do the steps to run weblogic and i try to create a new domain (with the previous command) at the end of the output it's seen: 如果我执行运行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>

Which makes me think the startupMode=SHUTDOWN is ignored since it says at the end <Server started in RUNNING mode> 这使我认为startupMode = SHUTDOWN被忽略了,因为它说到最后<Server started in RUNNING mode>

Is there a way to create a domain but don't start it, or to tell chef, to keep going after i don't know, 15 minutes wating? 有一种方法可以创建一个域,但不要启动它,或者告诉厨师,在我不知道15分钟的等待后继续前进吗?

If you simply don't want to start it, one solution is to create a domain "template" with the weblogic config GUI, eg /opt/ora/mw/wlserver_10.3/common/bin/config.sh. 如果您只是不想启动它,一种解决方案是使用weblogic的配置GUI创建域“模板”,例如/opt/ora/mw/wlserver_10.3/common/bin/config.sh。 Once you have a template jar file, you can call the following from Chef: 有了模板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`

This will create the domain but not start the server. 这将创建域,但不会启动服务器。

A quick/easy solution to the problem of the server coming up would be to background the call to create the domain and send it to a log file. 解决服务器问题的一种快速/简便的解决方案是在后台调用以创建域并将其发送到日志文件。 Then to monitor the log for the RUNNING state to exit successfully via a bach script like: 然后监视监视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

Where waitForRunning.sh will loop for X amount of time grepping your log file for the RUNNING state and then exit when it was reached or exit 1 if the time limit is reached. 其中, waitForRunning.sh将循环X倍的时间,将您的日志文件waitForRunning.sh为RUNNING状态,然后在达到该状态时exit 1如果达到时间限制,则exit 1

Edit 编辑


2>&1 & is basically redirect standard error to stdout and both of them to a file so the process is completely backgrounded, this will cause Chef to move on to the next step. 2>&1 &基本上将标准错误重定向到stdout并将它们都重定向到文件,因此该过程已完全后台运行,这将导致Chef继续进行下一步。 The next step, creating a script to monitor the log, you want to do a while loop and then explicitly exit out of the loop when a condition has been met, then Chef will know that step is done and move on as well. 下一步,创建一个脚本来监视日志,您需要执行while循环,然后在满足条件时显式退出循环,然后Chef将知道该步骤已完成并继续进行。

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

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