...
For sample workflows of importing files from your STFP server, view Treasure Boxes.
Table of Contents | |
---|---|
|
|
Prerequisites
Basic knowledge of Treasure Data
Use the TD Console to create your connection
You can use TD Console to create your data connector.
Create a new connection
When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information.
Go to Catalog and search and select SFTP. Select Create.
...
Enter the required credentials for your remote SFTP instance. Set the following parameters.
Host: The host information of the remote SFTP instance, for example an IP address.
Port: The connection port on the remote FTP instance, the default is 22.
User: The user name used to connect to the remote FTP instance.
Authentication mode: The way you choose to authenticate with your SFTP server.
Secret key file: Required if 'public / private key pair' is selected from `Authentication Mode`. (The key type ed25519 is not supported but the ecdsa key type is supported.)
Passphrase for secret key file: (Optional) If required, provide a passphrase for the provided secret file.
Retry limit: Number of times to retry a failed connection (default 10).
Timeout: Connection timeout in seconds (default 600).
...
Select Continue after entering the required connection details. Name the connection so you can easily find it later should you need to modify any of the connection details. Note: If you would like to share this connection with other users in your organization, check the Share with others
checkbox. If this box is unchecked this connection is visible only to you.
Select Create Authentication to complete the connection. If the connection is a success, then the connection you just created appears in your list of authentications with the name you provided.
Transfer data into Treasure Data.
Before using this connector, determine valid protocols for your environment. If you intend to SFTP, you can use this Data Connector for SFTP. If FTP/FTPS, try connect with FTP Data Connector.
If you are using a firewall, check your accepted IP range/port. Server administrators sometimes change the default port number from TCP/22 for security reasons.
Be sure that your private key has an OpenSSH format. We don’t support other formats like “PuTTY”.
We do not support the default format of the private key after OpenSSH 7.8. Re-generate the key using '-m PEM' option.
After installation and configuration, review the job log. Warning and errors provide information about the success of your import. For example, you can identify the source file names associated with import errors.
Use the TD Console to Create your Connection
You can use TD Console to create your data connector.
Create a new connection
When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information.
Go to Catalog and search and select SFTP. Select Create.
...
Enter the required credentials for your remote SFTP instance. Set the following parameters.
Host: The host information of the remote SFTP instance, for example an IP address.
Port: The connection port on the remote FTP instance, the default is 22.
User: The user name used to connect to the remote FTP instance.
Authentication mode: The way you choose to authenticate with your SFTP server.
Secret key file: Required if 'public / private key pair' is selected from `Authentication Mode`. (The key type ed25519 is not supported but the ecdsa key type is supported.)
Passphrase for secret key file: (Optional) If required, provide a passphrase for the provided secret file.
Retry limit: Number of times to retry a failed connection (default 10).
Timeout: Connection timeout in seconds (default 600).
...
Select Continue after entering the required connection details. Name the connection so you can easily find it later should you need to modify any of the connection details. Note: If you would like to share this connection with other users in your organization, check the Share with others
checkbox. If this box is unchecked this connection is visible only to you.
Select Create Authentication to complete the connection. If the connection is a success, then the connection you just created appears in your list of authentications with the name you provided.
Transfer Data into Treasure Data.
Get Now that you have created the connection to your remote SFTP instance, the next step is getting the data from your SFTP server into Treasure Data. You can set up an ad hoc one time transfer or a recurring transfer at a regular interval. In this section, you specify Specify source details as described in the following steps.:
...
Enter SFTP Server
...
Details
Provide the details of the database and table that you want to ingest data from.
...
Mode: Append – Allows you to add records into existing table.
Mode: Replace – Replace the existing data in the table with the data being imported.
Partition key Seed: Choose the long or timestamp column that you would like to use as the partitioning time column. If you do not specify a time column, the upload time of the transfer is used in conjunction with the addition of a
time
column.
...
Data Transfer Frequency
You can choose to run the transfer only one time or schedule it to run on a given frequency of your choosing.
...
If you need to review the transfer you have just completed for other data connector jobs, you can view a list of your transfers in the My Input Transfers
section. You can also edit the details of data transfers.You can use the Jobs or the Sources section to monitor the progress of your data transfer.
Appendix
...
Use the CLI to Configure the Connector
You can also use the FTP data connector from the command line interface. The following instructions show you how to import data using the CLI.
...
Code Block |
---|
$ td --version
0.11.10
|
Create Seed Config File (seed.yml)
Prepare seed.yml as shown in the following example, with your SFTP details. We support two authentication methods: Public / Private Key Pair, and Password.
...
Public
...
and Private Key Pair Authentication
Create seed.yml with the following content.
...
`secret_key_file` requires OpenSSH format. |
...
Password Authentication
Create seed.yml with the following content.
...
Code Block |
---|
$ td connector:issue load.yml --database td_sample_db --table td_sample_table |
Scheduled
...
Execution
You can schedule periodic Data Connector execution for incremental SFTP file import. We configure our scheduler carefully to ensure high availability. By using this feature, you no longer need a crondaemon on your local data center.
...
On the second and on subsequent runs, it imports only files that comes after the last path in alphabetical (lexicographic) order. (path/to/sample_201506.csv.gz
, …)
Create the
...
Schedule
A new schedule can be created using the td connector:create command. The following are required: the name of the schedule, the cron-style schedule, the database and table where the data will be stored, and the Data Connector configuration file.
...
You can specify file import mode in out section of seed.yml.
append (default)
This is the default mode and records are appended to the target table.
Code Block |
---|
in:
...
out:
mode: append
|
replace (In td 0.11.10 and later)
This mode replaces data in the target table. Note that any manual schema changes made to the target table will remain intact with this mode.
Code Block |
---|
in:
...
out:
mode: replace
|
FAQ for the SFTP Data Connector
I can’t connect to my SFTP server, what can I do?
Check what is valid protocol. If you intend to SFTP, you can use this Data Connector for SFTP. If FTP/FTPS, try connect with FTP Data Connector.
If you are using a firewall, check your accepted IP range/port. Server administrators sometimes change the default port number from TCP/22 for security reasons.
Be sure that your private key has an OpenSSH format. We don’t support other formats like “PuTTY”.
We do not support the default format of the private key since OpenSSH 7.8. Please re-generate the key using '-m PEM' option.
How do I troubleshoot data import problems?
...
.yml.
append (default)
This is the default mode and records are appended to the target table.
Code Block |
---|
in:
...
out:
mode: append
|
replace (In td 0.11.10 and later)
This mode replaces data in the target table. Note that any manual schema changes made to the target table will remain intact with this mode.
Code Block |
---|
in:
...
out:
mode: replace
|