原文はこちら。
https://blogs.oracle.com/WebLogicServer/entry/create_weblogic_server_domain_with
Oracle WebLogic Server 12.2.1ではMultitenancyをサポートしています。WebLogic Server Multitenancyでは、WebLogic Serverをドメインだけでなく、一つ以上のパーティションを使って構成することができます。パーティションにはWebLogic Server Multitenancyで導入された新たな要素(リソースグループ、リソースグループテンプレート、仮想ターゲットなど)が含まれています。パーティションを持つドメインを構成する場合、通常のWebLogicドメインの構成に比べて追加の手順が必要です。こうした新しいWebLogic Server Multitenancyに関連するコンセプトは、末尾のReferencesセクションに記載のドキュメントをご覧ください。
OracleはFusion Middleware Control(FMWC)で(Restricted JRFテンプレートを使い)WebLogicドメインを作成することを推奨していますが、WLSTを使ってWebLogic Serverこのエントリでは、2個のパーティションを持つWebLogicドメインをWLSTで作成する方法をご紹介します。
Using Fusion Middleware Control to Manage WebLogic Server
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/12c/manage_wls_fmc/obe.html
Oracle® Fusion Middleware Domain Template Reference 12c (12.2.1)
Oracle Restricted JRF Template
https://docs.oracle.com/middleware/1221/wls/WLDTR/fmw_templates.htm#WLDTR524
Oracle® Fusion Middleware Oracle WebLogic Scripting Tool 12c Release 1 (12.1.1)
Creating WebLogic Domains Using WLST Offline
http://docs.oracle.com/cd/E24329_01/web.1211/e24491/domains.htm#WLSTG156
1.Domain Topology
このエントリでは、以下のような構成のドメインを作成します。
- adminという1個の管理サーバと、パーティションcoke、パーティションpepsiがある
- パーティションcokeには、リソースグループcoke-rg1があり、仮想ターゲットcoke-vtに向けられている
- パーティションpepsiには、リソースグループpepsi-rg1があり、仮想ターゲットpepsi-vtに向けられている
- アプリケーションhelloTenant.earをドメイン、パーティションcokeのリソースグループcoke-rg1、パーティションpepsiのリソースグループpepsi-rg1にデプロイする。
ドメイントポロジーは以下のようになっています。
- ドメイン
- セキュリティ構成
- レルム:myrealm
- レルム:coke_realm
- レルム:pepsi_realm
- Server: admin(管理サーバ)
- 仮想ターゲット:coke-vt
- 仮想ターゲット:pepsi-vt
- パーティション:coke
- リソースグループ:coke-rg1
- アプリケーションデプロイメント:helloTenant-coke
- デフォルトターゲット:coke-vt
- パーティション:pepsi
- リソースグループ:pepsi-rg1
- アプリケーションデプロイメント:helloTenant-pepsi
- デフォルトターゲット:pepsi-vt
- アプリケーションデプロイメント:helloTenant
このドメイントポロジーには、リソースグループテンプレートのような別のMultitenancy関連のコンセプトを含んでいないことにご注意ください。このエントリでは取り扱いません。別のMultitenancy関連のコンセプトについて知りたい方は、Referencesセクションをチェックしてください。
2. Create a domain with partitions
上記のトポロジーを有するドメインを作成するには、以下の手順が必要です。
- 通常のWebLogicドメインを作成
- ドメインを起動
- ドメインにパーティションを作成
- パーティション用セキュリティレルムを作成
- パーティション用のユーザーを作成
- セキュリティレルムのグループにユーザーを追加
- 仮想ターゲットを作成
- パーティションを作成
- リソースグループの作成
- 仮想ターゲットをデフォルトターゲットに設定
- パーティション用のセキュリティIDD(アイデンティティドメイン)を設定
- サーバを再起動
- パーティションの開始
詳細を以下でご紹介します。
2.1 Create a traditional WLS domain
構成ウィザードを使って通常のWebLogicドメインを作成することができます。コマンドスクリプトから構成ウィザードを起動します。
sh $MW_Home /oracle_common/common/bin/config .sh
|
設定はすべてデフォルトですが、ドメイン名、管理者ユーザー名、パスワードは以下のものを使います。
- ドメイン名:base_domain
- 管理者ユーザ名:weblogic
- 管理者ユーザのパスワード:welcome1
2.2 Start the domain
cd $MW_Home /user_projects/domains/base_domain/
sh startWebLogic.sh
|
2.3 Create a partition: coke in a domain
WLSTを開始するには以下の手順が必要です。以下のコマンドでWLSTを起動します。
sh $MW_Home /oracle_common/common/bin/wlst .sh
|
管理サーバadminに管理ユーザweblogicとその資格証明を使って接続してから、以下のWLSTコマンドのすべてを実行できます。
これで、パーティションcokeのセットアップのためのWLSTコマンド実行の準備ができました。パーティションcokeには以下の設定を使います。
- パーティション名:coke
- パーティション管理者ユーザ名:mtadmin1
- パーティション管理者ユーザのパスワード:welcome1
以下の手順で、パーティション用のセキュリティレルムとユーザーを作成します。
2.3.1 Create a security realm for the partition
標準的なWebLogic ServerのAPIを使ってセキュリティレルムを作成します。
edit()
startEdit()
realmName = 'coke_realm'
security = cmo.getSecurityConfiguration()
print 'realm name is ' + realmName
realm = security.createRealm(realmName)
atnp = realm.createAuthenticationProvider(
'ATNPartition' , 'weblogic.security.providers.authentication.DefaultAuthenticator' )
atna = realm.createAuthenticationProvider(
'ATNAdmin' , 'weblogic.security.providers.authentication.DefaultAuthenticator' )
ia = realm.createAuthenticationProvider(
'IA' , 'weblogic.security.providers.authentication.DefaultIdentityAsserter' )
ia.setActiveTypes([ 'AuthenticatedUser' ])
realm.createRoleMapper(
'Role' , 'weblogic.security.providers.xacml.authorization.XACMLRoleMapper' )
realm.createAuthorizer(
'ATZ' , 'weblogic.security.providers.xacml.authorization.XACMLAuthorizer' )
realm.createAdjudicator( 'ADJ' , 'weblogic.security.providers.authorization.DefaultAdjudicator' )
realm.createAuditor( 'AUD' , 'weblogic.security.providers.audit.DefaultAuditor' )
realm.createCredentialMapper(
'CM' , 'weblogic.security.providers.credentials.DefaultCredentialMapper' )
realm.setCertPathBuilder(realm.createCertPathProvider(
'CP' , 'weblogic.security.providers.pk.WebLogicCertPathProvider' ))
pv = realm.createPasswordValidator( 'PV' ,
'com.bea.security.providers.authentication.passwordvalidator.SystemPasswordValidator' )
pv.setMinPasswordLength( 8 )
pv.setMinNumericOrSpecialCharacters( 1 )
save()
activate()
|
2.3.2 Add a user and group to the security realm for the partition
ユーザを作成し、ユーザをレルムのセキュリティグループに追加します。このユースケースでは、パーティションcokeの管理ユーザ名とパスワードはmtadmin1 と welcome1です。
edit()
startEdit()
realmName = 'coke_realm'
userName = 'mtadmin1'
groupName = 'Administrators'
print 'add user: realmName ' + realmName
if realmName = = 'DEFAULT_REALM' :
realm = cmo.getSecurityConfiguration().getDefaultRealm()
else :
realm = cmo.getSecurityConfiguration().lookupRealm(realmName)
print "Creating user " + userName + " in realm: " + realm.getName()
atn = realm.lookupAuthenticationProvider( 'ATNPartition' )
if atn.userExists(userName):
print "User already exists."
else :
atn.createUser(userName, '${password}' , realmName + ' Realm User' )
print "Done creating user. ${password}"
print "Creating group " + groupName + " in realm: " + realm.getName()
if atn.groupExists(groupName):
print "Group already exists."
else :
atn.createGroup(groupName, realmName + ' Realm Group' )
if atn.isMember(groupName,userName,true) = = 0 :
atn.addMemberToGroup(groupName, userName)
else :
print "User is already member of the group."
save()
activate()
|
2.3.3 Create a virtual target for the partition
この仮想ターゲットは管理サーバをターゲットにします。UriPrefixは /coke です。このurl接頭辞は、WebLogic ServerのMBeanServerへのJMX接続を作成するために使われます。
edit()
startEdit()
vt = cmo.createVirtualTarget( "coke-vt" )
vt.setHostNames(array([ "localhost" ],java.lang.String))
vt.setUriPrefix( "/coke" )
as = cmo.lookupServer( "admin" )
vt.addTarget(as)
save()
activate()
|
2.3.4 Create the partition: coke
パーティション名はcokeです。パーティションcokeを仮想ターゲットcoke-vtにターゲット指定します。
edit()
startEdit()
vt = cmo.lookupVirtualTarget( "coke-vt" )
p = cmo.createPartition( 'coke' )
p.addAvailableTarget(vt)
p.addDefaultTarget(vt)
rg = p.createResourceGroup( 'coke-rg1' )
rg.addTarget(vt)
realm = cmo.getSecurityConfiguration().lookupRealm( "coke-realm" )
p.setRealm(realm)
save()
activate()
|
2.3.5 Setup IDD for the partition
パーティションのプライマリ・アイデンティティドメイン(IDD)を設定します。
edit()
startEdit()
sec = cmo.getSecurityConfiguration()
sec.setAdministrativeIdentityDomain( "AdminIDD" )
realmName = 'coke_realm'
realm = cmo.getSecurityConfiguration().lookupRealm(realmName)
defAtnP = realm.lookupAuthenticationProvider( 'ATNPartition' )
defAtnP.setIdentityDomain( 'cokeIDD' )
defAtnA = realm.lookupAuthenticationProvider( 'ATNAdmin' )
defAtnA.setIdentityDomain( "AdminIDD" )
pcoke = cmo.lookupPartition( 'coke' )
pcoke.setPrimaryIdentityDomain( 'cokeIDD' )
realm = sec.getDefaultRealm()
defAtn = realm.lookupAuthenticationProvider( 'DefaultAuthenticator' )
defAtn.setIdentityDomain( "AdminIDD" )
save()
activate()
|
2.3.6 Restart the Server
セキュリティ設定の変更を反映するため、WebLogic Serverを再起動します。
2.3.7 Start the partition
パーティションがリクエストを受け付けるようにするために、以下の手順が必要です。
edit()
startEdit()
partitionBean = cmo.lookupPartition( 'coke' )
startPartitionWait(partitionBean)
save()
activate()
|
2.4 Create another partition: pepsi in a domain
2.3の手順を繰り返し、別のパーティションpepsiを作成します。ただし、以下の値はパーティションcokeと違うものを使います。
- パーティション名:pepsi
- パーティション管理者名:mtadmin2
- パーティション管理者のパスワード:welcome2
- セキュリティレルム:pepsi_realm
- アイデンティティドメイン名:pepsiIDD
- 仮想ターゲット名:pepsi-vt
- リソースグループ名:pepsi-rg1
2.5 Deploy User Application
これでドメインが利用できるようになりましたので、アプリケーションのearファイルをデプロイしましょう。今回はhelloTenant.earというアプリケーションをWebLogic Serverドメイン、パーティションcoke、パーティションpepsiにデプロイします。
edit()
startEdit()
deploy(appName = 'helloTenant' ,target = 'admin,path=' ${path - to - the - ear - file } / helloTenant.ear')
deploy(appName = 'helloTenant-coke' ,partition = 'coke' ,resourceGroup = 'coke-rg1' ,path = '${path-to-the-ear-file}/helloTenant.ear' )
deploy(appName = 'helloTenant-pepsi' ,partition = 'pepsi' ,resourceGroup = 'pepsi-rg1' ,path = '${path-to-the-ear-file}/helloTenant.ear' )
save()
activate()
|
2.6 Domain config file sample
すべての手順が完了したら、$DOMAIN_HOME/config/config.xml(ドメイン構成ファイル)にはドメインやパーティションに必要なすべての情報が含まれています。以下はconfig.xmlのパーティションcokeに関連するスニペットの例です。
<server>
<name>admin< / name>
<listen - address>localhost< / listen - address>
< / server>
<configuration - version> 12.2 . 1.0 . 0 < / configuration - version>
<app - deployment>
<name>helloTenant< / name>
<target>admin< / target>
<module - type >ear< / module - type >
<source - path>${path - to - the - ear - file } / helloTenant.ear< / source - path>
<security - dd - model>DDOnly< / security - dd - model>
<staging - mode xsi:nil = "true" >< / staging - mode>
<plan - staging - mode xsi:nil = "true" >< / plan - staging - mode>
<cache - in - app - directory>false< / cache - in - app - directory>
< / app - deployment>
<virtual - target>
<name>coke - vt< / name>
<target>admin< / target>
<host - name>localhost< / host - name>
<uri - prefix> / coke< / uri - prefix>
<web - server>
<web - server - log>
<number - of - files - limited>false< / number - of - files - limited>
< / web - server - log>
< / web - server>
< / virtual - target>
<admin - server - name>admin< / admin - server - name>
<partition>
<name>coke< / name>
<resource - group>
<name>coke - rg1< / name>
<app - deployment>
<name>helloTenant - coke< / name>
<module - type >ear< / module - type >
<source - path>${path - to - the - ear - file } / helloTenant.ear< / source - path>
<security - dd - model>DDOnly< / security - dd - model>
<staging - mode xsi:nil = "true" >< / staging - mode>
<plan - staging - mode xsi:nil = "true" >< / plan - staging - mode>
<cache - in - app - directory>false< / cache - in - app - directory>
< / app - deployment>
<target>coke - vt< / target>
<use - default - target>false< / use - default - target>
< / resource - group>
<default - target>coke - vt< / default - target>
<available - target>coke - vt< / available - target>
<realm>coke_realm< / realm>
<partition - id > 2d044835 - 3ca9 - 4928 - 915f - 6bd1d158f490 < / partition - id >
<primary - identity - domain>cokeIDD< / primary - identity - domain>
< / partition>
|
パーティションpepsiの場合、パーティションpepsiに対応する<virtual-target>要素と<partition>要素がconfig.xmlに追加されています。
これで、2個のパーティションを持つドメインを作成し、リクエストを受け付ける準備ができました。ユーザーはこのドメインにデプロイしたアプリケーションにアクセスすることができます。WebLogic Server 12.2.1 Multitenancy環境のMBeanServersに登録されたアプリケーションMBeanにアクセスする方法については、以下のエントリをご覧ください。
Application MBeans Visibility in Oracle WebLogic Server 12.2.1
https://blogs.oracle.com/WebLogicServer/entry/application_mbeans_visibility_in_oracle
3. Debug Flags
ドメイン作成時にエラーが発生した場合、以下のデバッグフラグを使って、エラーの切り分けが可能です。
- セキュリティレルムの設定に関連するエラーの場合、以下のデバッグフラグを使ってWebLogic Serverを再起動します。
-Dweblogic.debug.DebugSecurityAtn= true -Dweblogic.debug.DebugSecurity= true -Dweblogic.debug.DebugSecurityRealm= true
|
- ドメインでのBean構成エラーに関連するエラーの場合、以下のデバッグフラグを使ってWebLogic Serverを再起動します。
-Dweblogic.debug.DebugJMXCore= true -Dweblogic.debug.DebugJMXDomain= true
|
- 編集セッションの問題に関連するエラーの場合、以下のデバッグフラグを使ってWebLogic Serverを再起動します。
-Dweblogic.debug.DebugConfigurationEdit= true -Dweblogic.debug.DebugDeploymentService= true -Dweblogic.debug.DebugDeploymentServiceInternal= true -Dweblogic.debug.DebugDeploymentServiceTransportHttp= true
|
4. Conclusion
Oracle WebLogic Server 12.2.1のドメインにはパーティションを含めることができます。パーティションを持つドメインを作成するには、通常のWebLogicドメインを作成する手順に加え、さらに追加の手順が必要です。このエントリではWLSTを使ったドメイン作成方法をご紹介しました。パーティション付きのドメイン作成は、Fusion Middleware Controlを使って作成することも可能です。パーティション付きのドメイン作成方法は、Referencesセクションに列挙したドキュメントやエントリをご確認ください。
5. References
Oracle® Fusion Middleware Installing and Configuring Oracle WebLogic Server and Coherence 12c (12.2.1)
Creating and Configuring the WebLogic Domain
http://docs.oracle.com/middleware/1221/core/WLSIG/GUID-4AECC00D-782D-4E77-85DF-F74DD61391B4.htm#WLSIG283
Domain Partitions for Multi-tenancy in WebLogic Server 12.2.1
https://blogs.oracle.com/WebLogicServer/entry/domain_partitions_for_multi_tenancy
http://orablogs-jp.blogspot.jp/2015/11/domain-partitions-for-multi-tenancy-in.html
Using Fusion Middleware Control to Manage WebLogic Server
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/12c/manage_wls_fmc/obe.html
Oracle® Fusion Middleware Installing and Configuring the Oracle Fusion Middleware Infrastructure 12c (12.2.1)
Creating Database Schemas
https://docs.oracle.com/middleware/1221/core/INFIN/GUID-CA80A6E9-8903-4E19-81D7-A3647A11D0A6.htm#INFIN356
Oracle® Fusion Middleware Oracle WebLogic Scripting Tool 12c Release 1 (12.2.1)
Creating WebLogic Domains Using WLST Offline
http://docs.oracle.com/middleware/1221/wls/WLSTG/domains.htm#WLSTG156
Oracle® Fusion Middleware Domain Template Reference 12c (12.2.1)
Oracle Restricted JRF Template
https://docs.oracle.com/middleware/1221/wls/WLDTR/fmw_templates.htm#WLDTR524
Oracle® Fusion Middleware Administering Security for Oracle WebLogic Server 12.2.1 12c (12.2.1)
Configuring Security for a WebLogic Domain
http://docs.oracle.com/middleware/1221/wls/SECMG/conf-security-for-domain.htm#SECMG777
Oracle® Fusion Middleware Deploying Applications to Oracle WebLogic Server 12c (12.2.1)
Understanding WebLogic Server Deployment
https://docs.oracle.com/middleware/1221/wls/DEPGD/understanding.htm#DEPGD114
WebLogic Server Debug Flags
http://weblogic-wonders.com/weblogic/2010/11/18/weblogic-server-debug-flags/
0 件のコメント:
コメントを投稿