cannot connect from app container to db container on ECS

1

I use Service Connect to connect Laravel app container to db container on ECS. When I ecs exec to app container and run php artisan migrate, nothing happens (no output). In addition, now I use database (mysql) as laravel cache, queue and session drivers but originally use redis. With redis configured as the drivers and run php artisan migrate I got the error like

protocol error, got 'H' as reply type byte

Note both redis and mysql works properly in local docker-compose env. I want to know the solution or trouble shooting method to this problem. Any trivial advice is welcome.

Related part of cloudformation is the following. App server service

ServiceConnectConfiguration:
        Enabled: true
        Namespace: !Ref ClusterName
        Services:
          - PortName: app-server
            DiscoveryName: app-server
            ClientAliases:
              - DnsName: app
                Port: 9000
        LogConfiguration:
          LogDriver: "awslogs"
          Options:
            awslogs-group: !Ref ECSLogGroup
            awslogs-region: !Ref AWS::Region
            awslogs-stream-prefix: app-server-service

DB server service

ServiceConnectConfiguration:
        Enabled: true
        Namespace: !Ref ClusterName
        Services:
          - PortName: db-server
            DiscoveryName: db-server
            ClientAliases:
              - DnsName: db
                Port: 3306
        LogConfiguration:
          LogDriver: "awslogs"
          Options:
            awslogs-group: !Ref ECSLogGroup
            awslogs-region: !Ref AWS::Region
            awslogs-stream-prefix: db-server-service

Due to word limit, I cannot post everything here but I will try to provide necessary info as much as I can. Related stackoverflow post Thanks,

已提问 1 年前109 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则