It's easy to sync your historical Segment data to Traitly if you use Redshift as your data warehouse...
First, you will need to have connected your live Segment data feed by creating a webhook within your Segment account and enabling the data feed. If you have already done this, please skip to the next paragraph. To do so, please sign in to your Traitly account and navigate to this page. If you have already created a live data feed connection, you will see the "Configure" button. Otherwise, click on the "Connect Segment" button and follow the on-screen steps.
In order to connect your Redshift warehouse to Traitly, you should create a Redhisft database user with read-only data access. To create a Redshift database user, you will first need to access your Redshift database. There are a number of ways to access your Redshift database, some of which are described here. If you are already up and running with Segment and Redshift, you should already have direct access to your Redshift database.
Create a Redshift user for Traitly
To create a Redshift user, connect to your Redshift database, and run the following commands in the order shown below:
CREATE USER traitly PASSWORD '<enter password>';
SELECT * from pg_user;
SELECT * FROM information_schema.tables
List all of the relevant schemas using the above command, and grant SELECT privileges to the user traitly for each schema, e.g.,
GRANT USAGE ON SCHEMA <insert schema name> TO traitly;
GRANT SELECT ON ALL TABLES IN SCHEMA <insert schema name> TO traitly;
ALTER DEFAULT PRIVILEGES IN SCHEMA <insert schema name> GRANT SELECT ON TABLES TO traitly;
Find the Redshift host and port
You will find the Redshift database host and port on your Redshift cluster page within your AWS account. Here's an example:
In this example, the Redshift database host is segment.cmoocmxp0pmm.us-east-1.redshift.amazonaws.com (drop the colon and port number from the "Endpoint" value). The database port is 5439.
Enter the database credentials
Once you have created a Redshift user for Traitly and set SELECT privileges, will you need to enter the following details on this page:
- Redshift database host
- Redshift database port (by default, this is 5439)
- The name of the Redshift database you wish to connect
- The name of the Redshift database user you created with read-only access
- The corresponding password for the Redshift database user
Whitelist Traitly IP addresses
Once you have entered and saved the above details within the Traitly platform, you must allow our servers to access your Redshift cluster. This is done by whitelisting one of Traitly's elastic IP addresses within the security group associated with your Redshift cluster. You should whitelist the IP addresses 22.214.171.124/32 and 126.96.36.199/32. The exact security configuration depends on whether you have an EC2-Classic or an EC2-VPC Redshift cluster setup. For more on this, see Segment's comprehensive guide.
Finally, you need to specify the name(s) of the Segment sources you wish to connect to the Traitly platform. Typically, user data comes from various separate sources, for example, your Web application and your mobile application. You should enter and save the relevant source names here.
We're always here to help. If you have any question, feel free to contact us at email@example.com