Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

24.5. 非クラスター化管理対象ドメイン

24.5.1. インスタンスをドメインコントローラーとして提供するための起動

概要

このトピックでは、Red Hat AMI (Amazon Machine Image) 上の非クラスター化された JBoss EAP 6 管理対象ドメインを起動するために必要な手順について説明します。

手順24.3 Red Hat AMI 上での非クラスター化 JBoss EAP 6 の管理対象ドメインの起動

  1. セキュリティーグループ タブで、すべてのトラフィックが許可されていることを確認します。必要に応じて、Red Hat Enterprise Linux の組み込みファイアウォール機能を使用して、アクセスを制限することができます。
  2. 実行 予定の VPC のパブリックサブネットを設定します。
  3. 静的 IP を選択します。
  4. User Data フィールドを設定します。設定可能なパラメーターは 「永続的な設定パラメーター」「カスタムスクリプトパラメーター」 から入手できます。Amazon EC2 でのドメインコントローラー検出の詳細は、「ドメインコントローラー検索およびフェールオーバーの Amazon EC2 での設定」 を参照してください。

    例24.4 User Data フィールドの例

    この例は、非クラスター化 JBoss EAP 6 管理対象ドメインの User Data フィールドを示しています。ユーザー admin のパスワードが admin に設定されている。
    ## password that will be used by slave host controllers to connect to the domain controller
    JBOSSAS_ADMIN_PASSWORD=admin
    
    ## subnet prefix this machine is connected to
    SUBNET=10.0.0.
    
    ## S3 domain controller discovery setup
    # JBOSS_DOMAIN_S3_SECRET_ACCESS_KEY=<your secret key>
    # JBOSS_DOMAIN_S3_ACCESS_KEY=<your access key>
    # JBOSS_DOMAIN_S3_BUCKET=<your bucket name>
    
    #### to run the example no modifications below should be needed ####
    JBOSS_DOMAIN_CONTROLLER=true
    PORTS_ALLOWED="9999 9990 9443"
    JBOSS_IP=`hostname | sed -e 's/ip-//' -e 'y/-/./'` #listen on public/private EC2 IP address
    
    cat > $USER_SCRIPT << "EOF"
    ## Get the application to be deployed from an Internet URL
    # mkdir -p /usr/share/java/jboss-ec2-eap-applications
    # wget https://<your secure storage hostname>/<path>/<app name>.war -O /usr/share/java/jboss-ec2-eap-applications/<app name>.war
    
    ## Create a file of CLI commands to be executed after starting the server
    cat> $USER_CLI_COMMANDS << "EOC" 
    
    # Add the modcluster subsystem to the default profile to set up a proxy
    /profile=default/subsystem=web/connector=ajp:add(name=ajp,protocol=AJP/1.3,scheme=http,socket-binding=ajp)
    /:composite(steps=[ {"operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster") ] },{ "operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster"), ("mod-cluster-config" => "configuration") ], "advertise" => "false", "proxy-list" => "${jboss.modcluster.proxyList}", "connector" => "ajp"}, { "operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster"), ("mod-cluster-config" => "configuration"), ("dynamic-load-provider" => "configuration") ]}, { "operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster"), ("mod-cluster-config" => "configuration"), ("dynamic-load-provider" => "configuration"), ("load-metric" => "busyness")], "type" => "busyness"} ])
    
    # Deploy the sample application from the local filesystem
    deploy /usr/share/java/jboss-ec2-eap-samples/hello.war --server-groups=main-server-group
    EOC
    
    ## this will workaround the problem that in a VPC, instance hostnames are not resolvable
    echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts
    echo -e "::1\tlocalhost6.localdomain6 localhost6" >> /etc/hosts
    for (( i=1 ; i<255 ; i++ )); do
       echo -e "$SUBNET$i\tip-${SUBNET//./-}$i" ;
    done >> /etc/hosts
    
    EOF
    
  5. 本番稼働インスタンスの場合

    実稼働インスタンスの場合は、USER_SCRIPT フィールドの User Data 行の下に次の行を追加し、セキュリティー更新が起動時に適用されるようにします。
    yum -y update
    注記
    セキュリティー修正と機能強化を適用するには、yum -y update が定期的に実行する必要があります。
  6. Red Hat AMI インスタンスを起動します。

結果

非クラスター化された JBoss EAP 6 管理対象ドメインが設定され、Red Hat AMI で起動されます。