Member since
06-26-2015
511
Posts
137
Kudos Received
114
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1395 | 09-20-2022 03:33 PM | |
4045 | 09-19-2022 04:47 PM | |
2336 | 09-11-2022 05:01 PM | |
2455 | 09-06-2022 02:23 PM | |
3863 | 09-06-2022 04:30 AM |
08-26-2022
07:42 PM
1 Kudo
@nk20 , You can use the NiFi API to extract the current state of any stateful processor if you need this. See the example below for a PutFile processor: access_token=$(curl -k \
-X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'username=admin&password=supersecret1'
"https://localhost:8443/nifi-api/access/token")
curl -k \
-H "Authorization: Bearer $access_token" \
"https://localhost:8443/nifi-api/processors/dd24aaec-0182-1000-ffff-ffff9f128d94/state"
{
"componentState": {
"componentId": "dd24aaec-0182-1000-ffff-ffff9f128d94",
"stateDescription": "After performing a listing of files, the timestamp of the newest file is stored. This allows the Processor to list only files that have been added or modified after this date the next time that the Processor is run. Whether the state is stored with a Local or Cluster scope depends on the value of the <Input Directory Location> property.",
"clusterState": {
"scope": "CLUSTER",
"totalEntryCount": 0,
"state": []
},
"localState": {
"scope": "LOCAL",
"totalEntryCount": 6,
"state": [
{
"key": "id.0",
"value": "/tmp/hsperfdata_nifi/129",
"clusterNodeId": "420e540a-ccd6-4e7c-bc25-c572f503b338",
"clusterNodeAddress": "nifi1:8443"
},
{
"key": "id.0",
"value": "/tmp/hsperfdata_nifi/130",
"clusterNodeId": "00e23669-130f-4e12-8a26-be3ab95923d4",
"clusterNodeAddress": "nifi0:8443"
},
{
"key": "listing.timestamp",
"value": "1661567544049",
"clusterNodeId": "420e540a-ccd6-4e7c-bc25-c572f503b338",
"clusterNodeAddress": "nifi1:8443"
},
{
"key": "listing.timestamp",
"value": "1661567541525",
"clusterNodeId": "00e23669-130f-4e12-8a26-be3ab95923d4",
"clusterNodeAddress": "nifi0:8443"
},
{
"key": "processed.timestamp",
"value": "1661567544049",
"clusterNodeId": "420e540a-ccd6-4e7c-bc25-c572f503b338",
"clusterNodeAddress": "nifi1:8443"
},
{
"key": "processed.timestamp",
"value": "1661567541525",
"clusterNodeId": "00e23669-130f-4e12-8a26-be3ab95923d4",
"clusterNodeAddress": "nifi0:8443"
}
]
}
}
} Cheers, André
... View more
08-26-2022
07:27 PM
@FozzieN , You can do exactly what you're trying to achieve using standard NiFi processors and a schema to describe your data structure. Please see attached a flow example that replicates what you are doing without the need for scripting. This flow uses the following schema, set as a parameter: {
"type": "record",
"name": "MyData",
"fields": [
{ "name": "source_timestamp", "type": "string" },
{ "name": "signal", "type": "string" },
{ "name": "value", "type": "string" },
{ "name": "fecha_envio", "type": ["null", "string"], "default": null }
]
} Cheers, André
... View more
08-26-2022
07:06 PM
@FozzieN , Maybe if you uncomment the following if in your code it would help? if len(messages) > 0:
messages = json.dumps(messages)
outputStream.write(bytearray(messages.encode('utf-8'))) With that if commented out it will always send a message to Kafka even if there are no messages. Cheers, André
... View more
08-26-2022
06:55 PM
@yagoaparecidoti , The problem is that to generate a keytab for any principal you need to know the password for that principal. The HTTP/hostname principal probably already exists in your AD and has some unknown password. Without knowing that you would have to reset the principal password to be able to create a keytab for it. And if you reset its password you will invalidate any keytabs that already exist for that principal that other services may be using. Cheers, André
... View more
08-25-2022
05:07 PM
@Arash , It's likely that your flow is running on multiple nodes and each node is trying to process every file. When different nodes try to write the same file at the same time you get these errors. You can change your flow to use a List-Fetch pattern. The ListHDFS processor should run only on the primary node and the output of it (the list of files) can be load-balanced across the nodes so that each node will FetchHDFS different files. Cheers, André
... View more
08-25-2022
05:00 PM
@yagoaparecidoti What do you need the keytab with the HTTP principal for? André
... View more
08-14-2022
03:58 PM
1 Kudo
@totokogure , The EvaluateJsonPath that you added is extracting the $.hits array and storing it as an attribute. The next processor (SplitJson), does not even use that attribute, though. It extracts $.hits again from the flowfile content. The EvaluateJsonPath in this flow should be unnecessary. If you connected InvokeHTTP to SplitJson, things should work correctly. Cheers, André
... View more
08-14-2022
03:51 PM
1 Kudo
Hi @LorencH , I'm of the opinion that if security is a concern (as it should be for any deployment) you should never rely on the permissions that come within the tarball. Your deployment procedure, automated or not, should always extract the files and explicitly "chown" and "chmod" the appropriate files to set the desired ownership and permissions. I don't know of the reasons to eliminate the tarball, though. Cheers, André
... View more
08-11-2022
10:40 PM
@totokogure , I tested this on the same version of NiFi that you're using (1.17.0) and it worked fine for me. The sample content that you provided was split in 2 flowfiles. Cheers, André
... View more
08-11-2022
03:58 AM
@rafy Try this: ${DATE_TIME:toDate('yyyy-MM-dd HH:mm:ss.SSSSSSSSS'):format('dd/MM/yyyy HH:mm:ss.SSSSSS')} Cheers, André
... View more