簡體   English   中英

Grails 更改為 MySQL 從 5.6 升級到 5.7

[英]Grails changes for MySQL upgrade from 5.6 to 5.7

我們是 grails 2.3.11 並且一直在使用 MySQL 5.6 (AWS RDS) 和 Hibernate

MySQL 和 hibernate 的現有運行時依賴項如下

dependencies {
        runtime 'mysql:mysql-connector-java:5.1.27'
...
...
...
plugins {
       runtime ":hibernate:3.6.10.19"

數據源配置如下。 (注意我們從來沒有在這里設置方言)

dataSource {
    pooled = true
    jmxExport = true
    url = myjdbcURL
    driverClassName = "com.mysql.jdbc.Driver"
    username = myjdbcUserName
    password = myJdbcPassword
    properties {
        jmxEnabled = true
        initialSize = System.getenv("DB_INITIAL_SIZE")
        maxActive = System.getenv("DB_MAX_ACTIVE")
        minIdle = 5
        maxIdle = 25
        maxWait = 10000
        maxAge = 10 * 60000
        timeBetweenEvictionRunsMillis = 5000
        minEvictableIdleTimeMillis = 60000
        validationQuery = "SELECT 1"
        validationQueryTimeout = 3
        validationInterval = 15000
        testOnBorrow = true
        testWhileIdle = true
        testOnReturn = false
        ignoreExceptionOnPreLoad = true
        // http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#JDBC_interceptors
        jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
        defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED // safe default
        // controls for leaked connections
        abandonWhenPercentageFull = 100 // settings are active only when pool is full
        removeAbandonedTimeout = 120
        removeAbandoned = true
        // use JMX console to change this setting at runtime
        logAbandoned = false // causes stacktrace recording overhead, use only for debugging
    }
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
    show_sql = false
    format_sql = false
    use_sql_comments = false
}

現在我們正在尋找將 MySQL 升級到 5.7 並試圖找到 grails 的任何文檔,但找不到它。

我能看到的一件事是我們一直使用的 MySQL 連接器僅支持 5.6,因此第一步是將其更新為 mysql-connector-java:5.1.49,因為我看到這是最新版本,grails 是運行 jdk 7,我無法切換到連接器 8。

I couldnt find anything related to hibernate as the Hibernate gorm plugin that we have been using with grails is the only one I could find https://mvnrepository.com/artifact/org.grails.plugins/hibernate/3.6.10.19

最后,直到現在我們還沒有為 MySQL 設置方言,所以不確定我們是否應該明確設置方言。

We are looking for least downtime, hence our plan was make Grails app support MySQL 5.7 first and keep backward compatibility with MySQL 5.6 and then upgrade MySQL to 5.7 and should still work.

有人做過這樣的升級嗎? 您的意見對我來說非常有價值。

我一直在通過 MySQL 連接器版本 5.1.45 使用 Grails 2.3.11 和 MySQL 5.7 的實例。 所以我想說你的一般方法應該很好,它是一個有效且有效的組合。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM