We have an API using entity framework, this is running in AWS lambda on the public.ecr.aws/lambda/dotnet:5.0 image. We are having an issue with it making a connection to a remote server on an internal network. If I test the setup on an EC2 windows server then it runs fine, but on the lambda function it is returning the following errors:
[Debug] Microsoft.EntityFrameworkCore.Database.Connection: Opening connection to database 'DatabaseXYZ' on server '10.0.10.30'.
[Debug] Microsoft.EntityFrameworkCore.Infrastructure: 'EFDbContext' disposed.
[Error] Microsoft.EntityFrameworkCore.Database.Connection: An error occurred using the connection to database '' on server ''.
We can't work out why we are getting this error. It is a very similar setup to our other dotnet apps running on lambda which use RDS databases, the only difference is that this DB is running on-prem via a VPN - as mentioned above the API works if we load it on a EC2 instance but we want to use this on Lambda - and need to understand why the issue is occurring.
The lambda is also setup in the vpc on private subnets.
As a test I ran this code as an image in Lambda and was able to connect and query just fine.
Related
I have two GCP projects. A testing environment, built from scratch and a production environment with an already existing Cloud SQL for MySQL instance. My goal is to set a replication pipeline with Data Fusion to replicate some MySQL table.
On the testing environment I'm able to connect data fusion to MySQL. It is not working on the production environment. I have the following error:
Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
This error message is pretty mysterious to me. The two environment are setup exactly the same way as far as I can see so I don't understand where is this error coming from. What can I do to better understand what's behind this error?
my setup is one Cloud SQL for MySQL instance on Private IP, on VM with proxy SQL, one Private Cloud fusion instance.
I have a Python gRPC server running on AWS Fargate (configured very similar to this AWS guide here), and another AWS Fargate task (call it the "client") that attempts to make a connection to my gRPC server (also using Python gRPC). However, the client is unable to make a call to my server, with the following error:
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"#1619057124.216955000","description":"Failed to pick subchannel",
"file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":5397,
"referenced_errors":[{"created":"#1619057124.216950000","description":"failed to connect to all addresses",
"file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc",
"file_line":398,"grpc_status":14}]}"
Based on my reading online, it seems like there are myriad situations in which this error is thrown, and I'm having trouble figuring out which one pertains to my case. Here is some additional information:
When running client and server locally, I am able to successfully connect by having the client connect to localhost:[PORT]
I have configured an application load balancer target group following the guide from AWS here that makes health check requests to the / route of my gRPC server, using the gRPC protocol, and expect gRPC response code 12 (UNIMPLEMENTED); these health check requests are coming back as expected, which I believe implies the load balancer is able to successfully communicate with the server (although I could be misunderstanding)
I configured a service discovery system (following this guide here) that should allow me to reach my gRPC server within my VPC via the name service-name.dev.co.local. I can confirm that the corresponding DNS record exists in Route 53, and when I SSH into my VPC, I am indeed able to ping service-name.dev.co.local successfully.
Anyone have any ideas? Would appreciate any and all advice, and I'm happy to answer any further questions.
Thank you for your help!
on your grpc server use 0.0.0.0:[port] and expose this port with TCP on your container.
I'm trying to connect my app engine flex service to the cloud sql database that is in a shared project.
I have added the app engine default and app engine flex user as SQL admin to the shared project.
Now I'm trying to connect the app engine container to the cloud sql instance with the following connection string:
"Server=cloudsql;Database=cliche;User Id=user;Password=password;"
However, the connection always fails with the given connection string.
[13:57:37 ERR] An error occurred using the connection to database 'cliche' on server 'cloudsql'.
[13:57:37 ERR] An exception occurred while iterating over the results of a query for context type 'IKL.Data.ApplicationDbContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
As requested I provide the app.yaml here:
runtime: aspnetcore
env: flex
service: platform
manual_scaling:
instances: 1
resources:
cpu: 2
memory_gb: 1.5
disk_size_gb: 10
beta_settings:
cloud_sql_instances: shared-resources-291914:europe-west3:edutec-mssql=tcp:1433
I found your issue! Your connexion string "Server=cloudsql;Database=cliche;User Id=user;Password=password;" isn't correct.
Cloud SQL proxy open a tunnel. one side of the tunnel is the Cloud SQL instance, the other is your local instance. Therefore you have to connect on the local host
"Server=127.0.0.1;Database=cliche;User Id=user;Password=password;"
If you are using VPC Peering between your App Engine Flex project and your Cloud SQL project, then I must inform you that this is not possible to do yet, when you use an internal IP on your Cloud SQL, it will automatically use a VPC peering (different from the one you are probably using), and traffic between 3 VPC peerings is not posible.
You can use a VM in your Cloud SQL project to serve as a NAT server to route traffic onto your Cloud SQL there in order to workaround this, or you can use a Cloud VPN between your App Engine and Cloud SQL project, if possible please make sure that the NAT VM is in the same region as your Cloud SQL server or that the VPN on your SQL project is on the same region as your SQL server.
Also, please keep in mind that you would need to have the appropriate GCP firewall rules on all the involved GCP projects.
we operate CENM(1.2 and use helm template to run on k8s cluster) to construct our own private network and keep on running CENM network map server for a few week, then launching new node start failing.
with further investigation, its appeared that request timeout for http://nmap:10000/network-map causes problem.
in nmap server’s log, we found following output when access to above url with curl.
[NMServer] - Error while handling socket client message com.r3.enm.servicesapi.networkmap.handlers.LatestUnsignedNetworkParametersRetrievalMessage#760c53ea: HikariPool-1 - Connection is not available, request timed out after 30000ms.
netstat shows there is at least 3 establish connection to the database from the container which network map server runs, also I can connect database directly with using CLI.
so I don’t think it is neither database saturated nor network configuration problem.
anyone have an idea why this happens? I think restart probably solve the problem, but want to know the root cause...
regards,
Please test the following options.
Since it is the HikariCP (connection pool) component that is throwing the error it would be worth seeing if increasing the pool size in the network map configuration may help - see below)
Corda uses Hikari Pool for creating the connection pool. To configure the connection pool any custom properties can be set in the dataSourceProperties section.
dataSourceProperties = {
dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
...
maximumPoolSize = 10
connectionTimeout = 50000
}
Has a healthcheck been conducted to verify there are sufficient resources on that postgres database i.e basic diagnostic checks ?
Another option to get more information logged from the network map service is to run with TRACE logging also:
From https://docs.corda.net/docs/cenm/1.2/troubleshooting-common-issues.html
Enabling debug/trace logging
Each service can be configured to run with a deeper log level via command line flags passed at startup:
java -DdefaultLogLevel=TRACE -DconsoleLogLevel=TRACE -jar <enm-service-jar>.jar --config-fi
I wanted to make a ODBC connection from Windows PC to AS/400 DB2 server and I wrote a VBA program. But I got the following error.
Remote port could not be resolved
Then, I checked the status of server with CWSPING and got the result below:
I - Verifying connection to system 192.168.1.2...
I - Successfully connected to server application: Central Client
I - Successfully connected to server application: Network File
I - Successfully connected to server application: Network Print
I - Successfully connected to server application: Data Access
I - Successfully connected to server application: Data Queues
I - Successfully connected to server application: Remote Command
I - Successfully connected to server application: Security
E - CWBCO1011 - Remote port could not be resolved
E - CWBCO1008 - Unable to connect to server application DDM, returned 8407
I - Successfully connected to server application: Telnet
W - CWBCO1015 - Connection verified to system 192.168.1.2, but there were warnings
This means DDM service is not working on the server. ODBC connection requires DRDA, which runs upon DDM service, so I think running DDM service is the key to make ODBC connection. So I tried STRTCPSVR *DDM command but got the result below
*DDM not valid for parameter SERVER
And also tried CHGDDMTCPA AUTOSTART(*YES) PWDRQD(*YES) command, but got an error and I got stuck.
Command CHGDDMTCPA in library *LIBL not found
Does anyone have an idea of enabling DDM server on AS400?
Server: IBM AS400
OS version: V4R1
Try STRHOSTSVR *DATABASE.
STRHOSTSVR is used to start servers associated with IBM i Access and i Access Client Solutions.
STRTCPSVR is used, in general, to start servers associated with TCP/IP like FTP, Telnet, etc. Except the HTTP Server which is started via the Web Administration site at http://<server>:2001.
Additionally to the answer from #jmarkmurphy:
You can easily check netstat *cnn for open ports.
There is actually a tcpsvr named *ddm but that isn't used with ODBC.
ODBC-Access only needs host server *database. There aren't any further requirements for host servers.
For checking which services are started at tcp startup time, use strfdu, option 5 with the file qusrsys/qatocstart. From there you can easily view and change what should be started and what not.
Finally, I got connected by using JDBC. The summary of what I found is as follows:
ODBC seems using DRDA(port 446) but the server does not have DRDA/DDM service
OLEDB seems connecting Data Access(port 8471) but issued unknown error
JDBC also connection Data Access(port 8471) and it worked!
The first error I encountered when using ODBC is "Remote port could not be resolved". What happened behind this seems as follows:
ODBC asked Server Mapper(port 449) to find DRDA port(it may change on a server)
Server Mapper could not find DRDA port because the server has no DRDA service
ODBC showed "port not resolved" error
Then, I tried OLEDB this time. It checked user/password correctly but issued unknown error. When I put incorrect password, it showed "password is incorrect", which means OLEDB successfully log on to the server but got some error after sign on.
The last, I used JDBC and successfully connected! Generally, the connection url is like "jdbc:as400://" but it showed error. Using trace of JDBC, it seems to have problem on sign on to the server. So I changed the url to "jdbc:as400://:8471", then I finally connected. Looking into trace, it directly access to port 8741 and send user/password and get connected. I don't know the detail, but it worked!
Appreciated for your help!