안녕하세요.
'수상한 김토끼' 입니다.
Oracle의 WebLogic Image Tool을 활용하여 WebLogic Docker Image를 만들고 운영환경 구성하기입니다.
이 블로그 글은 미들웨어 경험이 없으신 분들도 쉽게 따라 하실 수 있도록 쉽게 작성하는 것이 목표입니다.
설명을 보고 진행하시다가 궁금하신 내용은 댓글로 문의하시면 가능한 범위 내에서 알려 드리도록 하겠습니다.
1. WebLogic Docker Container 실행
앞장에서 WebLogic Image Tool을 활용해 WebLogic의 docker image를 생성하였습니다.
이번에는 생성된 docker image를 사용하여 운영환경을 구성해 보도록 하겠습니다.
우선 사용하고자 하는 docker image를 확인합니다.
1
2
3
4
5
6
|
[root@middleware-works-centos8 wls14c]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
wls 14.1.1.0.0-slim b107ac6eb4eb 6 days ago 1.02GB
wls 14.1.1.0.0 033e6f70ff0f 6 days ago 1.39GB
wls 12.2.1.3.0 d4374a78436c 6 days ago 1.36GB
ghcr.io/oracle/oraclelinux 8-slim c7c0b3ae3077 4 weeks ago 101MB
|
cs |
WebLogic 14c(14.1.1.0.0) slim 기본 이미지(Image Id: b107ac6eb4eb)로 컨테이너 구동 후 managed로 사용하겠습니다.
Docker 명령을 자세히 다루지는 않겠습니다만, 관련 내용을 그대로 따라 하시면 구성이 가능합니다.
Docker 환경에서 사용되는 옵션은 다음과 같습니다.
1. domain_home: WebLogic domain home directory로 사용될 경로
2. properties: domain.properties 파일
3. 9002 port: managed server port
우선 managed server로 사용할 컨테이너를 기동 합니다.
다음 옵션으로 실행해 줍니다.
docker container run --name wls_slim -d -p 9002:9002 -it -v $PWD/properties:/u01/oracle/properties -v $PWD/domains:/u01/oracle/domains b107ac6eb4eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
[root@middleware-works-centos8 wls14c]# pwd
/home/opc/docker_datas/wls14c
[root@middleware-works-centos8 wls14c]# ls
docker_run_container.sh domains properties wls_admin.sh wls_managed.sh
[root@middleware-works-centos8 wls14c]# cat wls_managed.sh
#!/bin/bash
# 14c normal
#docker container run --name wls_admin -d -p 7001:7001 -it -v $PWD/properties:/u01/oracle/properties -v $PWD/domains:/u01/oracle/domains 033e6f70ff0f
# 14c slim
docker container run --name wls_slim -d -p 9002:9002 -it -v $PWD/properties:/u01/oracle/properties -v $PWD/domains:/u01/oracle/domains b107ac6eb4eb
#docker container run --name wls_admin -d -p 7001:7001 -p 9002:9002 -it -v $PWD:/u01/oracle/properties -e ADMINISTRATION_PORT_ENABLED=true -e DOMAIN_NAME=docker_domain -e ADMIN_NAME=docker-AdminServer 033e6f70ff0f
[root@middleware-works-centos8 wls14c]# ./wls_managed.sh
99d80dfef4329bc382827598a9ae1a9e11e020b3f4f5d3fbaff6db6428560213
[root@middleware-works-centos8 wls14c]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99d80dfef432 b107ac6eb4eb "/bin/bash" 4 seconds ago Up 3 seconds 0.0.0.0:9002->9002/tcp wls_slim
e4fdcdde81ee 033e6f70ff0f "/bin/bash" About an hour ago Up About an hour 0.0.0.0:7001->7001/tcp wls_admin
|
cs |
docker ps 명령으로 정상적으로 컨테이너가 실행된 것이 확인됩니다.
2. WebLogic Managed 구성
실행된 컨테이너로 접속하여 WebLogic managed를 구성해 보겠습니다.
사실 여기서부터는 On-Prem환경과 다른 부분이 없습니다만 docker container로도 정상적으로 동작하는 것을 확인하기 위해 진행하도록 하겠습니다.
다음 명령으로 container에 접속 후 StartNodeMonager.sh 파일을 실행합니다.
docker exec -it wls_slim /bin/bash
컨테이너 접속 후
/u01/oracle/domains/docker_domain/bin/StartNodeManager.sh 파일 실행
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
[root@middleware-works-centos8 wls14c]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99d80dfef432 b107ac6eb4eb "/bin/bash" 2 minutes ago Up 2 minutes 0.0.0.0:9002->9002/tcp wls_slim
e4fdcdde81ee 033e6f70ff0f "/bin/bash" About an hour ago Up About an hour 0.0.0.0:7001->7001/tcp wls_admin
[root@middleware-works-centos8 wls14c]# docker exec -it wls_slim /bin/bash
[oracle@99d80dfef432 oracle]$ ls
OPatch cfgtoollogs coherence domains inventory oraInst.loc oraInventory oracle_common oui properties root.sh wlserver
[oracle@99d80dfef432 oracle]$ cd domains
[oracle@99d80dfef432 domains]$ ls
docker_domain
[oracle@99d80dfef432 domains]$ cd docker_domain
[oracle@99d80dfef432 docker_domain]$ ls
autodeploy common console-ext edit.lok init-info nodemanager original security startWebLogic.sh
bin config derby.log fileRealm.properties lib orchestration resources servers
[oracle@99d80dfef432 docker_domain]$ cd bin
[oracle@99d80dfef432 bin]$ ls
generateArchive.sh restartComponent.sh setDomainEnv.sh startComponent.sh startRSDaemon.sh stopManagedWebLogic.sh stopWebLogic.sh
nodemanager server_migration setNMJavaHome.sh startManagedWebLogic.sh startWebLogic.sh stopNodeManager.sh
patching service_migration setStartupEnv.sh startNodeManager.sh stopComponent.sh stopRSDaemon.sh
[oracle@99d80dfef432 bin]$ ./startNodeManager.sh &
[1] 33
[oracle@99d80dfef432 bin]$ NODEMGR_HOME is already set to /u01/oracle/domains/docker_domain/nodemanager
CLASSPATH=/u01/jdk/lib/tools.jar:/u01/oracle/wlserver/server/lib/weblogic.jar:/u01/oracle/wlserver/../oracle_common/modules/thirdparty/ant-contrib-1.0b3.jar:/u01/oracle/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/u01/oracle/wlserver/..:/u01/oracle/wlserver/modules/features/oracle.wls.common.grizzly.jar
+ /u01/jdk/bin/java -server -Xms32m -Xmx200m -Djdk.tls.ephemeralDHKeySize=2048 -Dcoherence.home=/u01/oracle/wlserver/../coherence -Dbea.home=/u01/oracle/wlserver/.. -Dweblogic.RootDirectory=/u01/oracle/domains/docker_domain -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy -Dweblogic.nodemanager.JavaHome=/u01/jdk weblogic.NodeManager -v
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Loading domains file: /u01/oracle/domains/docker_domain/nodemanager/nodemanager.domains>
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Upgrade> <Setting NodeManager properties version to 14.1.1.0.0>
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Upgrade> <Saving upgraded NodeManager properties to '/u01/oracle/domains/docker_domain/nodemanager/nodemanager.properties'>
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Loading domains file: /u01/oracle/domains/docker_domain/nodemanager/nodemanager.domains>
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Loading identity key store: FileName=/u01/oracle/domains/docker_domain/security/DemoIdentity.jks, Type=jks, PassPhraseUsed=true>
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Loaded NodeManager configuration properties from '/u01/oracle/domains/docker_domain/nodemanager/nodemanager.properties'>
Node manager v14.1.1.0.0
Configuration settings:
DomainsFile=/u01/oracle/domains/docker_domain/nodemanager/nodemanager.domains
LogLimit=0
DomainsDirRemoteSharingEnabled=false
AuthenticationEnabled=true
LogLevel=INFO
DomainsFileEnabled=true
ListenAddress=wls_slim
NativeVersionEnabled=true
ProcessDestroyTimeout=20000
ListenPort=5556
LogToStderr=true
weblogic.StartScriptName=startWebLogic.sh
SecureListener=true
LogCount=1
LogAppend=true
weblogic.StopScriptEnabled=false
StateCheckInterval=500
CrashRecoveryEnabled=false
weblogic.StartScriptEnabled=true
LogFile=/u01/oracle/domains/docker_domain/nodemanager/nodemanager.log
LogFormatter=weblogic.nodemanager.server.LogFormatter
coherence.StartScriptEnabled=false
ListenBacklog=50
NodeManagerHome=/u01/oracle/domains/docker_domain/nodemanager
RestEnabled=false
isLogLockingEnabled=true
weblogic.startup.JavaHome=/u01/jdk
weblogic.startup.MW_Home=
coherence.startup.JavaHome=/u01/jdk
coherence.startup.MW_Home=
Domain name mappings:
docker_domain -> /u01/oracle/domains/docker_domain
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <14.1.1.0.0>
<Aug 8, 2022 6:29:15 AM UTC> <INFO> <Server Implementation Class: weblogic.nodemanager.server.NMServer$ClassicServer.>
<Aug 8, 2022 6:29:16 AM UTC> <INFO> <Secure socket listener started on port 5556, host localhost/127.0.0.1>
|
cs |
%DOMAIN_HOME/nodemanager/nodemanager.properties 파일을 수정해 줍니다.
SSL 인증서가 없으니 17번째 라인 'SecureListener' 항목을 'false'로 변경 후 저장합니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
[oracle@99d80dfef432 nodemanager]$ pwd
/u01/oracle/domains/docker_domain/nodemanager
[oracle@99d80dfef432 nodemanager]$ ls
nodemanager.domains nodemanager.log nodemanager.log.lck nodemanager.process.id nodemanager.process.lck nodemanager.properties
[oracle@99d80dfef432 nodemanager]$ cat nodemanager.properties
#Mon Aug 08 06:29:15 UTC 2022
#Node manager properties
#Mon Aug 08 05:30:34 UTC 2022
DomainsFile=/u01/oracle/domains/docker_domain/nodemanager/nodemanager.domains
LogLimit=0
PropertiesVersion=14.1.1.0.0
AuthenticationEnabled=true
NodeManagerHome=/u01/oracle/domains/docker_domain/nodemanager
JavaHome=/u01/jdk
LogLevel=INFO
DomainsFileEnabled=true
ListenAddress=wls_slim
NativeVersionEnabled=true
ListenPort=5556
LogToStderr=true
weblogic.StartScriptName=startWebLogic.sh
SecureListener=flase
LogCount=1
QuitEnabled=false
LogAppend=true
weblogic.StopScriptEnabled=false
StateCheckInterval=500
CrashRecoveryEnabled=false
weblogic.StartScriptEnabled=true
LogFile=/u01/oracle/domains/docker_domain/nodemanager/nodemanager.log
LogFormatter=weblogic.nodemanager.server.LogFormatter
ListenBacklog=50
|
cs |
NodeManager 설정이 완료되었으니 NodeManager를 다시 기동 해 줍니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
[oracle@99d80dfef432 bin]$ pwd
/u01/oracle/domains/docker_domain/bin
[oracle@99d80dfef432 bin]$ ./startNodeManager.sh
NODEMGR_HOME is already set to /u01/oracle/domains/docker_domain/nodemanager
CLASSPATH=/u01/jdk/lib/tools.jar:/u01/oracle/wlserver/server/lib/weblogic.jar:/u01/oracle/wlserver/../oracle_common/modules/thirdparty/ant-contrib-1.0b3.jar:/u01/oracle/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/u01/oracle/wlserver/..:/u01/oracle/wlserver/modules/features/oracle.wls.common.grizzly.jar
+ /u01/jdk/bin/java -server -Xms32m -Xmx200m -Djdk.tls.ephemeralDHKeySize=2048 -Dcoherence.home=/u01/oracle/wlserver/../coherence -Dbea.home=/u01/oracle/wlserver/.. -Dweblogic.RootDirectory=/u01/oracle/domains/docker_domain -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy -Dweblogic.nodemanager.JavaHome=/u01/jdk weblogic.NodeManager -v
<Aug 8, 2022 6:51:33 AM UTC> <INFO> <Loading domains file: /u01/oracle/domains/docker_domain/nodemanager/nodemanager.domains>
<Aug 8, 2022 6:51:34 AM UTC> <INFO> <Loaded NodeManager configuration properties from '/u01/oracle/domains/docker_domain/nodemanager/nodemanager.properties'>
Node manager v14.1.1.0.0
Configuration settings:
DomainsFile=/u01/oracle/domains/docker_domain/nodemanager/nodemanager.domains
LogLimit=0
DomainsDirRemoteSharingEnabled=false
AuthenticationEnabled=true
LogLevel=INFO
DomainsFileEnabled=true
ListenAddress=wls_slim
NativeVersionEnabled=true
ProcessDestroyTimeout=20000
ListenPort=5556
LogToStderr=true
weblogic.StartScriptName=startWebLogic.sh
SecureListener=false
LogCount=1
LogAppend=true
weblogic.StopScriptEnabled=false
StateCheckInterval=500
CrashRecoveryEnabled=false
weblogic.StartScriptEnabled=true
LogFile=/u01/oracle/domains/docker_domain/nodemanager/nodemanager.log
LogFormatter=weblogic.nodemanager.server.LogFormatter
coherence.StartScriptEnabled=false
ListenBacklog=50
NodeManagerHome=/u01/oracle/domains/docker_domain/nodemanager
RestEnabled=false
isLogLockingEnabled=true
weblogic.startup.JavaHome=/u01/jdk
weblogic.startup.MW_Home=
coherence.startup.JavaHome=/u01/jdk
coherence.startup.MW_Home=
Domain name mappings:
docker_domain -> /u01/oracle/domains/docker_domain
<Aug 8, 2022 6:51:34 AM UTC> <INFO> <14.1.1.0.0>
<Aug 8, 2022 6:51:34 AM UTC> <INFO> <Server Implementation Class: weblogic.nodemanager.server.NMServer$ClassicServer.>
<Aug 8, 2022 6:51:34 AM UTC> <INFO> <Plain socket listener started on port 5556, host localhost/127.0.0.1>
|
cs |
NodeManager 실행이 완료되면 웹로직 콘솔로 돌아와 시스템을 구성해 줍니다.
참고로 Container 간의 통신을 위해서는 다음과 같이 docker network 작업이 진행되어야 합니다.
(Admin 서버와 node manager 간의 통신을 위해 사용)
docker network create wls-network
docker network connect wls-network wls_admin
docker network connect wls-network wls_slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@middleware-works-centos8 wls14c]# docker network create wls-network
e48ce765e8cd918c8e24fafcf6df5ac0640ab38b89164fc796141f4f42285f0b
[root@middleware-works-centos8 wls14c]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@middleware-works-centos8 wls14c]#
[root@middleware-works-centos8 wls14c]#
[root@middleware-works-centos8 wls14c]# ./wls_admin.sh
7be4ae97cdd39ebc3bbfecb8860b3fc72e763b3ddc08ed22684b69d7be120798
[root@middleware-works-centos8 wls14c]# ./wls_managed.sh
f4414089485c2ec5a86e109d2cb641c1460939f3173a3633de3b3eec5d871191
[root@middleware-works-centos8 wls14c]# docker network connect wls_network wls_admin
Error response from daemon: network wls_network not found
[root@middleware-works-centos8 wls14c]# docker network connect wls-network wls_admin
[root@middleware-works-centos8 wls14c]# docker network connect wls-network wls_slim
|
cs |
Console에서 노드 매니저를 구성해 줍니다.
Node manager가 확인 되었습니다.
Node manager 등록이 완료되었으므로 서버를 생성하고 기동 해 줍니다.
생성한 managed 서버를 기동해 줍니다.
서버 기동이 완료되었습니다.
서버 기동 완료 후 접근 확인입니다.
배포된 App이 없어 404 페이지가 뜨고 있지만 slim 버전의 docker image로 서비스가 가능한 것을 확인할 수 있었습니다.
여기까지 WebLogic Image Tool을 사용하여 WebLogic docker image를 생성하고 운영환경에 구성하는 방법을 알아보았습니다.
타 WAS 대비 강력한 기능을 제공하는 WebLogic도 이제 container 환경에서 사용이 가능하며, managed 서버의 경우 slim image를 사용하면 불필요한 용량을 줄일 수 있어 이러한 구조에서는 활용 의미가 있을 것 같습니다.
블로그 포스팅 내용을 동영상 데모로 작성하였습니다.
이해가 어려우신 분은 데모를 보시고 따라해 보세요.