Set up the DB extractor
Follow the steps below to set up the extractor.
Before you start
- If the database you're connecting to requires the extractor to use ODBC, make sure to download and install the ODBC drivers for your database .
ヒント
Navigate to Data management > Integrate > Extractors > Cognite DB extractor in CDF to see all supported sources and the recommended approach.
- Check the server requirements for the extractor.
- Create a configuration file according to the configuration settings. The file must be in YAML format.
Connect to a database
Native
The extractor has native support for some databases, and don't require any additional drivers.
ODBC
To connect via ODBC, you must install an ODBC driver for your database system on the machine where you're running the extractor.
Here's a list of links to ODBC drivers for some source systems:
Consult the documentation for your database or contact the vendor if you need help finding ODBC drivers.
ODBC connection strings
ODBC uses connection strings to reference databases. The connection strings contain information about which ODBC driver to use, where to find the database, sign-in credentials, etc. See Connection strings for examples.
Set up a Data Source Name (DSN)
We recommend setting up a DSN for the database if you're running the extractor against an ODBC source on Windows. Then, the Windows DSN system handles password storage instead of keeping it in the configuration file or as an environment variable. In addition, the connection strings will be less complex.
To set up a DSN for your database:
- Open the ODBC Data Sources tool on the machine you're running the extractor from.
- Select Add and the ODBC driver you want to use. In this example, we're configuring a PostgreSQL database:
-
Select Finish.
-
Enter the connection information and the database name. Note that the image below may differ depending on which database type you are configuring a DSN for.
-
Select Test to verify that the information is correct, then Save.
-
Use the simplified connection string in your configuration file:
databases:
- name: my-postgres
connection-string: 'DSN=MyPostgreSQL'
Run as a Windows standalone executable file
- Download the dbextractor-standalone-{VERSION}-win32.exe file via the download links available from the Cognite DB extractor section on the Extract data page in the Cognite Data Fusion (CDF) user interface.
- Save the file in a folder.
- Open a command line window and run the file with a configuration file as an argument.
In this example, the configuration file is named config.yml and saved in the same folder as the executable file:
dbextractor-standalone-<VERSION>-win32.exe ./config.yml
Run as a Windows service
-
Download the dbextractor-service-{VERSION}-win32.exe file via the download links available from the Cognite DB extractor section on the Extract data page in the CDF user interface.
-
Save the file to the same directory as a configuration file named config.yml. This must be the exact name of the file.
-
As an administrator, open up the command line window in the folder you placed the executable file and the configuration file and run the following command:
> .\dbextractor-service-<VERSION>-win32.exe install -
Open the Services app in Windows and find the Cognite DB Extractor Executor service.
-
Right-click the service and select Properties.
-
Configure the service according to your requirements.
Run as a Docker container
Use a Docker container to run the DB extractor on Mac OS or Linux systems. This article describes how to create file-specific bindings with the container. You should consider sharing a folder if a deployment uses more than one file, for example, logs and local state files.
Step 1: Set up the Docker container
-
Create a Docker image containing the ODBC drivers for the database systems you want to extract data from. This example uses a PostgreSQL database.
-
Create a Docker file:
FROM cognite/db-extractor-base:2.5.0
-