文章目录

  • 1 IntelliJ IDEA启动CacheCloud
  • 1.1 在IntelliJ IDEA 中git 源码
  • 1.2 初始化数据库
  • 1.3 修改数据库配置
  • 1.3 配置maven启动
  • 1.4 启动
  • 1.5 查看
  • 2 local配置打包部署
  • 2.1 新建maven打包配置
  • 2.2 打包
  • 2.3 初始化服务目录结构
  • 2.4 上传cachecloud-open-web-1.0-SNAPSHOT.war到服务器
  • 2.5 启动
  • 2.6 查看
  • 3 online配置打包部署(线上)
  • 技术交流


1 IntelliJ IDEA启动CacheCloud

1.1 在IntelliJ IDEA 中git 源码

idea打包关闭test_idea打包关闭test


git 下载 https://github.com/sohutv/cachecloud

idea打包关闭test_maven_02

idea打包关闭test_spring_03

1.2 初始化数据库

cachecloud/script/cachecloud.sql

导入项目中cachecloud.sql初始化库表结构

idea打包关闭test_github_04

1.3 修改数据库配置

修改 cachecloud/cachecloud-open-web/src/main/swap/local.properties 数据库配置信息

cachecloud.db.url = jdbc:mysql://10.19.21.168:3306/cachecloud
cachecloud.db.user = admin
cachecloud.db.password = pwd123456
cachecloud.maxPoolSize = 20

isClustered = true
isDebug = true
spring-file = classpath:spring/spring-local.xml
log_base = /opt/cachecloud-web/logs
web.port = 9999
log.level = INFO

修改 cachecloud/cachecloud-open-web/src/main/swap/online.properties 数据库配置信息

cachecloud.db.url = jdbc:mysql://10.13.6.76:3306/cachecloud
cachecloud.db.user = admin
cachecloud.db.password = pwd123456
cachecloud.maxPoolSize = 20

isClustered = true
isDebug = false
spring-file=classpath:spring/spring-online.xml
log_base=/opt/cachecloud-web/logs
web.port=80
log.level=WARN

1.3 配置maven启动

1 新建

idea打包关闭test_maven_05


2 添加maven

idea打包关闭test_idea打包关闭test_06


配置maven

配置cachecloud-open-web目录:/Users/CleverCode/IdeaProjects/github/cachecloud/cachecloud-open-web

idea打包关闭test_maven_07

1.4 启动

点击启动

idea打包关闭test_github_08

1.5 查看

http://127.0.0.1:9999/ 输入admin admin登录

idea打包关闭test_idea打包关闭test_09

2 local配置打包部署

2.1 新建maven打包配置

使用的是local.properties配置信息

clean compile install -Plocal -f pom.xml

idea打包关闭test_idea打包关闭test_10


注意这里的目录是:/Users/CleverCode/IdeaProjects/github/cachecloud

idea打包关闭test_maven_11

2.2 打包

选择cachecloud_local,然后点击启动

idea打包关闭test_github_12


会打成一个war包: /Users/CleverCode/IdeaProjects/github/cachecloud/cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war

2.3 初始化服务目录结构

# mkdir -p /opt/cachecloud-web/logs
# scp https://github.com/sohutv/cachecloud/blob/master/script/start.sh /opt/cachecloud-web/
# scp https://github.com/sohutv/cachecloud/blob/master/script/stop.sh /opt/cachecloud-web/
# scp https://github.com/sohutv/cachecloud/blob/master/cachecloud-open-web/src/main/resources/cachecloud-web.conf /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.conf
# 没有nmon目录监控统计图会受到影响
# scp https://github.com/sohutv/cachecloud/tree/master/cachecloud-open-web/nmon  /opt/cachecloud-web/nmon

2.4 上传cachecloud-open-web-1.0-SNAPSHOT.war到服务器

scp  /Users/CleverCode/IdeaProjects/github/cachecloud/cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war /opt/cachecloud-web

/opt/cachecloud-web目录信息

idea打包关闭test_github_13

2.5 启动

vi /opt/cachecloud-web/start.sh

idea打包关闭test_maven_14


注意启动不能使用绝对路径启动,(sh /opt/cachecloud-web/start.sh 会启动失败)。可以变成(cd /opt/cachecloud-web &&sh start.sh)

cd /opt/cachecloud-web
sh start.sh

2.6 查看

http://10.9.21.159:9999/

idea打包关闭test_idea打包关闭test_15

3 online配置打包部署(线上)

clean compile install -Ponline -f pom.xml

使用:online.properties 数据库配置信息

idea打包关闭test_github_16


打包

idea打包关闭test_spring_17


其他步骤和local配置打包部署相同

查看,这里会使用80端口

http://10.9.21.159/manage/login?redirectUrl=/admin/app/list

idea打包关闭test_idea打包关闭test_18