apollo配置中心启动遇到的问题

环境: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

 

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页