简体   繁体   English

Grails 更改为 MySQL 从 5.6 升级到 5.7

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

We are grails 2.3.11 and have been using MySQL 5.6 (AWS RDS) with Hibernate我们是 grails 2.3.11 并且一直在使用 MySQL 5.6 (AWS RDS) 和 Hibernate

The existing runtime dependency for MySQL and hibernate is following MySQL 和 hibernate 的现有运行时依赖项如下

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

And Datasource is configured the following way.数据源配置如下。 (Note we never set the dialect here) (注意我们从来没有在这里设置方言)

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
}

Now we are looking to upgrade MySQL to 5.7 and am trying to find any documentation for grails to do so but cannot find it.现在我们正在寻找将 MySQL 升级到 5.7 并试图找到 grails 的任何文档,但找不到它。

One thing I could see was the MySQL connector that we have been using only support 5.6 so that would be the first step would be to update this to mysql-connector-java:5.1.49 as I see that is the latest version and grails is running jdk 7, I cannot switch to connector 8.我能看到的一件事是我们一直使用的 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 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

Finally we never had set Dialect for MySQL till now so was not sure if we should set a dialect explicitly.最后,直到现在我们还没有为 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. 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.

Has anyone done such upgrade?有人做过这样的升级吗? Your inputs would be very valuable to me.您的意见对我来说非常有价值。

I have been using an instance of Grails 2.3.11 with MySQL 5.7 via MySQL connector version 5.1.45 for a long time.我一直在通过 MySQL 连接器版本 5.1.45 使用 Grails 2.3.11 和 MySQL 5.7 的实例。 So I would say that your general approach should work out fine, it is a valid and working combination.所以我想说你的一般方法应该很好,它是一个有效且有效的组合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM