Shiny app works locally and is able to query on redshift cluster with no issues.
The app itself connects to a redshift cluster and basically executes a query on button click.
I have tested using the package RJDBC and RPostgres and both seem to not work when deployed on EC2.
Both RJDBC and RPostgres results in the same error.
library(RJDBC)
# connect to Amazon Redshift use with RJDBC, driver has been downloaded to within /srv/shiny-server/app
driver <- JDBC("com.amazon.redshift.jdbc41.Driver", "./RedshiftJDBC41-1.1.9.1009.jar", identifier.quote="`")
url <- "jdbc:redshift://redshift host cluster info"
conn <- dbConnect(driver, url)
#if using RPostgres
library(RPostgres)
conn <- dbConnect(RPostgres::Postgres(), host="RSclust...", port="8080", dbname="db", user="dbuser", password="pass", sslmode='require')
The error I'm getting on chrome console is "2 message(s) discarded from buffer", but that doesn't tell me anything further. No error logs on /var/log/shiny-server
Attaching package: ‘DT’
The following objects are masked from ‘package:shiny’:
dataTableOutput, renderDataTable
Loading required package: DBI
Loading required package: rJava
When using a single file app.R instead of the above server.R/ui.R. The error messages are different and UI doesn't load as I have placed the connection part outside of the UI and Server sections.
Using RPostgres
Error: could not connect to server: Connection timed out
Is the server running on host "redshift.cluster" (168.0.0.0) and accepting
TCP/IP connections on port 8080?
Execution halted
I am assuming that port might be blocked or not opened? Again this works fine locally just not on EC2. Do I need to open up ports on the hosted EC2 server?
Using RJDBC. this is a new error as previous attempts did not run into this error which is weird
Error in dbConnect(driver, url) :
Unable to connect JDBC to jdbc:redshift://redshift.amazonaws.com:8080/dbname?user=user&password=pass&ssl=true
JDBC ERROR: [Amazon](500150) Error setting/closing connection: Connection timed out.
Calls: runApp ... dbConnect -> .local -> .verify.JDBC.result -> .verify.ex
Execution halted