connect laravel to AWS database and insert data (Connections error) - amazon-web-services

I search everywhere on internet but could not any tutorial regarding this, How can I connect I connect to AWS RDS database and RDS replica in laravel 8 and also want to know configurations.
.env file
DB_CONNECTION=mysql
DB_HOST=********.********.us-east-1.rds.amazonaws.com
DB_PORT=3306
DB_DATABASE=********
DB_USERNAME=********
DB_PASSWORD=********
got these error
SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
(SQL: select * from information_schema.tables where table_schema = ******* and table_name = migrations and table_type = 'BASE TABLE')
at C:\Users\DELL\kenduit\vendor\laravel\framework\src\Illuminate\Database\Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
1 C:\Users\DELL\kenduit\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
")
2 C:\Users\DELL\kenduit\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=*******.czdmmigxjpgh.us-east-1.rds.amazonaws.com;port=3306;dbname=********", "******", "******", [])

Related

AWS Appsync subscriptions - "Connection failed: Connection handshake error"

I am trying to make a simple subscription run on AWS amplify's appsync.
the subscription never fires and after about 30sec I get this error message when waiting for the sub in the appsync console:
Error: {
"errors": [
{
"message": "Connection failed: Connection handshake error"
}
]
}
at Object.error (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:859689)
at d (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:203:1070669)
at m (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:203:1071013)
at e.value (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:203:1072095)
at n.<anonymous> (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:679765)
at r (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:675841)
at Object.throw (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:675176)
at s (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:674969)
If I recreate the call from my browser I get this error:
WebSocket connection to 'wss://r23irwx4tndnjdfh7tlethffca.appsync-realtime-api.us-east-2.amazonaws.com/graphql?header=eyJBdXRob3JpemF0aW9uIjoiZXlKcmFXUWlPaUpTYWx3dlVEVkxOV2N5ZUd0blVXRXhWa3g2YmxVd1YwTmxZbnBsVFdsek4zZHpjelZ0Ym5SYVZrMVpUVDBpTENKaGJHY2lPaUpTVXpJMU5pSjkuZXlKemRXSWlPaUl3WldVNFlUZzVNUzB6TnpFeUxUUXhNekV0T1RsalpTMDFNelZrTTJVeE5UQmpaR0VpTENKbGRtVnVkRjlwWkNJNklqTXpZV1E0T1RneUxXUTBaalV0TkRCa09TMWlaRFl3TFdFNFpEWXlOelprTVRFellTSXNJblJ2YTJWdVgzVnpaU0k2SW1GalkyVnpjeUlzSW5OamIzQmxJam9pWVhkekxtTnZaMjVwZEc4dWMybG5ibWx1TG5WelpYSXVZV1...VSDNCYnJURTM5YmVWNEEzdW1JdGdPN0RjOVFCVkI2U09uX1ZJdVFvUElIOUZGNk10QzdtWTJLby0wQ19NTF9tSVAxdEFTVkNzSW5Zbjd4MWZzalFoUFpaS1J6MTFKbHJPdE5rOWNzOXVrd29yMU1iRGlBNklIOEJiaXIzSjNRNDlSckhXODZLM3RhQmNGSlphQVpnTEhKS05QajlBWWZhVHRNTnZnVmV4UUJhZzQ2cW5VZ3l1amF0SUMwamZ1Mk9LUUh1d2NNaGt6WjJjYlB6aWNwcG5kVk5aVVdnY1hzUlBadndFTzlENnZmZ3UyZTM0eHZXRW9mZld1RGh4LVc5Ui1HSEktbG1YTU4ydk9xd1RURTRxejdNM2Q3WGJvN3VyWUpsSHlGUUIxQSIsImhvc3QiOiJyMjNpcnd4NHRuZG5qZGZoN3RsZXRoZmZjYS5hcHBzeW5jLWFwaS51cy1lYXN0LTIuYW1hem9uYXdzLmNvbSJ9&payload=e30=' failed: Error during WebSocket handshake: net::ERR_SSL_PROTOCOL_ERROR
The only solution I found to this was to change my router...
Have no idea why it makes a difference, tried all the router setting I could think of
I used my home LTE WiFi router and kept getting this error, eventually changed to a local sim card-based router from my cell provider and it connected every time.
I have used this on many different models and works every time. The router which was failing was a Huawei B525 router, any other router doesn't give the issues...

Python smtp set up with gmail fails

try:
server = smtplib.SMTP("smtp.gmail.com:587")
server.ehlo()
except Exception as t:
print 'setup failed'
print t
Gives the error:
[Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
using socks and setting a proxy fixed the issue

Amazon RDS: Fatal error encountered during command execution

I am getting this exception from my web application which is using Amazon RDS database.
It's giving error..
Fatal error encountered during command execution. It's random but frequent.
MySql.Data.MySqlClient.MySqlException: Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException: Fatal error encountered attempting to read the resultset. ---> MySql.Data.MySqlClient.MySqlException: Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Sitecore 8 5 update #5 exception on step4 (MongoDB exception)

I am trying to update Sitecore 8 update 4 to update 5, but via UpdateInstallationWizard.aspx I see an error in w3wp (iis) and wizard never done.
How to fix it ? I don't see any error.
Update
In the Sitecore log I see an exception related to MongoDB
ERROR Exception when executing agent processing/taskAgent Exception:
Sitecore.Analytics.DataAccess.DatabaseNotAvailableException Message:
Database not available Source: Sitecore.Analytics.MongoDB at
Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbCollection.HandleDatabaseException(ExceptionBehavior
exceptionBehavior, Exception ex) at
Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbCollection.Execute(Action
action, ExceptionBehavior exceptionBehavior) at
Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbCollection.FindAndModify(IMongoQuery
query, IMongoSortBy sortBy, IMongoUpdate update, Boolean returnNew,
Boolean upsert) at
Sitecore.Analytics.Processing.MongoDbTaskStorageProvider.PickFirstExclusiveTask()
at Sitecore.Analytics.Processing.TaskQueue.TryGetNext(Guid
taskIdBoundary, ProcessingTask& workItem) at
Sitecore.Analytics.Processing.TasksAgent.Execute() at
Sitecore.Analytics.Core.BackgroundService.Run()
Nested Exception
Exception: MongoDB.Driver.MongoConnectionException Message: Unable to
connect to server localhost:27017: No connection could be made because
the target machine actively refused it 127.0.0.1:27017. Source:
MongoDB.Driver at
MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan
timeout, ReadPreference readPreference) at
MongoDB.Driver.Internal.DirectMongoServerProxy.ChooseServerInstance(ReadPreference
readPreference) at
MongoDB.Driver.MongoServer.AcquireConnection(ReadPreference
readPreference) at
MongoDB.Driver.MongoCollection.RunCommandAs[TCommandResult](IMongoCommand
command, IBsonSerializer resultSerializer, IBsonSerializationOptions
resultSerializationOptions) at
MongoDB.Driver.MongoCollection.RunCommandAs[TCommandResult](IMongoCommand
command) at
MongoDB.Driver.MongoCollection.FindAndModify(IMongoQuery query,
IMongoSortBy sortBy, IMongoUpdate update, IMongoFields fields, Boolean
returnNew, Boolean upsert) at
MongoDB.Driver.MongoCollection.FindAndModify(IMongoQuery query,
IMongoSortBy sortBy, IMongoUpdate update, Boolean returnNew, Boolean
upsert) at
Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbCollection.<>c__DisplayClass2c.b__2b()
at
Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbCollection.Execute(Action
action, ExceptionBehavior exceptionBehavior)
Nested Exception
Exception: System.Net.Sockets.SocketException Message: No connection
could be made because the target machine actively refused it
127.0.0.1:27017 Source: System at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress) at
System.Net.Sockets.Socket.Connect(EndPoint remoteEP) at
System.Net.Sockets.TcpClient.Connect(IPEndPoint remoteEP) at
MongoDB.Driver.Internal.MongoConnection.Open() at
MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer,
Int32 requestId) at
MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage
message) at
MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection
connection) at
MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.Connect() at
MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan
timeout, ReadPreference readPreference)
I don't use any MongoDb, but I use SOLR in a project.
From the error it looks like you need to have a valid MongoDB service running. See this SO Question:
Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061
and
problem with mongoDB
If you are not running the xDB have you made sure it is disabled according to this guide? https://kb.sitecore.net/articles/296641
As per the upgrade guide you should be disabling analytics while upgrading.
Please disable Analytics first and then try to apply the update.

Could not write message to OutputStream: com.ctc.wstx.exc.WstxIOException: Connection timed out

I am getting this error when we move our database to new server. The application at the new server and the database at older server runs fine. But when we move the database to new server the server log shows this error.
Below is the server log. We are using jboss-5.1.0.GA.
2013-02-22 01:02:31,336 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/]] (main) StandardWrapper.Throwable
org.springframework.ws.soap.saaj.SaajSoapMessageException: Could not write message to OutputStream: com.ctc.wstx.exc.WstxIOException: Connection timed out: connect; nested exception is javax.xml.soap.SOAPException: com.ctc.wstx.exc.WstxIOException: Connection timed out: connect
at org.springframework.ws.soap.saaj.SaajSoapMessage.writeTo(SaajSoapMessage.java:169)