本文重点:
- 配置Managed Servers(受管服务器)
- 启动Managed Servers
- 原理
- 运行多个Managed Servers实例
一、配置Managed Servers
-
配置Managed Server可以通过以下方式:
- Domains配置助手(本文略)
- Web控制台
- WLST配置脚本(后续脚本管理时会创建)
-
通过web控制台配置Managed Servers
-
登录web控制台:
-
创建服务器:
由于默认Admin Server占用了7001,所以需要使用其他端口
-
创建成功
-
-
通过WLST脚本配置Managed Server
暂略,后续更新超链接。
二、启动Managed Server
-
启动Server-0(Managed Server)
该例子是和AdminServer在同一台服务器上启动,所以省事,如果在其他服务器启动,是需要将weblogic安装介质(/opt/weblogic)和weblogic Domains文件给复制过去的。(/opt/wldomains/base_domains)
[root@wls1 ~]# /opt/wldomains/base_domains/bin/startManagedWebLogic.sh Server-0 http://127.0.0.1:7001 . . JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=256m . WLS Start Mode=Development . CLASSPATH=/opt/weblogic/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/weblogic/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/java/lib/tools.jar:/opt/weblogic/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/weblogic/wlserver_10.3/server/lib/weblogic.jar:/opt/weblogic/modules/features/weblogic.server.modules_10.3.6.0.jar:/opt/weblogic/wlserver_10.3/server/lib/webservices.jar:/opt/weblogic/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/opt/weblogic/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/opt/weblogic/wlserver_10.3/common/derby/lib/derbyclient.jar:/opt/weblogic/wlserver_10.3/server/lib/xqrl.jar . PATH=/opt/weblogic/wlserver_10.3/server/bin:/opt/weblogic/modules/org.apache.ant_1.7.1/bin:/opt/java/jre/bin:/opt/java/bin:/opt/pyenv/plugins/pyenv-virtualenv/shims:/opt/pyenv/shims:/opt/pyenv/bin:/opt/java:/bin:/opt/java/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin . *************************************************** * To start WebLogic Server, use a username and * * password assigned to an admin-level user. For * * server administration, use the WebLogic Server * * console at http://hostname:port/console * *************************************************** starting weblogic with Java version: java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) Starting WLS with line: /opt/java/bin/java -client -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=256m -Dweblogic.Name=Server-0 -Djava.security.policy=/opt/weblogic/wlserver_10.3/server/lib/weblogic.policy -Dweblogic.security.SSL.trustedCAKeyStore=/opt/weblogic/wlserver_10.3/server/lib/cacerts -Xverify:none -da -Dplatform.home=/opt/weblogic/wlserver_10.3 -Dwls.home=/opt/weblogic/wlserver_10.3/server -Dweblogic.home=/opt/weblogic/wlserver_10.3/server -Dweblogic.management.discover=false -Dweblogic.management.server=http://127.0.0.1:7001 -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=/opt/weblogic/patch_wls1036/profiles/default/sysext_manifest_classpath:/opt/weblogic/patch_ocp371/profiles/default/sysext_manifest_classpath weblogic.Server Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 <Jan 18, 2018 11:02:59 PM CST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true> <Jan 18, 2018 11:03:00 PM CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true> <Jan 18, 2018 11:03:01 PM CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.144-b01 from Oracle Corporation> <Jan 18, 2018 11:03:01 PM CST> <Info> <Security> <BEA-090065> <Getting boot identity from user.> Enter username to boot WebLogic server:weblogic Enter password to boot WebLogic server: <Jan 18, 2018 11:03:09 PM CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.6.0 Tue Nov 15 08:52:36 PST 2011 1441050 > <Jan 18, 2018 11:03:11 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> <Jan 18, 2018 11:03:11 PM CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool> <Jan 18, 2018 11:03:11 PM CST> <Notice> <Log Management> <BEA-170019> <The server log file /opt/wldomains/base_domains/servers/Server-0/logs/Server-0.log is opened. All server side log events will be written to this file.> <Jan 18, 2018 11:03:15 PM CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> <Jan 18, 2018 11:03:18 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY> <Jan 18, 2018 11:03:18 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> <Jan 18, 2018 11:03:19 PM CST> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.> <Jan 18, 2018 11:03:19 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN> <Jan 18, 2018 11:03:19 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING> <Jan 18, 2018 11:03:19 PM CST> <Warning> <Server> <BEA-002611> <Hostname "localhost", maps to multiple IP addresses: 127.0.0.1, 0:0:0:0:0:0:0:1> <Jan 18, 2018 11:03:19 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 127.0.0.1:10001 for protocols iiop, t3, ldap, snmp, http.> <Jan 18, 2018 11:03:19 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on fe80:0:0:0:16a8:b4c:e936:926e:10001 for protocols iiop, t3, ldap, snmp, http.> <Jan 18, 2018 11:03:19 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1:10001 for protocols iiop, t3, ldap, snmp, http.> <Jan 18, 2018 11:03:19 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.188.61:10001 for protocols iiop, t3, ldap, snmp, http.> <Jan 18, 2018 11:03:19 PM CST> <Notice> <WebLogicServer> <BEA-000332> <Started WebLogic Managed Server "Server-0" for domain "base_domains" running in Development Mode> <Jan 18, 2018 11:03:19 PM CST> <Warning> <Server> <BEA-002611> <Hostname "wls1", maps to multiple IP addresses: 192.168.188.61, fe80:0:0:0:16a8:b4c:e936:926e%2> <Jan 18, 2018 11:03:20 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING> <Jan 18, 2018 11:03:20 PM CST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode> |
- 启动成功
- 创建一个Server-0修改了哪些东西?
[root@wls1 ~]# cat /opt/wldomains/base_domains/config/config.xml <server> <name>AdminServer</name> <listen-address></listen-address> </server> <server> <name>Server-0</name> <listen-port>10001</listen-port> <web-server> <web-server-log> <number-of-files-limited>false</number-of-files-limited> </web-server-log> </web-server> <listen-address></listen-address> </server> |
- 启动一个Server-0生成了哪些东西?
[root@wls1 ~]# ls -lha /opt/wldomains/base_domains/servers/Server-0/ total 0 drwxr----- 6 root root 54 Jan 18 23:03 . drwxr-x--- 7 root root 91 Jan 18 23:03 .. drwxr----- 3 root root 25 Jan 18 23:03 cache drwxr----- 4 root root 31 Jan 18 23:03 data drwxr----- 3 root root 69 Jan 18 23:03 logs drwxr----- 4 root root 70 Jan 18 23:04 tmp |
- 连接Admin Server的时候避免输入密码:
[root@wls1 ~]# mkdir -pv /opt/wldomains/base_domains/servers/Server-0/security mkdir: created directory '/opt/wldomains/base_domains/servers/Server-0/security' [root@wls1 ~]# cat /opt/wldomains/base_domains/servers/Server-0/security/boot.properties username=weblogic password=!QAZ2wsx 第一次连接后会对该文件帐号密码进行加密,如下所示: [root@wls1 cache]# cat /opt/wldomains/base_domains/servers/Server-0/security/boot.properties # Generated by Configuration Wizard on Wed Jan 17 00:09:48 CST 2018 username={AES}RuO/rk2VNACuBptfRDFbv3vmvIizQwtDkyL8L/fAk2c= password={AES}ydw0YE8MGB2T/bP2fqlCcmVB+XOXj93T1F+lxtYmZfQ= |
-
关闭Managed Server
- 方式 1:直接Curt + C终止或kill干掉进程
-
方式 2:Web控制台关闭
三、原理
-
Managed Server启动数据流
步骤1:先在Admin Server(192.168.1.1)新建ServerA和ServerB,并将ServerA和ServerB加入到集群中,同时会将更改写进config/config.xml配置文件中,会将日志写进log文件中。
步骤2:服务器A(192.168.1.2)或服务器B(192.168.1.3)启动Server的时候,先进行认证(Admin Server的帐号密码),然后自动下载Admin Server的配置,加载到内存中后按照配置启动运行。
注意1:上图中ServerA、ServerB和Proxy可以在任意服务器上启动并运行,但只能同一时间运行在同一服务器上。具体请看另一篇《03-01_WebLogic一些概念名词》的Server章节。
注意2:所有的更改都是在Admin Server上更改的。
-
手工启动Managed Server,必须要有:
- 必须指定Server名字,这个server名字必须在Admin Server配置OK,例如上述示例中的Server-0。
-
必须指定Admin Server(管理服务器)的URL,例如上述示例中的http://127.0.0.1:7001。
-
启动标识文件(密码文件)
- 作用:不用重复输入密码,开发模式下Admin Server会自动创建自己的密码文件,而生产模式则不会,受管服务器都要手工创建密码文件。
- 文件路径:$DOMAINS/servers/SERVER_NAME/security,例如上述示例的/opt/wldomains/base_domains/servers/Server-0/security/boot.properties
-
示例:
- 注意1:如果帐号密码有问题,相当于该文件无效,依然会提示输入。
- 注意2:该文件复制到其他的Server无效,ServerA只能适用ServerA,ServerB只能适用ServerB
- Managed Server(受管服务器根路径)
$DOMAINS/servers/SERVER_NAME/ 比如上述示例:/opt/wldomains/base_domains/servers/Server-0/ |
- 更改boot.properties默认路径
可以在java参数添加一行:-Dweblogic.system.BootldentityFile=filename |
- 不使用boot.properties,要么手工输入帐号密码,要么参数输入帐号密码,参数如下
-Dweblogic.management.username=username -Dweblogic.management.password=password |
四、运行多个Managed Server实例
- 先通过web控制台新建一个服务器Server-1,端口设置为10002
- 使用/opt/wldomains/base_domains/bin/startManagedWebLogic.sh Server-1 http://127.0.0.1:7001
- 输入帐号密码,就启动成功了。
- 运行2个与运行多个什么区别。