- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
NIFI exceute script : Not reading the psql password
- Labels:
-
Apache NiFi
Created ‎03-27-2017 03:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created ‎03-29-2017 03:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An alternative to using an environment variable is to use the file-based Variable Registry, where you could create a file perhaps called var_registry.properties with the entry
PGPASSWORD=<my_pg_password>
And edit conf/nifi.properties to use that file for the registry:
nifi.variable.registry.properties=var_registry.properties
Then you could use PGPASSWORD in your groovy script the same way you'd use an environment variable:
${PGPASSWORD}
Created ‎03-29-2017 07:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure this environment variable is set for the NiFi user, and not just for the user you are ssh'd in as? A test for this would be to invoke a common system variable like USER and see what you get.
Created ‎03-29-2017 03:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An alternative to using an environment variable is to use the file-based Variable Registry, where you could create a file perhaps called var_registry.properties with the entry
PGPASSWORD=<my_pg_password>
And edit conf/nifi.properties to use that file for the registry:
nifi.variable.registry.properties=var_registry.properties
Then you could use PGPASSWORD in your groovy script the same way you'd use an environment variable:
${PGPASSWORD}
