502 bad gateway when I deploy SpringBoot application to AWS Elastic Beanstalk and cannot connect to RDS from local SpringBoot

huangapple go评论83阅读模式
英文:

502 bad gateway when I deploy SpringBoot application to AWS Elastic Beanstalk and cannot connect to RDS from local SpringBoot

问题

以下是您提供的内容的翻译部分:

我对AWS还不熟悉,我将部署我的StringBoot应用程序到AWS Elastic Beanstalk。我已经创建了RDS,并且我可以使用MySQL Workbench成功连接到它(没有建立模式)。但是当我将其部署到Elastic Beanstalk并运行时,我得到502错误坏的网关nginx/1.18.0。

另一个问题困扰着我,我无法使用本地SpringBoot连接到RDS。因此,当我将其打包成jar文件时,我让Maven跳过测试部分。我的yml文件如下所示。
在日志中,我发现显示:

Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.618  WARN 8134 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: 无法获取连接以查询元数据:未知数据库 'database-myblog'

这是否意味着与此数据库有什么问题,还是在运行之前我必须创建一个模式?

以下是一些yml文件示例;

  1. application.yml
spring:
  thymeleaf:
    mode: HTML
  profiles:
    active: prod
  1. application-prod.yml
server:
  port: 5000

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://endpoint:3306/database-myblog
    username: admin
    password: password

  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true

logging:
  level:
    root: warn
    com.lzl: info
  file:
    name: log/myblog-pro.log
  1. 日志如下所示
/var/log/web.stdout.log
----------------------------------------
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.618  WARN 8134 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: 无法获取连接以查询元数据:未知数据库 'database-myblog'
Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.625  WARN 8134 --- [           main] ConfigServletWebServerApplicationContext : 在初始化上下文时遇到异常 - 取消刷新尝试: org.springframework.beans.factory.BeanCreationException: 在类路径资源中定义的名为 'entityManagerFactory' 的bean创建失败 [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: 调用初始化方法失败; 嵌套异常是 org.hibernate.service.spi.ServiceException: 无法创建所请求的服务 [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.695 ERROR 8134 --- [           main] o.s.boot.SpringApplication               : 运行应用失败

/var/log/nginx/access.log

83.97.20.130 - - [18/Aug/2020:19:18:39 +0000] "GET / HTTP/1.1" 200 2197 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0" "-"
71.88.108.155 - - [18/Aug/2020:19:27:54 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:19:27:54 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Mac

英文:

I am new to AWS and I am going to deploy my StringBoot application to AWS Elastic Beanstalk. I already created rds and I can use mysql workbench to successfully connect to it(no schema built). But when I deploy it to Elastic Beanstalk and run it, I get error 502 bad gateway nginx/1.18.0.

Another problem brother me is I cannot connect to rds using local SpringBoot. So when I package it to jar file, I let maven skip test part. My yml(files) shown below.
In the log I fount it shows

Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.618  WARN 8134 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata : Unknown database 'database-myblog'

Is that means something wrong with this database or do I have to create a schema before I run it?

Some yml files shown below;

  1. application.yml
spring:
  thymeleaf:
    mode: HTML
  profiles:
    active: prod

2 application-prod.yml

server:
  port: 5000

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://endpoint:3306/database-myblog
    username: admin
    password: password

  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true

logging:
  level:
    root: warn
    com.lzl: info
  file:
    name: log/myblog-pro.log

3.log are shown below

/var/log/web.stdout.log
----------------------------------------
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1214)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1245)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
Aug 18 22:45:10 ip-172-31-15-192 web: at com.lzl.MyblogApplication.main(MyblogApplication.java:10)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.618  WARN 8134 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata : Unknown database 'database-myblog'
Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.625  WARN 8134 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Aug 18 22:45:10 ip-172-31-15-192 web: 2020-08-18 22:45:10.695 ERROR 8134 --- [           main] o.s.boot.SpringApplication               : Application run failed
Aug 18 22:45:10 ip-172-31-15-192 web: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
Aug 18 22:45:10 ip-172-31-15-192 web: at com.lzl.MyblogApplication.main(MyblogApplication.java:10)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Aug 18 22:45:10 ip-172-31-15-192 web: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Aug 18 22:45:10 ip-172-31-15-192 web: Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:176)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1214)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1245)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
Aug 18 22:45:10 ip-172-31-15-192 web: ... 24 common frames omitted
Aug 18 22:45:10 ip-172-31-15-192 web: Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
Aug 18 22:45:10 ip-172-31-15-192 web: at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
Aug 18 22:45:10 ip-172-31-15-192 web: ... 41 common frames omitted
Aug 18 22:45:14 ip-172-31-15-192 web: .   ____          _            __ _ _
Aug 18 22:45:14 ip-172-31-15-192 web: /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
Aug 18 22:45:14 ip-172-31-15-192 web: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
Aug 18 22:45:14 ip-172-31-15-192 web: \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
Aug 18 22:45:14 ip-172-31-15-192 web: '  |____| .__|_| |_|_| |_\__, | / / / /
Aug 18 22:45:14 ip-172-31-15-192 web: =========|_|==============|___/=/_/_/_/
Aug 18 22:45:14 ip-172-31-15-192 web: :: Spring Boot ::        (v2.2.7.RELEASE)
Aug 18 22:45:15 ip-172-31-15-192 web: 2020-08-18 22:45:15.213  INFO 8167 --- [           main] com.lzl.MyblogApplication                : Starting MyblogApplication v0.0.1-SNAPSHOT on ip-172-31-15-192.us-east-2.compute.internal with PID 8167 (/var/app/current/application.jar started by webapp in /var/app/current)
Aug 18 22:45:15 ip-172-31-15-192 web: 2020-08-18 22:45:15.236  INFO 8167 --- [           main] com.lzl.MyblogApplication                : The following profiles are active: prod
----------------------------------------
/var/log/nginx/access.log
----------------------------------------
83.97.20.130 - - [18/Aug/2020:19:18:39 +0000] "GET / HTTP/1.1" 200 2197 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0" "-"
71.88.108.155 - - [18/Aug/2020:19:27:54 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:19:27:54 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
209.17.97.82 - - [18/Aug/2020:20:39:36 +0000] "GET / HTTP/1.0" 502 157 "-" "Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)" "-"
71.88.108.155 - - [18/Aug/2020:21:28:16 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:21:28:16 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:21:31:39 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:21:31:39 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:21:55:47 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:21:55:47 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:22:02:46 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
71.88.108.155 - - [18/Aug/2020:22:02:46 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "-"
209.17.97.2 - - [18/Aug/2020:22:03:52 +0000] "GET / HTTP/1.1" 502 157 "-" "Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)" "-"
102.165.30.57 - - [18/Aug/2020:22:17:34 +0000] "GET / HTTP/1.0" 502 157 "-" "NetSystemsResearch studies the availability of various services across the internet. Our website is netsystemsresearch.com" "-"
----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2020/08/18 19:27:54 [error] 4712#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com"
2020/08/18 19:27:54 [error] 4712#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com", referrer: "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/"
2020/08/18 20:39:36 [error] 4712#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 209.17.97.82, server: , request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:5000/"
2020/08/18 21:28:16 [error] 4712#0: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com"
2020/08/18 21:28:16 [error] 4712#0: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com", referrer: "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/"
2020/08/18 21:31:39 [error] 6434#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com"
2020/08/18 21:31:39 [error] 6434#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com", referrer: "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/"
2020/08/18 21:55:47 [error] 6434#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com"
2020/08/18 21:55:47 [error] 6434#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com", referrer: "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/"
2020/08/18 22:02:46 [error] 6434#0: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com"
2020/08/18 22:02:46 [error] 6434#0: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 71.88.108.155, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com", referrer: "http://myblogsylas-env.eba-t2rnydtb.us-east-2.elasticbeanstalk.com/"
2020/08/18 22:03:52 [error] 6434#0: *13 connect() failed (111: Connection refused) while connecting to upstream, client: 209.17.97.2, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "3.131.11.237:80"
2020/08/18 22:17:34 [error] 6434#0: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 102.165.30.57, server: , request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:5000/"

答案1

得分: 1

你需要将Elastic Beanstalk的安全组添加到RDS的入站规则中。你还可以添加你的IP地址,以允许从本地进行连接。
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/rds-external-defaultvpc.html

英文:

You need to add security group of your Elastic Beanstalk to your inbound rules for RDS. You can also add your ip address to allow connection from your local.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/rds-external-defaultvpc.html

huangapple
  • 本文由 发表于 2020年8月19日 06:20:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/63477413.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定