yujin2010good
作者yujin2010good2019-07-05 14:42
系统工程师, 大型零售巨头

cachecloud部署详细过程

字数 4920阅读 389评论 0赞 2

一、jdk安装

卸载openjdk

配置环境变量并测试是否配置成功

vim /etc/profile

export JAVA_HOME=/usr/java/jdk1.7.0_75

export JAVA_BIN=/usr/java/jdk1.7.0_75/bin

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

source /etc/profile

java -version

当正确的显示了JDK版本以后,证明你已经成功配置了JDK。

二、mysql安装配置
yum install mysql-server

ps -ef |grep mysql

service mysqld restart

/usr/bin/mysqladmin -u root password 123

mysql -uroot -p123

create database cachecloud;

grant all privileges on cachecloud. to 'admin'@'localhost' identified by 'admin';

grant all privileges on wmartsub.
to 'huiyuan'@'10.249.85.*' identified by 'wmhuiyuan2015';

flush privileges;

use cachecloud;

mysql> source /root/cachecloud/script/cachecloud.sql

source /usr/local/cachecloud/script/cachecloud.sql

git clone https://github.com/sohutv/cachecloud.git

编辑/usr/local/cachecloud/cachecloud-open-web/src/main/swap/online.properties文件

[root@elb ~]# cat /usr/local/cachecloud/cachecloud-open-web/src/main/swap/online.properties

cachecloud.db.url = jdbc:mysql://127.0.0.1:3306/cachecloud

cachecloud.db.user = admin

cachecloud.db.password = admin

cachecloud.maxPoolSize = 20

isClustered = true

isDebug = false

spring-file=classpath:spring/spring-online.xml

log_base=/opt/cachecloud-web/logs

web.port=8585

log.level=WARN

三、mvn安装
[root@elb ~]# wget http://apache.fayea.com/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz

tar xvf apache-maven-3.5.0-bin.tar.gz

ln -s apache-maven-3.5.0/ manven

vi /etc/profile

export M2_HOME=/usr/local/apache-maven-3.5.0

export PATH=$PATH:$M2_HOME/bin

[root@elb local]# source /etc/profile

[root@elb local]# mvn -version

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)

Maven home: /usr/local/apache-maven-3.5.0

Java version: 1.7.0_75, vendor: Oracle Corporation

Java home: /usr/java/jdk1.7.0_75/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"

四、项目打包发布(如有修改从新打包)

在cachecloud根目录下运行

[root@elb cachecloud]# pwd

/usr/local/cachecloud

[root@elb cachecloud]#mvn clean compile install -Ponline

。。。。。。。。。。。。

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO]

[INFO] cachecloud-open-parent ............................. SUCCESS [ 0.615 s]

[INFO] cachecloud-open-client ............................. SUCCESS [ 0.017 s]

[INFO] cachecloud-open-client-basic ....................... SUCCESS [ 4.138 s]

[INFO] cachecloud-jedis ................................... SUCCESS [ 11.829 s]

[INFO] cachecloud-open-common ............................. SUCCESS [ 0.292 s]

[INFO] cachecloud-open-web ................................ SUCCESS [03:59 min]

[INFO] cachecloud-open-client-redis ....................... SUCCESS [ 14.467 s]

[INFO] cachecloud-open-jedis-stat ......................... SUCCESS [ 0.323 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 04:31 min

[INFO] Finished at: 2016-11-30T03:23:05+08:00

[INFO] Final Memory: 37M/101M

[INFO] ------------------------------------------------------------------------

创建/opt/cachecloud-web目录,并拷贝相关文件

[root@elb cachecloud]#mkdir -p /opt/cachecloud-web
[root@elb cachecloud]#cp cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war /opt/cachecloud-web/
[root@elb cachecloud]#cp cachecloud-open-web/src/main/resources/cachecloud-web.conf /opt/cachecloud-web/
[root@elb cachecloud]#ln -s /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.war /etc/init.d/cachecloudweb

或者如果想在linux上使用生产环境部署CacheCloud,执行deploy.sh脚本(cachecloud/script目录下)
例如当前cachecloud根目录在/data下,执行如下操作即可:
sh deploy.sh /data
deploy.sh脚本会将编译后的CacheCloud工程包、配置、启动脚本拷贝到/opt/cachecloud-web目录下。
当一切都准备好之后,可以执行sh /opt/cachecloud-web/start.sh 来启动CacheCloud:
sh /opt/cachecloud-web/start.sh
启动后可以执行如下操作观察启动日志:
tail -f /opt/cachecloud-web/logs/cachecloud-web.log

[root@ip-192-168-202-54 script]# sh -x deploy.sh /usr/local/

  • cachecloud_dir=/usr/local/
  • base_dir=/opt/cachecloud-web
  • mkdir -p /opt/cachecloud-web
  • mkdir -p /opt/cachecloud-web/logs
  • cp /usr/local//cachecloud/script/start.sh /opt/cachecloud-web
  • cp /usr/local//cachecloud/script/stop.sh /opt/cachecloud-web
  • cp /usr/local//cachecloud/cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war /opt/cachecloud-web
  • cp /usr/local//cachecloud/cachecloud-open-web/src/main/resources/cachecloud-web.conf /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.conf
    [root@ip-192-168-202-54 script]# cd /opt/cachecloud-web/
    [root@ip-192-168-202-54 cachecloud-web]# ls
    cachecloud-open-web-1.0-SNAPSHOT.conf cachecloud-open-web-1.0-SNAPSHOT.war logs start.sh stop.sh
    [root@ip-192-168-202-54 cachecloud-web]# sh -x st
    start.sh stop.sh
    [root@ip-192-168-202-54 cachecloud-web]# sh -x start.sh

启动cachecloudweb并通过http://IP:80访问,用户名和密码admin

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

2

添加新评论0 条评论

Ctrl+Enter 发表

关于TWT  使用指南  社区专家合作  厂商入驻社区  企业招聘  投诉建议  版权与免责声明  联系我们
© 2019  talkwithtrend — talk with trend,talk with technologist 京ICP备09031017号-30