Member since
03-20-2017
5
Posts
0
Kudos Received
0
Solutions
03-27-2017
03:04 PM
Hi, I have installed NIFI on EC2 instance where I am invoking PostgreSQL psql utility. When I invoke the following command from the EC2 instance, it works fine: psql --host=<AWS RDS host>--port=5432 --dbname=<DBname> --username=<DB user> --no-password --command="create database kiran_test_10"
This creates the database
But when I embed the same command in the groovy script and try to execute from the NIFI execute processor, it throws out "Error: psql: fe_sendauth: no password supplied" I have setup an environment variable PGPASSWORD on the EC2 instance. The psql command when executed on the EC2 instance is able to pick up the password but when executed from the NIFI execute script processor is not picking up the password. Do I need to configure environment variables differently on EC2 for NIFI to read them? Please let me know
... View more
Labels:
- Labels:
-
Apache NiFi
03-24-2017
04:06 PM
Hi, We are trying to work on a Proof Of Concept ( POC) to upload a file from an S3 bucket to RDS instance (in our case , it is Postgres) . I have uploaded the file on my local desktop using the execute script processor and using the psql copy command provided by postgresql. The psql command looks like this: import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import groovy.sql.Sql;
def file ="C:/Users/kdasari/Desktop/NIFI/files/kiran.csv DELIMITER ',' CSV HEADER"
def copyCommand = /psql --host=<AWS RDS> --port=5432 --dbname=<AWS DB name> --username=<AWS DB user> --no-password --command="copy kiran_test.poc_test from $file"/
println copyCommand
//run psql tool as an external process
def process = copyCommand.execute() I am trying to retrieve the flow file attributes (S3 file name ) and substitute in the groovy code "file" variable (see the code snippet above) , but with no success. I used fetchS3object processor followed by the executescript processor.After reading the NIFI documentation, I understand the execute processor has access to the process session and process context , I am unable to figure out how to instantiate the"file " variable in the groovy code. I am trying to understand the following: .FetchS3Object : It reads the content of the S3 file and updates the flowfile attribute filename . Is NIFI still pointing to the physical file in the S3 instance and just updates the flow file attributes. (or) Is NIFI, physically copying the file from S3 and placing it in the NIFI content repository . If so, will it retain the filename ? (In my example, it would be kiran.csv) How do I refer to the file in the subsequent processors? In my example above , how do I include NIFI file reference in the groovy code. Please let me know. Thanks, Kiran
... View more
Labels:
- Labels:
-
Apache NiFi
03-22-2017
03:52 PM
I am trying to execute postgres psql command from a NIFI instance installed on a AWS EC2 instance. I am using the grrovy script. I have installed the postgresql utility on EC2 instance using yum install postgres Then I execute the command using psql directly from ec2 instance psql --host=<RDS instance> --port=5432 --dbname=<dbname> --username=<master user> --no-password --command="create database kiran_test_2" This executes fine. I try the same on groovy console, it works fine. Please find the code below import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import groovy.sql.Sql;
def copyCommand = /psql --host=<AWS host> --port=5432 --dbname=<AWS DB> --username=<AWS user> --no-password --command="create database 2"/
def copyCommand = /psql --host=<AWS RDS instance> --port=5432 --dbname=<dbname> --username=<usrname> --no-password --command="create database kiran_test_1"/
println copyCommand
//run psql tool as an external process
def process = copyCommand.execute()
def out = new StringBuffer()
def err = new StringBuffer()
process.waitForProcessOutput(out, err) //wait for the process to finish
println "exit code: ${process.exitValue()}"
if (out.size()) {
println "Success: $out"
}
if (err.size()) {
println "Error: $err"
} But when I copy the in NIFI script body, it fails complaining "additional attribute database " and fails. Please advise. Thanks, Kiran
... View more
Labels:
- Labels:
-
Apache NiFi
03-20-2017
09:14 PM
I am trying to install NIFI on AWS redhat linux EC2 instance (instance type t2.mciro) . Iwas able to start the instance using ./nifi.sh start. But after few minutes it stops with an error message "ERROR [NiFi logging handler] org.apache.nifi.StdErr OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N" .Please advise.
... View more
Labels:
- Labels:
-
Apache NiFi