apollo配置中心啟動遇到的問題

Neil_001發表於2020-09-24

環境:win10 + 本地mysql

啟動問題:

1. 日誌路徑:使用git-bash啟動,啟動日誌路徑為/opt/logs,此/opt不在當前碰盤根目錄,而在git-bash安裝目錄中,可直接在git-bash中輸入cd /opt/logs進行檢視日誌。

2. 資料庫時區問題:apollo啟動指令碼startup.sh預設加了 -Duser.timezone=Asia/Shanghai,mysql中預設使用了system時區,導致2個時區歧議,啟動失敗。

啟動資訊:

java -Dsun.misc.URLClassPath.disableJarChecking=true -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom -Dserver.port=8080 -Dlogging.file=/opt/logs/100003171/apollo-configservice.log -XX:HeapDumpPath=/opt/logs/100003171/HeapDumpOnOutOfMemoryError/ -XX:+UseParNewGC -Xloggc:/opt/logs/100003171/gc.log -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:+CMSClassUnloadingEnabled -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=5M -jar apollo-configservice.jar

報錯資訊:

java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.^M
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)^M
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)^M
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)^M
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63

 

解決方法:mysql連線url後面新增: serverTimezone=GMT%2B8

 

相關文章