最全CacheCloud最完整安裝使用文檔【實操系列】

準備階段

  1. 下載 cachecloud-master版本

解壓後目錄

cachecloud-master# ll -h
total 56K
drwxr-xr-x 6 root root 4.0K Nov 14 16:41 cachecloud-open-client
drwxr-xr-x 3 root root 4.0K Nov 14 16:41 cachecloud-open-common
drwxr-xr-x 4 root root 4.0K Nov 14 16:41 cachecloud-open-web
-rw-r--r-- 1 root root  12K Nov 14 16:41 LICENSE
-rw-r--r-- 1 root root  13K Nov 14 16:41 pom.xml
-rw-r--r-- 1 root root 8.7K Nov 14 16:41 README.md
drwxr-xr-x 2 root root 4.0K Nov 14 16:41 script
  1. 安裝mysql

  2. 導入項目中cachecloud.sql初始化庫表結構,默認插入admin超級管理員。

安裝cachecloud

直接按照生產環境標準安裝

  • 在cachecloud根目錄下運行
root@xxxx # mvn clean compile install -Ponline
...
[INFO]
[INFO] cachecloud-open-parent ............................. SUCCESS [  0.205 s]
[INFO] cachecloud-open-client ............................. SUCCESS [  0.006 s]
[INFO] cachecloud-open-client-basic ....................... SUCCESS [  1.549 s]
[INFO] cachecloud-jedis ................................... SUCCESS [  2.514 s]
[INFO] cachecloud-open-common ............................. SUCCESS [  0.079 s]
[INFO] cachecloud-open-web ................................ FAILURE [  2.029 s]
[INFO] cachecloud-open-client-redis ....................... SKIPPED
[INFO] cachecloud-open-jedis-stat ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.552 s
[INFO] Finished at: 2020-04-08T14:12:43+08:00
[INFO] Final Memory: 30M/577M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project cachecloud-open-web: Could not resolve dependencies for project com.sohu.tv:cachecloud-open-web:war:1.0-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:1.3.1.RELEASE -> com.fasterxml.jackson.core:jackson-databind:jar:2.9.10.1: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:2.9.10.1: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:2.9.10.1 from/to central (http://repo1.maven.org/maven2): Failed to transfer file: http://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.9.10.1/jackson-databind-2.9.10.1.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :cachecloud-open-web

運氣真好,果然報錯了(網上其他文章基本上都是直接跳過此步驟。也是醉了)

解決方法,在軟件根目錄下/pom.xmlhttp://repo1.maven.org/maven2

原配置:   	<url>http://repo1.maven.org/maven2</url>
修改配置:   <url>https://repo1.maven.org/maven2</url>

再次執行

root@xxxx # mvn clean compile install -Ponline
...
就不貼輸出了
...
  • 拷貝war包(cachecloud-open-web/target/cachecloud-open-web-1.0-SNAPSHOT.war)到/opt/cachecloud-web
  • 拷貝配置文件(cachecloud-open-web/src/main/resources/cachecloud-web.conf)到/opt/cachecloud-web下,並改名爲cachecloud-open-web-1.0-SNAPSHOT.conf(spring-boot要求,否則配置不生效)

注意了,此處網上文章又說的比較粗糙,以下是diff出來的差異,當然要根據實際生產情況適當修改

root@xxxx cachecloud# diff cachecloud-open-web/src/main/resources/cachecloud-web.conf /opt/cachecloud-web/cachecloud-open-web-1.0-SNAPSHOT.conf
1,2c1,2
< PID_FOLDER=/data/cachecloud-web
< LOG_FOLDER=/data/cachecloud-web/logs
---
> PID_FOLDER=/opt/cachecloud-web
> LOG_FOLDER=/opt/cachecloud-web/logs
6,7c6
< JAVA_HOME=/usr/local/jdk
< JAVA_OPTS="-server -Xmx4g -Xms4g -Xss256k -XX:MaxDirectMemorySize=1G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=40 -XX:+PrintGCDateStamps -Xloggc:/opt/cachecloud-web/logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/cachecloud-web/logs/java.hprof -XX:+DisableExplicitGC -XX:-OmitStackTraceInFastThrow -XX:+PrintCommandLineFlags -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djava.util.Arrays.useLegacyMergeSort=true -Dfile.encoding=UTF-8 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=22099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
\ No newline at end of file
---
> JAVA_OPTS="-server -Xmx1g -Xms1g -Xss256k -XX:MaxDirectMemorySize=1G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=40 -XX:+PrintGCDateStamps -Xloggc:/opt/cachecloud-web/logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/cachecloud-web/logs/java.hprof -XX:+DisableExplicitGC -XX:-OmitStackTraceInFastThrow -XX:+PrintCommandLineFlags  -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djava.util.Arrays.useLegacyMergeSort=true -Dfile.encoding=UTF-8 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=22099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
  • 啓動,我是選擇使用啓動腳本,當然也是要根據環境適當修改,主要是配置部分
...
SERVER_NAME=root
DEPLOY_DIR=/opt/cachecloud-web
STDOUT_FILE=${DEPLOY_DIR}/logs/cachecloud-web.log
WAR_FILE=${DEPLOY_DIR}/cachecloud-open-web-1.0-SNAPSHOT.war
...

登陸

  • 訪問http://127.0.0.1:9999/manage/login

右上角:(記得修改)

admin --> 管理後臺 --> 系統配置關係 --> 機器ssh密碼(一定要修改)
  • 初始化物理機(記得密碼要與上部一致哦~)
root@xxxx # cat cachecloud-init.sh
...
readonly redisDir="/opt/cachecloud/redis" # 部署位置,根據需要調整即可
readonly redisTarGz="redis-3.0.7.tar.gz"  # 版本信息,根據需要調整即可
...
  • 物理集羣管理
admin --> 管理後臺 --> 機器管理

成功後將會有真實的系統資源展示

特別提醒,最好使用master版本,因爲可以遷移slot

  • 數據遷移工具

使用的是redis-migrate-tool,需要先下載。

注意,不能3.x版本遷移到4.x

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章