First, pre-preparation
1. Installation of MySQL database: MySQL-5.6.22, self-installing
2. Dubbo Video Tutorial--Basic article--No. 03 Section--zookeeper Registration Center Installation
3. Dubbo Video Tutorial--Basic article--No. 06 Section--dubbo Management Console installation
4. Dubbo Video Tutorial--Basic article--10th Section introduction of--DUBBO Monitoring Center and installation of simple monitoring Center
5. Installation of the Continuous Integration management platform (SVN, Nexus, Maven, Hudson):
Dubbo Video Tutorial--Basic section--11th to 18
6, Dubbo Video Tutorial--Advanced Article--21st section--ACTIVEMQ installation and use
7, Dubbo video Tutorial--Advanced article--22nd section--redis installation and use
8. Dubbo Video Tutorial--Advanced article--23rd section--fastdfs installation and use of Distributed file system
Ii. planning for the deployment environment
Create a database
Database encoded as: UTF-8
The database engine is: InnoDB
Import the "Dubbo-based Distributed System Architecture video Tutorial-Simple version payment system source code. RAR" in the
"Edu_simple_pay.sql" in "Database--edu_simple_pay.rar"
Adjust the public configuration file
Pre-deployment preparation for Applications
1, common project build, publish to MAVEN private library
Pay particular attention to the construction of the Pay-common-config project (the configuration files need to be rebuilt after modification, and the reference will be rebuilt)
2, facade project build, publish to MAVEN private library
Deployment Services
1. Plan the Service deployment directory and prepare the service management script.
/home/wusc/edu/service/account/service-account.sh
#!/bin/sh
# # Java ENV
Export java_home=/usr/local/java/jdk1.7.0_72
Export Jre_home= $JAVA _home/jre
# just need to the change this param name
App_name=account
service_dir=/home/wusc/edu/service/$APP _name
service_name=pay-service-$APP _name
Jar_name= $SERVICE _name\.jar
Pid= $SERVICE _name\.pid
CD $SERVICE _dir
Case "$" in
Start
Nohup $JRE _home/bin/java-xms128m-xmx512m-jar $JAR _name >/dev/null 2>&1 &
Echo $! > $SERVICE _dir/$PID
echo "= = = Start $SERVICE _name"
;;
Stop
Kill ' Cat $SERVICE _dir/$PID '
RM-RF $SERVICE _dir/$PID
echo "= = = Stop $SERVICE _name"
Sleep 5
P_id= ' Ps-ef | Grep-w "$SERVICE _name" | Grep-v "grep" | awk ' {print $} '
If ["$P _id" = = ""]; Then
echo "= = = $SERVICE _name process not exists or stop success"
Else
echo "= = = $SERVICE _name process pid is: $P _id"
echo "= = = Begin Kill $SERVICE _name process, PID is: $P _id"
Kill-9 $P _id
Fi
;;
Restart
$ stop
Sleep 2
$ start
echo "= = = Restart $SERVICE _name"
;;
*)
# # Restart
$ stop
Sleep 2
$ start
;;
Esac
Exit 0
2. Use Hudson to automate deployment services
3, through the Dubbo control console to check whether all services are deployed successfully
Deploying Web Apps
1. Plan your Web application deployment directory, ports, scripts
Bank-receive-tomcat 8081
Boss-tomcat 8082
Gateway-tomcat 8083
Notify-receive-tomcat 8084
Portal-tomcat 8085
Shop-tomcat 8086
Trade-tomcat 8087
/home/wusc/edu/web/bank-receive-tomcat/restart.sh
# # Java ENV
Export java_home=/usr/local/java/jdk1.7.0_72
Export Jre_home= $JAVA _home/jre
# # Restart Tomcat
current_dir=$ (CD ' DirName $ '; pwd)
echo "= = = Current_dir is: $current _dir"
$current _dir/bin/shutdown.sh
Sleep 3
RM-RF $current _dir/webapps/*/
Sleep 2
$current _dir/bin/startup.sh
Deploy Apps
/home/wusc/edu/app/queue-notify/app-queue-notify.sh
#!/bin/sh
# # Java ENV
Export java_home=/usr/local/java/jdk1.7.0_72
Export Jre_home= $JAVA _home/jre
# # You are need to change next parameters value
App_dir=/home/wusc/edu/app/queue-notify
App_name=pay-app-queue-notify
Jar_name= $APP _name\.jar
CD $APP _dir
# # Check app process weather exists
process= ' ps aux | Grep-w "$APP _name" | Grep-v grep '
If ["$process" = = ""]; Then
echo "= = = $APP _name process NOT EXISTS"
Else
echo "= = = $APP _name Process exists"
echo "= = = $APP _name process is: $process"
# # Get PID by process name
P_id= ' Ps-ef | Grep-w "$APP _name" | Grep-v "grep" | awk ' {print $} '
echo "= = = $APP _name process PID is: $P _id"
echo "= = = Begin kill $APP _name Process"
Kill $P _id
Sleep 3
P_id= ' Ps-ef | Grep-w "$APP _name" | Grep-v "grep" | awk ' {print $} '
If ["$P _id" = = ""]; Then
echo "= = = $APP _name process Stop Success"
Else
echo "= = = $APP _name process kill failed, PID is: $P _id"
echo "= = = Begin kill-9 $APP _name process, PID is: $P _id"
Sleep 3
Kill-9 $P _id
Fi
Fi
Sleep 2
echo "= = = Begin start $APP _name"
$JRE _home/bin/java-xms128m-xmx512m-jar $APP _dir/$JAR _name >/dev/null 2>&1 &
Deploy Scheduled Tasks
Separation of deployment and invocation of timed tasks
/home/wusc/edu/timer/report/timer-report.sh
#!/bin/sh
# # Java ENV
Export java_home=/usr/local/java/jdk1.7.0_72
Export Jre_home= $JAVA _home/jre
# need to chage next-line value
Service_dir=/home/wusc/edu/timer/report
App_name=pay-timer-report
Jar_name= $APP _name\.jar
Sleep 1
echo "= = = Invoke task, please wait"
$JRE _home/bin/java-jar $SERVICE _dir/$JAR _name >/dev/null 2>&1 &
# # until process stop to print log
While True
Do
process= ' ps aux | grep $APP _name | Grep-v grep ';
If ["$process" = = ""]; Then
Sleep 1;
echo "= = = Task Complete";
Sleep 3;
Break
Else
echo "= = = Process is running, please wait";
Sleep 10;
Continue
Fi
Done
Video tutorial resources (including source code): http://www.roncoo.com
Dubbo Advanced Tutorial--Simple payment system deployment for payment system development (single node)