embulk-input-mysql의 SSL 통신에 Communications link failure가 나왔을 때의 대처법

경위


  • 어느 시점부터 SSLException
  • 인스턴스 회전으로 인해 인스턴스를 다시 작성한 후 오류가 발생하여 연결할 수 없습니다.
  • 응급 적으로 SSL: true
  • 2020 년부터 TLS v1.0/1.1의 무효화가 결정되었으므로 그 영향을 의심합니다.
  • twitter에서 도움을 받는다 htps : // 라고 해서 r. 코 m/요시_켄/s 타츠 s/1398119709732610049
  • 제안 된 설정을 추가하여 해결할 수 있습니다

  • 결론



    embulk에 전달할 구성 파일에 SSL: enable를 지정합시다.

    여러 옵션을 전달하고 싶을 때는 다음과 같이 여러 줄 표기가 좋습니다.
      options:
        enabledTLSProtocols: TLSv1.2
        sessionVariables: group_concat_max_len=10*1024
    

    JDBC Option을 전달하여 매개 변수 변경


    SSL: false 가 증가하고 있는 것을 알 수 있습니다.
    変更前
    Connecting to jdbc:mysql://****.rds.amazonaws.com:3306/abc_db options {useCompression=true, socketTimeout=1800000, useSSL=true, user=test, useLegacyDatetimeCode=false, requireSSL=true, tcpKeepAlive=true, verifyServerCertificate=false, connectTimeout=300000, password=***, zeroDateTimeBehavior=convertToNull}
    
    変更後
    Connecting to jdbc:mysql://****.rds.amazonaws.com:3306/abc_db options {useCompression=true, enabledTLSProtocols=TLSv1.2, socketTimeout=1800000, useSSL=true, user=test, useLegacyDatetimeCode=false, requireSSL=true, verifyServerCertificate=false, tcpKeepAlive=true, connectTimeout=300000, password=***, zeroDateTimeBehavior=convertToNull}
    

    전조



    다음 SSLException이 나오기 시작했습니다.
    Wed Feb 24 00:08:16 UTC 2021 WARN: Caught while disconnecting...
    
    EXCEPTION STACK TRACE:
    
    
    
    ** BEGIN NESTED EXCEPTION ** 
    
    javax.net.ssl.SSLException
    MESSAGE: closing inbound before receiving peer's close_notify
    
    STACKTRACE:
    
    javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify
        at sun.security.ssl.Alert.createSSLException(Alert.java:133)
        at sun.security.ssl.Alert.createSSLException(Alert.java:117)
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:311)
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:267)
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:258)
        at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:637)
        at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:616)
        at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2246)
        at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4237)
        at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1465)
        at org.embulk.input.jdbc.JdbcInputConnection.close(JdbcInputConnection.java:208)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.transaction(AbstractJdbcInputPlugin.java:215)
        at org.embulk.exec.BulkLoader.doRun(BulkLoader.java:507)
        at org.embulk.exec.BulkLoader.access$000(BulkLoader.java:35)
        at org.embulk.exec.BulkLoader$1.run(BulkLoader.java:353)
        at org.embulk.exec.BulkLoader$1.run(BulkLoader.java:350)
        at org.embulk.spi.Exec.doWith(Exec.java:22)
        at org.embulk.exec.BulkLoader.run(BulkLoader.java:350)
        at org.embulk.EmbulkEmbed.run(EmbulkEmbed.java:178)
        at org.embulk.EmbulkRunner.runInternal(EmbulkRunner.java:292)
        at org.embulk.EmbulkRunner.run(EmbulkRunner.java:156)
        at org.embulk.cli.EmbulkRun.runSubcommand(EmbulkRun.java:433)
        at org.embulk.cli.EmbulkRun.run(EmbulkRun.java:90)
        at org.embulk.cli.Main.main(Main.java:64)
    
    
    ** END NESTED EXCEPTION **
    

    나중에 options: {"enabledTLSProtocols":"TLSv1.2"} 오류가 발생하여 SSL 통신에 실패했습니다.
    2021-05-25 06:22:00.934 +0000 [INFO] (0001:transaction): Connecting to jdbc:mysql://****.rds.amazonaws.com:3306/abc_db options {useCompression=true, socketTimeout=1800000, useSSL=true, user=test, useLegacyDatetimeCode=false, requireSSL=true, tcpKeepAlive=true, verifyServerCertificate=false, connectTimeout=300000, password=***, zeroDateTimeBehavior=convertToNull}
    org.embulk.exec.PartialExecutionException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    
    The last packet successfully received from the server was 222 milliseconds ago.  The last packet sent successfully to the server was 217 milliseconds ago.
        at org.embulk.exec.BulkLoader$LoaderState.buildPartialExecuteException(BulkLoader.java:340)
        at org.embulk.exec.BulkLoader.doRun(BulkLoader.java:566)
        at org.embulk.exec.BulkLoader.access$000(BulkLoader.java:35)
        at org.embulk.exec.BulkLoader$1.run(BulkLoader.java:353)
        at org.embulk.exec.BulkLoader$1.run(BulkLoader.java:350)
        at org.embulk.spi.Exec.doWith(Exec.java:22)
        at org.embulk.exec.BulkLoader.run(BulkLoader.java:350)
        at org.embulk.EmbulkEmbed.run(EmbulkEmbed.java:178)
        at org.embulk.EmbulkRunner.runInternal(EmbulkRunner.java:292)
        at org.embulk.EmbulkRunner.run(EmbulkRunner.java:156)
        at org.embulk.cli.EmbulkRun.runSubcommand(EmbulkRun.java:433)
        at org.embulk.cli.EmbulkRun.run(EmbulkRun.java:90)
        at org.embulk.cli.Main.main(Main.java:64)
        Suppressed: java.lang.NullPointerException
            at org.embulk.exec.BulkLoader.doCleanup(BulkLoader.java:463)
            at org.embulk.exec.BulkLoader$3.run(BulkLoader.java:397)
            at org.embulk.exec.BulkLoader$3.run(BulkLoader.java:394)
            at org.embulk.spi.Exec.doWith(Exec.java:22)
            at org.embulk.exec.BulkLoader.cleanup(BulkLoader.java:394)
            at org.embulk.EmbulkEmbed.run(EmbulkEmbed.java:181)
            ... 5 more
    Caused by: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    

    참고 기사

    좋은 웹페이지 즐겨찾기