部署到edu-provider-01(192.168.1.121)
一、环境变量配置
Connecting to 192.168.1.121:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Fri Mar 25 13:36:38 2016 from 192.168.1.5
[root@edu-provider-01 ~]# ln -s /usr/Java/jdk1.7.0_45/ /usr/jdk
[root@edu-provider-01 ~]# vi /etc/profile
JAVA_HOME=/usr/jdk
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
[root@edu-provider-01 ~]# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
[root@edu-provider-01 ~]#
[root@edu-provider-01 ~]# source /etc/profile
[root@edu-provider-01 ~]# cd /home/yxq
[root@edu-provider-01 ~]# mkdir edu
[root@edu-provider-01 ~]# cd edu
[root@edu-provider-01 edu]# mkdir app
[root@edu-provider-01 edu]# mkdir serivce
[root@edu-provider-01 edu]# mkdir timer
[root@edu-provider-01 edu]# mkdir web
[root@edu-provider-01 edu]# cd serivce/
[root@edu-provider-01 serivce]# mkdir user
2.目录规范
要避免应用迁移时路径冲突
[root@edu-provider-01 serivce]# ls
user
[root@edu-provider-01 serivce]# cd user
[root@edu-provider-01 user]# ls
edu-service-user.jar lib service-user.sh
[root@edu-provider-01 user]# chmod 777 service-user.sh
[root@edu-provider-01 user]# ./service-user.sh start
=== start edu-service-user
[root@edu-provider-01 user]#
停止、重启服务
[root@edu-provider-01 user]# ./service-user.sh stop
=== stop edu-service-user
=== edu-service-user process not exists or stop success
[root@edu-provider-01 user]# ./service-user.sh restart
cat: /home/yxq/edu/serivce/user/edu-service-user.pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
=== stop edu-service-user
=== edu-service-user process not exists or stop success
=== start edu-service-user
=== restart edu-service-user
[root@edu-provider-01 user]#
service-user.sh脚本
3.自定义Dubbo服务维护的Shell脚本
脚本命名规范
/hom/yxq/edu/service/xxx/service-xxx.sh
例如:
/home/yxq/edu/serivce/user/service-user.sh
效果
./service-user.sh start
./service-user.sh stop
./service-user.sh restart
5.手动维护注意事项(结合自定义的Shell脚本)
(1)脚本规范--尽可能通用
(2)守护进程
(3)内存调优设置--按需调整
(4)日志处理--只保留应用log4j输出的日志
(5).避免服务冲突--进程名、端口
(6)避免进程误杀--全匹配