how to automate druid batch ingestion job? - druid

I’m setting up Druid on an EMR cluster and successfully ingesting parquet files from an gcs bucket using Batch Ingestion.
Now, I wanted to automate this ingestion process to run everyday for a different file (in the same s3 bucket) with the same configuration. Is this possible? Or would I need to manually do it everyday.

It is not possible to create a job which is scheduled daily within druid. However, you can create your task and submit it daily using (for example) a cronjob.
Sending a query to druid is nothing more then executing an HTTP request. So if you make sure that the files are located at the same location every day, you should be able to automate this very easily.
curl -X 'POST' -H 'Content-Type:application/json' -d #/path/to/your/task.json https://url-to-druid.com/druid/indexer/v1/task

Working example for ingestion.
add the below in a php file and schedule the file to call the file every X hours
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<druid_public_url>/druid/indexer/v1/task',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>file_get_contents($json_file_path),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>

Related

Perl Search::Elasticsearch doesn't work with SSL enabled node with Self-signed certificate

I am using Perl wrapper for Elasticsearch: "Search::Elasticsearch"
I create an object as follows:
use Search::Elasticsearch;
my $e = Search::Elasticsearch->new( nodes => "192.168.0.66:9200", debug => 1);
It works fine and I can query Elasticsearch node using this object. Then I try to connect towards an Elasticsearch node that is enabled for SSL using self-signed certificate. I use the following command:
use Search::Elasticsearch;
my $e = Search::Elasticsearch->new( nodes => "192.168.0.66:9200", use_https => 1, userinfo => "testuser:testpwd", debug => 1);
But it doesn't work.
If I do curl to query Elasticsearch, I use the following command:
curl https://testuser:testpwd#192.168.0.67:9200
This also doesn't work. When I use -k switch with curl:
curl https://testuser:testpwd#192.168.0.67:9200 -k
Then it works fine. I get response from Elasticsearch node.
Now I want to use the same procedure to query same SSL enabled Elasticsearch node using Perl module: Search::Elasticsearch. What is the right syntax and how and where to define '-k' switch?
Using -k is synonym to --insecure so curl doesn't verify the certificate. The question is then, how useful is it to query over an encrypted SSL channel while allowing insecure connections?
That kind of defeats the purpose of using SSL in the first place, right?
If you have the CA that signed the certificate (which you should), then you should use it with the --cacert curl switch
curl --cacert /path/to/cacert.pem https://testuser:testpwd#192.168.0.67:9200
or with Perl you can also specify the CA cert in the ssl_options
use Search::Elasticsearch;
use IO::Socket::SSL;
my $es = Search::Elasticsearch->new(
nodes => [
"192.168.0.66:9200"
],
userinfo => "testuser:testpwd",
debug => 1,
ssl_options => {
SSL_verify_mode => SSL_VERIFY_PEER,
SSL_ca_file => '/path/to/cacert.pem',
SSL_verifycn_scheme => 'http',
}
);

TYPO3 v9 using Microsoft SQL Server 2016

PHP 7.3
pdo_sqlserver_73_nts (installed)
sqlserver_73_nts (installed)
I'm trying to connect a new install of TYPO3 (v9.5.7) to an instance of SQL Server 2016 running on the same box.
I'm able to establish a connection to the database, using the example from php.net: https://www.php.net/manual/en/function.sqlsrv-connect.php so I'm confident the server is accessible.
A similar question has been asked for v8 here Install TYPO3 8.7.7 with SQL Server on IIS and it's recommend that you ammend the DB settings in LocalConfiguration when the installer is at stage 2 and essentially "trick" the installer to connect to SQL Server.
I've done that and for some reason it won't connect,
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf-8',
'dbname' => 'typo3_db',
'driver' => 'sqlsrv',
'host' => 'localhost',
'password' => 'password',
'port' => 1433,
'user' => 'username',
],
],
],
Is there anything wrong with this connection string? I can't seem to find any other working example.
Thanks as always,
i had the same problem.
Try to set the full name of your mssql server:
'host' => 'COMPUTERNAME/DBNAME',

Uber API issue : Getting error while using this code. SSL certificate self signed certificate in certificate chain

I am new to Uber API, I just started exploring the Uber API's.
I have downloaded the complete Uber API repository from https://github.com/stevenmaguire/uber-php/issues/17
I have downloaded the complete repository using the composer. It shows that all dependencies were downloaded successfully. but when I am using the API, I am getting this error
Blockquote"SSL certificate problem: self signed certificate in certificate chain"
Please help me in this, I have raised this issue 8 days back on the Github no one is replied.
Here is my code
Thanks in Advance.
Rakesh
Here is my code`
<?php
require __DIR__ . '/vendor/autoload.php';
$client = new Stevenmaguire\Uber\Client(array(
'access_token' => '********',
'server_token' => '********',
'use_sandbox' => false, // optional, default false
'version' => 'v1.2', // optional, default 'v1.2'
'locale' => 'en_US', // optional, default 'en_US'
));
$products = $client->getProducts(array(
'latitude' => '41.85582993',
'longitude' => '-87.62730337'
));
var_dump($products);
?>
`

PayPal Rest API Curl SSL : unable to get local issuer certificate

I am working on PayPal Express checkout restapi service.
I complated successfully at sandbox mode but when trying go online curl returns "unable to get local issuer certificate" error. At sandbox i dont get this error.
What i tried!
I tried bind cert file (Latest one from mozilla) in php.ini and curl parameter but nothing change.
Currently my code like this
//Building our NVP string
$request = http_build_query($requestParams + $params);
//cURL settings
$curlOptions = array (
CURLOPT_URL => https://api-3t.paypal.com/nvp,
CURLOPT_VERBOSE => 1,
CURLOPT_SSL_VERIFYPEER => 1,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CAINFO =>'certs/cacert.pem', //CA cert file
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $request
);
$ch = curl_init();
curl_setopt_array($ch,$curlOptions);
Where i am failing ?
Note: I already got API Signature for LIVE from
https://www.paypal.com/us/cgi-bin/webscr?cmd=_get-api-signature
I fixed problem.
Mozilla's certs is failing on live edition.
When i used Facebook's cert it fixed.

With email parameter , which ends with dot com, can't get Result from Restful Web Service by using Perl LWP

I want to use perl with Module LWP to get the XML info from Restful Webservice.
Here is the Code:
my $ua = LWP::UserAgent->new;
$ua->proxy(['http','https'],'http://proxy:3128');
$ua->default_header('Accept-Charset'=>'utf-8');
$ua->default_header('Accept'=>'application/*********; version=1');
my $url= 'https://user:password#mailbox.********.net/mailboxes/?emailaddress=name#domain.net';
print Dumper($ua->get($url));
It works always good for all the email address like .eu, .org or .net, except for the email address ends with .com. (For example: name#domail.com)
The error message is:
The following error was encountered while trying to retrieve the URL:
https://user#mailbox.******.net/mailboxes/?
Access Denied.
Access control configuration prevents your request from being allowed at this time.
Please contact your service provider if you feel this is incorrect.
Your cache administrator is *****#**.**
The corresponded Response HEAD:
'_headers' => bless( {
'connection' => 'close',
'client-response-num' => 1,
'date' => 'Wed, 19 Nov 2014 15:53:45 GMT',
'x-squid-error' => 'ERR_ACCESS_DENIED 0',
'client-peer' => '****:3128',
'content-length' => '3502',
'client-date' => 'Wed, 19 Nov 2014 15:53:45 GMT',
'content-type' => 'text/html',
'mime-version' => '1.0',
'title' => 'ERROR: The requested URL could not be retrieved',
'server' => 'squid/3.1.12',
'x-cache' => 'MISS from proxy',
'x-cache-lookup' => 'NONE from proxy:3128'
}, 'HTTP::Headers' ),
I have tested with SoapUI and curl, they didn't meet this problem. That means .com works also with SoapUI and cuil. Only in perl with LWP, it gets problem.
Anyway when I added a dummy parameter like
https://**/mailboxes/?emailaddress=name#domain.com&foo=bar at the end of the link, it works.
I have no idea, if it's a bug in LWP or maybe some incompatible issue between LWP and Proxy Setting.
Access Denied.
Access control configuration prevents your request from being allowed at this time.
Please contact your service provider if you feel this is incorrect.
...
'x-squid-error' => 'ERR_ACCESS_DENIED 0',
There is an ACL in the proxy you use which denies your request.
If you have access to the proxy configuration check there, otherwise contact you cache administrator with your problem.