gpt4 book ai didi

grails - Amazon RDS和Elastic Beanstalk连接

转载 作者:行者123 更新时间:2023-12-01 14:35:35 24 4
gpt4 key购买 nike

已经有几个线程讨论了这个问题,我已经尝试实现
Elastic Beanstalk -> RDS connection error using Grails

  • 我还打开了端口,以接受来自EC2实例中ICMP,TCP和UDP的“所有”连接。
  • 我已确保我的RDS和EC2实例位于同一区域(东部)中
  • 我还在RDS默认安全组
  • 中添加了“elasticbeanstalk-default”安全组。
  • 我已经在RDS CIDR设置中添加了本地计算机的IP地址,并且能够从我的计算机通过SQLYog连接到RDS。

  • 但是,当我尝试从Elastic Beanstalk连接我的RDS实例时,出现以下异常
    Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
    at java.net.Socket.connect(Socket.java:546)
    at java.net.Socket.connect(Socket.java:495)
    at java.net.Socket.<init>(Socket.java:392)
    at java.net.Socket.<init>(Socket.java:235)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
    ... 18 more

    Jun 1, 2011 5:12:41 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Jun 1, 2011 5:12:41 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [] startup failed due to previous errors
    Jun 1, 2011 5:12:41 AM org.apache.catalina.core.StandardContext listenerStop
    SEVERE: Exception sending context destroyed event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name.....
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:636)

    我的DataSource.groovy参数如下。
    production {
    dataSource {
    pooled = true
    dbCreate = "update" // one of 'create', 'create-drop','update'
    url = "jdbc:mysql://[MyEndPoint]:3306/*****"
    username = "*****"
    password = "*****"
    dialect = org.hibernate.dialect.MySQL5InnoDBDialect
    properties {
    validationQuery = "SELECT 1"
    testOnBorrow = true
    testOnReturn = true
    testWhileIdle = true
    timeBetweenEvictionRunsMillis = 1000 * 60 * 30
    numTestsPerEvictionRun = 3
    minEvictableIdleTimeMillis = 1000 * 60 * 30
    }
    }
    }

    最佳答案

    我解决了,虽然很愚蠢的答案。

    我一直觉得(认为)在NetBeans中为Grails项目构建新的WAR文件时,它是在“生产”环境中创建的,但事实并非如此。我必须转到项目属性,然后将“ Activity grails环境”设置更改为“生产”,并对此进行了修复。

    简而言之,Amazon Web Services Elastic Beanstalk试图连接到我的开发环境数据库“localhost”。

    关于grails - Amazon RDS和Elastic Beanstalk连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6196654/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com