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

25.2.2.3.1. ドメインコントローラーとして機能するインスタンスの起動
概要

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

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

  1. Security Group タブですべてのトラフィックが許可されていることを確認します。アクセスを制限したい場合は、Red Hat Enterprise Linux のビルトインファイアウォール機能を使用できます。
  2. VPC のパブリックサブネットを running に設定します。
  3. 静的 IP を選択します。
  4. User Data フィールドを設定します。設定可能なパラメーターは 「永続的な設定パラメーター」 および 「カスタムスクリプトパラメーター」 を参照してください。Amazon EC2 でのドメインコントローラー検出の詳細については、「ドメインコントローラー検索およびフェールオーバーの Amazon EC2 での設定」 を参照してください。

    例25.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 Data フィールドの USER_SCRIPT 行の下に追加してセキュリティーアップデートが起動時に適用されるようにします。
    yum -y update

    注記

    yum -y update を定期的に実行して、セキュリティー修正と拡張を適用する必要があります。
  6. Red Hat AMI インスタンスを起動します。
結果

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