Member since
01-18-2016
163
Posts
32
Kudos Received
19
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1377 | 04-06-2018 09:24 PM | |
1399 | 05-02-2017 10:43 PM | |
3836 | 01-24-2017 08:21 PM | |
23544 | 12-05-2016 10:35 PM | |
6449 | 11-30-2016 10:33 PM |
04-26-2016
07:59 PM
Really weird, but I'm glad you got it worked out. Cheers
... View more
04-26-2016
07:50 PM
Hi @Sunile Manjee. That's weird. I just followed those instructions and it worked and all was there. I think you may have been looking at different instructions. It says to work with this directory: /usr/local/solr_for_audit_setup. Did your steps start with this? wget https://issues.apache.org/jira/secure/attachment/12761323/solr_for_audit_setup_v3.tgz -O /usr/local/solr_for_audit_setup_v3.tgz
cd /usr/local
tar xvf solr_for_audit_setup_v3.tgz
cd /usr/local/solr_for_audit_setup
After editing the install.properties file, you run ./setup.sh and then execute this: /opt/solr/ranger_audit_server/scripts/add_ranger_audits_conf_to_zk.sh: That just uploads the config set to Zookeeper. The Create script you were looking for should be this one (not in the path you originally looked at):
/opt/solr/ranger_audit_server/scripts/create_ranger_audits_collection.sh Here is all that it does. curl --negotiate -u : "${SOLR_HOST_URL}/solr/admin/collections?action=CREATE&name=${COLLECTION_NAME}&numShards=${SHARDS}&replicationFactor=${REPLICATION}&collection.configName=$CONF_NAME&maxShardsPerNode=100"
... View more
04-26-2016
04:29 PM
Any luck with that @Sunile Manjee? It must have been moved from the install guide you are looking at. These instructions ^^^^ create a template and once you follow the instructions will create the script.
... View more
04-25-2016
06:58 PM
I posted a script for this above.
... View more
04-25-2016
06:56 PM
Thanks, @Zaheer N. FYI, one final option I'll throw out there is to use listFile (which was my original suggestion) and do a move/rename in Groovy. Here is a working groovy script in an ExecuteScript processor: import org.apache.nifi.controller.ControllerService
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
/*
WARNING!!! This will OVERWRITE any existing file in the destination directory
REQUIRED FLOWFILE PROPERTIES:
outDir - directory name where the files will go (e.g. /tmp/junk/outdir)
newFilename - what you want the file named (e.g. mynew.jpg)
changeFilenameAttr - optional boolean - default= 1, true or null sets origFilanem=${filename}
and filename=${newFilename}
value of false, 0 or n does not change the filename property.
Also requires filename and orig.filename. These come from the getFile processor.
Note - I wasn't able to getting properties defined in the ExecuteScript processor to work
with Nifi Expression Language (e.g. referencing a property X=${filename} resolved to '${filename}'
rather than the value of filename). The expressions were not evaluated for some reason.
*/
def flowFile = session.get()
if (!flowFile) return
log.info('*************** STARTING RENAME SCRIPT: ')
//*********
def origFilename = flowFile.getAttribute('filename')
def origPath = flowFile.getAttribute('absolute.path')
def sourceFilename = origPath + '/' + origFilename
def outDir = flowFile.getAttribute('outDir')
def newFilename = flowFile.getAttribute('newFilename')
def destFilename = outDir + '/' + newFilename
//*********
try {
log.info('*************** MOVING FILE: ' + sourceFilename + ' TO ' + destFilename)
def source = Paths.get(sourceFilename)
def dest = Paths.get(destFilename)
Files.move(source, dest, StandardCopyOption.REPLACE_EXISTING)
if (flowFile.getAttribute('changeFilename')?.value?.toBoolean) {
//This needs testing/verification
flowFile = session.putAttribute(flowFile, 'origFilename', origFilename)
flowFile = session.putAttribute(flowFile, 'filename', newFilename)
}
log.info('SUCCESSFULLY MOVED FILE: ' + sourceFilename + ' TO ' + destFilename)
session.transfer(flowFile, REL_SUCCESS)
} catch(e) {
log.error('FAILED moveFile.groovy: ' + sourceFilename + ' TO ' + destFilename, e)
session.transfer(flowFile, REL_FAILURE)
}
And, thanks @Shishir Saxena for testing the previous script out.
... View more
04-25-2016
03:00 PM
Awesome. Can you accept the answer if that works out for you to close this out? Cheers.
... View more
04-25-2016
01:52 PM
@Zaheer N Any luck? If you're having issues with either solution, let me know and I may be able to clarify. There were some details I left off in the first solution, particularly with the mergeContent (e.g. NumberOfMaxEntries=2, and I'm not sure what would happen if you have NumberOfMaxBins too low.).
... View more
04-25-2016
12:41 PM
Following the instructions on this page should resolve it: http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_Ranger_Install_Guide/content/solr_ranger_configure_solrcloud.html
... View more
04-21-2016
08:14 PM
@surender nath reddy kudumula - There is a JIRA actively being worked on to add Hive JDBC support to Nifi. https://issues.apache.org/jira/browse/NIFI-981
... View more
04-21-2016
07:29 PM
1 Kudo
@Zaheer N Below is a simpler way of doing what you want without the MergeContent processor, which makes the flow a lot easier. So, create an ExecuteScript processor, add a property "databaseConnectionPoolName" with the value of your database connection pool name (e.g. "MySQL-DBCPConnectionPool"). Now set the Script Engine to "Groovy" and add the script below either in a file or in "Script Body". Note that there is probably some more to do to make this solid code, but it does work. I know very little about Groovy. I based this on something on Matt
Burgess's site http://funnifi.blogspot.com/. @mburgess Let me know how it goes with either method or if you figure out something better. There's always a better way. import org.apache.nifi.controller.ControllerService
import groovy.sql.Sql
def lookup = context.controllerServiceLookup
def dbServiceName = databaseConnectionPoolName.value
def dbcpServiceId = lookup.getControllerServiceIdentifiers(ControllerService).find {
cs -> lookup.getControllerServiceName(cs) == dbServiceName
}
if (!dbcpServiceId) return
def conn = lookup.getControllerService(dbcpServiceId)?.getConnection()
try {
//flowFile = session.create() DO this if you want to create a NEW flowfile (losing content, etc)
def flowFile = session.get()
if (!flowFile) return
def sql = new Sql(conn)
def filenameBase = flowFile.getAttribute('filenameBase')
def rows = sql.rows("select val as myval from junk where k = $filenameBase")
//You may want to do something if the row is not found.
def newval = rows[0].myval
flowFile = session.putAttribute(flowFile, 'filename', newval)
session.transfer(flowFile, REL_SUCCESS)
} catch(e) {
log.error('MY ERROR!!! *******************', e)
session.transfer(flowFile, REL_FAILURE)
} finally {
conn?.close()
}
... View more
- « Previous
- Next »