jojo's blog--快樂憂傷都與你同在
          為夢(mèng)想而來,為自由而生。 性情若水,風(fēng)起水興,風(fēng)息水止,故時(shí)而激蕩,時(shí)又清平……
          posts - 11,  comments - 30,  trackbacks - 0
          [mdrop@deployment1-1 newDeploy]$ cat setup_gf.sh
          #!/bin/bash

          # Do not edit below , please supply variable in command line
          ACTION=$1
          COBRAND=$2
          GLASS_FISH=$3
          DOMAIN=domain1
          MASTERIP=$4
          ACTIVEMQ=$5
          INSTANCE_NO=$6
          JDBC_USER=$7
          JDBC_PASSWORD=$8
          JDBC_HOST=$9



          CLUSTER=ps-$COBRAND-cluster
          NODE=ps-$COBRAND-node-$INSTANCE_NO
          INSTANCE=ps-$COBRAND-instance-$INSTANCE_NO


          function common () {


          #those two command should be executed in master and slave machine
          cp mysql-connector-java-5.1.5-bin.jar $GLASS_FISH/lib
          cp obrealm.jar  $GLASS_FISH/lib
          cp -rf activeMQ_config/*  $ACTIVEMQ/

          if [ $ACTION = "master" ]; then
          $GLASS_FISH/bin/asadmin stop-domain $DOMAIN
          $GLASS_FISH/bin/asadmin start-domain $DOMAIN
          fi

          #run those following lines to stop cluster and node in the master machine
          if [ $ACTION = "master" ]; then
          $GLASS_FISH/bin/asadmin stop-cluster --user admin --host  $MASTERIP  --port 4848 $CLUSTER
          fi
          $GLASS_FISH/bin/asadmin stop-node-agent $NODE

          #run those following lines to delete node, cluster and instance in the master machine
          $GLASS_FISH/bin/asadmin delete-node-agent  $NODE
          if [ $ACTION = "master" ]; then
          $GLASS_FISH/bin/asadmin delete-cluster  $CLUSTER
          fi
          $GLASS_FISH/bin/asadmin delete-instance  $INSTANCE


          #run those following lines to create node, cluster and instance in the master machine
          $GLASS_FISH/bin/asadmin create-node-agent --host $MASTERIP --port 4848 $NODE
          if [ $ACTION = "master" ]; then
          $GLASS_FISH/bin/asadmin create-cluster --host $MASTERIP --port 4848 $CLUSTER
          fi
          $GLASS_FISH/bin/asadmin create-instance --host $MASTERIP --port 4848 --nodeagent $NODE --cluster $CLUSTER $INSTANCE



          #run those following lines to start node, cluster and instance in the master machine
          #bin/asadmin start-node-agent --syncinstances=true $NODE
          #bin/asadmin start-cluster --user admin --host $MASTERIP --port 4848 $CLUSTER
          #bin/asadmin start-instance --user admin --host $MASTERIP --port 4848 $INSTANCE

          }

          function master () {

          #cp -r classes/* $GLASS_FISH/domains/$DOMAIN/lib/classes/

          cp  activemq-rar-5.1.0.rar  $GLASS_FISH/

          #those two command should be executed in master and slave machine
          cp mysql-connector-java-5.1.5-bin.jar $GLASS_FISH/lib
          cp obrealm.jar  $GLASS_FISH/lib

          $GLASS_FISH/bin/asadmin stop-domain $DOMAIN
          $GLASS_FISH/bin/asadmin start-domain $DOMAIN



          $GLASS_FISH/bin/asadmin set $CLUSTER.java-config.classpath-suffix='${com.sun.aas.installRoot}/lib/mysql-connector-java-5.1.5-bin.jar'
          $GLASS_FISH/bin/asadmin set $CLUSTER.java-config.classpath-suffix='${com.sun.aas.installRoot}/lib/obrealm.jar'
          mkdir -p /usr/local/site/webroot/template/pointsystem/
          $GLASS_FISH/bin/asadmin set $CLUSTER.system-property.com_outblaze_config_cobrand='/usr/local/site/webroot/template/pointsystem/'
          $GLASS_FISH/bin/asadmin create-auth-realm --classname com.outblaze.glassfish.security.OBAppservRealm --property auth-type=obRealm:jaas-context=obRealm --target $CLUSTER obRealm

          echo "obRealm {com.outblaze.glassfish.security.OBPasswordLoginModule required;};" >> $GLASS_FISH/domains/$DOMAIN/config/login.conf

          $GLASS_FISH/bin/asadmin  set $CLUSTER.http-service.virtual-server.server.property.accessLoggingEnabled=true
          echo "finished setting the access log "

          $GLASS_FISH/bin/asadmin delete-jdbc-connection-pool --cascade=true --target $CLUSTER mysqlPool
          $GLASS_FISH/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --isolationlevel read-committed --isisolationguaranteed --property User=$JDBC_USER:Password=$JDBC_PASSWORD:URL="jdbc":mysql"://$JDBC_HOST/pointsystem_sd" --target $CLUSTER mysqlPool
          $GLASS_FISH/bin/asadmin create-jdbc-resource --connectionpoolid mysqlPool --target $CLUSTER jndi/cobrandpsDS
          $GLASS_FISH/bin/asadmin delete-jdbc-connection-pool --cascade=true --target $CLUSTER mysqlPoolOffline
          $GLASS_FISH/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --isolationlevel read-committed --isisolationguaranteed --property User=$JDBC_USER:Password=$JDBC_PASSWORD:URL="jdbc":mysql"://$JDBC_HOST/pointsystem_off" --target $CLUSTER mysqlPoolOffline
          $GLASS_FISH/bin/asadmin create-jdbc-resource --connectionpoolid mysqlPoolOffline --target $CLUSTER jndi/cobrandpsDS_of
          $GLASS_FISH/bin/asadmin delete-jdbc-connection-pool --cascade=true --target $CLUSTER mysqlPoolLog
          $GLASS_FISH/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --isolationlevel read-committed --isisolationguaranteed --property User=$JDBC_USER:Password=$JDBC_PASSWORD:URL="jdbc":mysql"://$JDBC_HOST/wslog_stats_db" --target $CLUSTER mysqlPoolLog
          $GLASS_FISH/bin/asadmin create-jdbc-resource --connectionpoolid mysqlPoolLog --target $CLUSTER jndi/cobrandpsDS_log
          $GLASS_FISH/bin/asadmin delete-jdbc-connection-pool --cascade=true --target $CLUSTER itemmallsqlPool
          $GLASS_FISH/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --isolationlevel read-committed --isisolationguaranteed --property User=$JDBC_USER:Password=$JDBC_PASSWORD:URL="jdbc":mysql"://$JDBC_HOST/obcart" --target $CLUSTER itemmallsqlPool
          $GLASS_FISH/bin/asadmin create-jdbc-resource --connectionpoolid itemmallsqlPool --target $CLUSTER jndi/itemmallDS

          $GLASS_FISH/bin/asadmin delete-jdbc-connection-pool --cascade=true --target $CLUSTER mysqlPoolpsClusterTimer
          $GLASS_FISH/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --isolationlevel read-committed --isisolationguaranteed --property User=$JDBC_USER:Password=$JDBC_PASSWORD:URL="jdbc":mysql"://$JDBC_HOST/glassfishtimer" --target $CLUSTER mysqlPoolpsClusterTimer
          $GLASS_FISH/bin/asadmin create-jdbc-resource --connectionpoolid mysqlPoolpsClusterTimer --target $CLUSTER jndi/ps_cluster_timer

          $GLASS_FISH/bin/asadmin delete-jdbc-connection-pool --cascade=true --target $CLUSTER reportPool
          $GLASS_FISH/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --isolationlevel read-committed --isisolationguaranteed --property User=$JDBC_USER:Password=$JDBC_PASSWORD:URL="jdbc":mysql"://$JDBC_HOST/pointsystem_sd" --target $CLUSTER reportPool
          $GLASS_FISH/bin/asadmin create-jdbc-resource --connectionpoolid reportPool --target $CLUSTER jndi/reportDS

          $GLASS_FISH/bin/asadmin set $CLUSTER-config.ejb-container.ejb-timer-service.timer-datasource=jndi/ps_cluster_timer

          #$GLASS_FISH/bin/asadmin create-jvm-options --target $CLUSTER -Dcom.sun.enterprise.web.connector.enableJK=8012
          #$GLASS_FISH/bin/asadmin create-jvm-options --target $CLUSTER -DjvmRoute=glassfish1
          #$GLASS_FISH/bin/asadmin create-jvm-options --target $CLUSTER -DjvmRoute=glassfish2
          #$GLASS_FISH/bin/asadmin set $CLUSTER.java-config.classpath-prefix='${com.sun.aas.installRoot}/lib/patch.jar'
          #$GLASS_FISH/bin/asadmin set $CLUSTER.java-config.system-classpath='${com.sun.aas.installRoot}/lib/tomcat-ajp.jar,${com.sun.aas.installRoot}/lib/commons-modeler.jar,${com.sun.aas.installRoot}/lib/commons-logging.jar'


          }

          function setupmq () {


          echo "Prepare for MQ"
          echo "============================================================================="
          $GLASS_FISH/bin/asadmin delete-jmsdest  --desttype queue --target $CLUSTER ActiveMqQueue
          $GLASS_FISH/bin/asadmin delete-admin-object --target $CLUSTER jms/ActiveMqQueue
          $GLASS_FISH/bin/asadmin delete-connector-resource --target $CLUSTER jms/ActiveMQConnectionFactory
          $GLASS_FISH/bin/asadmin delete-connector-connection-pool --target $CLUSTER jms/ActiveMQpool
          $GLASS_FISH/bin/asadmin undeploy --target $CLUSTER activemq-rar-5.1.0
          echo "finished prepare for MQ"
          echo "============================================================================="


          echo "Start config for MQ"
          echo "--------------------------------------------------------------------------------"
          $GLASS_FISH/bin/asadmin deploy --target $CLUSTER activemq-rar-5.1.0.rar
          echo "finished deploying activemq-rar-5.1.0.rar"

          $GLASS_FISH/bin/asadmin create-admin-object --raname activemq-rar-5.1.0 --restype javax.jms.Queue --property DestinationJndiName=ActiveMqQueue --target $CLUSTER jms/ActiveMqQueue
          echo "finished create admin object jms/ActiveMqQueue"

          $GLASS_FISH/bin/asadmin create-jmsdest --desttype queue --target $CLUSTER ActiveMqQueue
          echo "finished create jmsdest ActiveMqQueue"

          $GLASS_FISH/bin/asadmin create-connector-connection-pool --raname activemq-rar-5.1.0 --connectiondefinition javax.jms.ConnectionFactory --transactionsupport  XATransaction --target $CLUSTER jms/ActiveMQpool
          echo "finished create connector connection pool jms/ActiveMQpool"

          $GLASS_FISH/bin/asadmin create-connector-resource --poolname jms/ActiveMQpool --target $CLUSTER jms/ActiveMQConnectionFactory
          echo "finished create connector resource jms/ActiveMQConnectionFactory"

          echo "MQ Setup complete"
          echo "--------------------------------------------------------------------------------"


          }

          if [ $# != 9 ]; then
                  echo $"Usage: $prog {master|slave cobrand_name glassfish_path DAS_hostname ActiveMQ_path instance_no mysql_username mysql_password mysql_host}"
                  exit 1
          fi

          case "$1" in
            master)
                  common
                  master
                  setupmq
                  ;;
            slave)
                  common
                  ;;
            *)
                  echo $"Usage: $prog {master|slave cobrand_name glassfish_path DAS_hostname ActiveMQ_path instance_no mysql_username mysql_password mysql_host}"
                  exit 1
          esac

          posted on 2009-07-31 11:53 Blog of JoJo 閱讀(607) 評(píng)論(0)  編輯  收藏 所屬分類: 每日一記My Script

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 离岛区| 萨嘎县| 汉阴县| 灵璧县| 扎赉特旗| 津南区| 米林县| 临朐县| 清水县| 句容市| 抚州市| 泸州市| 山阳县| 林芝县| 绿春县| 尉犁县| 阿坝县| 梁河县| 绵阳市| 连平县| 西林县| 汉寿县| 宝丰县| 太和县| 辽阳市| 龙泉市| 孟连| 江陵县| 金山区| 屏东县| 汕尾市| 正蓝旗| 鸡西市| 开江县| 保定市| 青州市| 宜良县| 万全县| 乐陵市| 台前县| 盐源县|