FlyData Sync
Amazon Redshift Setting
Amazon Redshift Tips

FlyData Sync Agent Usage

The following is documentation and use cases for the FlyData Agent. This specific article is for a FlyData Agent is for version 0.6 and higher.  If you are using FlyData Sync Direct (There is no install URL on your FlyData Console Dashboard), you do not need to perform the operational commands below.

General Functionality

$ flydata start

This command will start the FlyData Agent. If there are any un-synced tables, it will bring up a prompt to run an initial sync for all the new tables. If you have an unfinished initial sync which has been interrupted in the middle, this command resumes the initial sync.

$ flydata stop

This command will stop the FlyData Agent completely.

$ flydata restart

This command will stop the FlyData Agent and start it again. If there are any un-synced tables, it will bring up a prompt to run an initial sync for new tables.

$ flydata status

This will print out whether or not the FlyData Agent is running.

$ flydata version

This will print out the version of the FlyData Agent.

$ flydata sync:generate_table_ddl

This command will print the SQL necessary to create any new tables. It will also create FlyData specific tables if it is your first time running the command. We recommend piping this into a file and running the resulting file on your Redshift cluster.

$ flydata sync:generate_table_ddl table1 table2

This command will print the SQL necessary to create the tables listed only. We recommend piping this into a file and running the resulting file on your Redshift cluster.

$ flydata sync:generate_table_ddl --all-tables

This command will print the SQL necessary to create all tables as well as FlyData specific tables. We recommend piping this into a file and running the resulting file on your Redshift cluster.

$ flydata sync:reset --all

This command will reset your sync completely and stop the FlyData Agent. Contact us if this is run.

$ flydata sync:reset table1 table2

This command will reset your sync for the listed tables and stop the FlyData Agent. Contact us if this is run.

$ flydata sync:reset --init

This command will reset your unfinished initial sync and stop the FlyData Agent. This command resets only those tables being initial-synced and does not affect other tables already synced. Contact us if this is run.

$ flydata sync:flush

This will flush out your current buffer and stop your FlyData agent.

Additional tips

Add tables

At one point, you may want to add more tables to sync. To do this follow these steps:

  1. Log into our console and add another table to your data entry

  2. Stop the FlyData Agent by running:

    $ flydata stop
    
  3. Enter all the tables separated by a space. This will generate a query to create the new tables on your Redshift cluster. Run the resulting SQL on your Redshift cluster.

    $ flydata sync:generate_table_ddl > create_new_table.sql
    
  4. Enter all the tables, separated by a space. This will start the initial synchronization of these specific tables. After this has finished, we will continually upload updates from all of your registered tables to your Redshift cluster.

    $ flydata start
    

Change your Redshift table keys

Upon generation of the table creation sql via flydata sync:generate_table_ddl, there will be no distkeys or sortkeys auto assigned for you. You will have to modify the resulting SQL to change or modify the keys. However, if the table has already been created, you can follow these steps to modify your table:

  1. Flush the FlyData Agent buffer so no old data will be sent to our servers

    $ flydata sync:flush
    
  2. Will generate the SQL to create the table for your table named “test_table”.

    $ flydata sync:generate_table_ddl test_table
    
  3. Run a query similar to this on your Redshift cluster. Keep in mind, the “CREATE TABLE” query will be the query that needs to be changed to include the distkey and sortkeys.

    mysql> ALTER TABLE test_table RENAME TO old_test_table; 
    
  4. Will start the FlyData Agent again and resume data flow

    $flydata start