Moving FunnelFlux to another server
Zeno avatar
Written by Zeno
Updated over a week ago

NOTE: This guide pertains to FunnelFlux v2.0+ installations that use Clickhouse.

Here are the steps to follow to move FunnelFlux to another server.

  1. Set up the new server

  2. Export MySQL data from server A and import on B

  3. Update your DNS settings to point traffic to server B

  4. Export Clickhouse analytics data from server A and import on B

  5. Review, terminate server A

Set up a new server

You can set up your new server the same way you would do any FunnelFlux installation -- either using our scripts or DIY.

See our setup guide for Vultr and DigitalOcean, or our minimum requirements if doing it yourself.

We strongly recommend that you use a standalone server only running FunnelFlux, and avoiding things like cPanel, Plesk, etc. If using our scripts, use CentOS v7 x64.

Choosing other OS will result in issues (our scripts are specific to CentOS v7) and we will not fix these issues for you -- we aren't sysadmins for customers and you should keep things simple and easy if you do not yourself have the sysadmin experience.

You can get your license key and download FunnelFlux from your customer dashboard.

When setting up, we recommend you use the same DB name and password as you used on your previous install. You can find these details in the FunnelFlux root folder in includes\appConfig.php.

Once the server is set up you don't need to log in and do anything -- you are going to import and overwrite MySQL information anyway.

Export MySQL data from server A

You do not need to stop traffic on the original server at this stage.

On the original server, connect via SSH and run the following in console:

mysqldump --hex-blob ##DB_NAME## affiliate_networks campaign_funnel_connections campaign_funnel_nodes campaign_funnel_paths campaign_funnels campaigns code_snippets conditions domains meta page_categories pages rights_management stored_links stored_links_tags stored_links_visits tags traffic_filters traffic_source_categories traffic_source_url_params traffic_sources users visit_tags > dump.sql

Make sure to replace ##DB_NAME## with the name of the DB that FunnelFlux uses, as stated in includes\appConfig.php

This will dump an SQL file to your root folder. You can update the filename at the end of the command to specify a location e.g. /tmp/dump.sql

Now you need to download this file -- its probably not large, so can easily be downloaded via sFTP locally.

Connect to your second server, Server B, and upload the file.

Now on the second server you can ensure the DB for FunnelFlux is created (it will be if you have run the installation fully as usual), and can import this file with:

mysql -u root-p flux < dump.sql

This is where its key to use the same DB name between servers, so that the import overwrites the data in the database that the new server is actually using.

Now, if you go to your FunnelFlux login page, your old username/password will work, and on login you should see all your funnels, pages etc. but no analytics data.

Update your DNS settings

Now that your new server has your funnels and config, you can update your DNS settings to point to it, diverting traffic to it.

The moment you do this you should check links generated in the new system and confirm its all working as expected.

Importantly, we suggest you create a new funnel and generate links in that, which will be new and unique, and test those to 100% confirm you are routing through the new server effectively.

If you have live traffic running, you should get no downtime and will see analytics data appearing on the new server.

During this time, there is one issue that can arise -- postbacks can come to the new server for hits that do not exist, as they were created on the old.

This is unavoidable. You can upload conversions again later if you want to reconcile some missing conversions.

Now, you can export data from the old server to reconcile fully.

Export Clickhouse data from Server A

Now that you have all traffic going to server B, its time to dump the analytics data form server A.

This will usually be a lot more data than the MySQL dump, so will take longer.

On server A, we'd recommend checking that its not getting traffic first -- you can do this by, for example:

  1. Setting a new DNS record of old.domain.com --> old IP

  2. Going to your members dashboard in Amember and detaching your license

  3. Logging in to the old tracker via old.domain.com

  4. Now use reporting to check if its receiving new visits. Just group by e.g. 15 minute blocks and see if the most recent ones have no data.

  5. If fine, you can detach your license again and log in to the new tracker to re-attach it to the normal domain

At this point you can dump data from Clickhouse.

If you want to be safe, you can disable Nginx to prevent any new requests/data coming in with:

service nginx stop

Or the appropriate command for your server environment.

Then, do the following command:

clickhouse-client --port=9001 --password=##### --query="select * from ff_events format TabSeparated" > /tmp/ch-dump.tsv

Be sure to replace password with your actual Clickhouse DB password found in includes/appConfig.php in the FunnelFlux folder.

This will take some time and will dump data to the TSV file produced.

Now, this file could be large. How you import it on the new server is up to you, but we'd recommend moving it to a public HTML location, e.g.

mv /tmp/ch-dump.tsv /usr/share/nginx/html/ch-dump.tsv

In our usual servers set up by FF scripts, /usr/share/nginx/html is the web root folder with FunnelFlux files.

Now, you could download the file directly from https://old.domain.com/ch-dump.tsv

Likewise, you can log into the new server and execute:

cd /tmp
wget https://old.domain.com/ch-dump.tsv

Hopefully this should download the file, which will take some time.

Once complete, you can import it into the current Clickhouse installation:

cat /tmp/ch-dump.tsv | clickhouse-client --port=9001 --password=#### --query="insert into ff_events format TabSeparated"

On completion, you can log in and refresh your dashboard, and should see all old data.

Cleanup

Lastly, you should delete /tmp/ch-dump.tsv after import.

Your old server can ultimately be decommissioned, but we would recommend keeping it for several days, as if you encounter any issues, you can rollback to using it by just reverting DNS updates.

We would also recommend a snapshot of the old server be done before terminating it, just in case.

Did this answer your question?