# Transfer tracker to another server

# In which case the tracker is transferred

  1. Frequent critical failures of the current server on installed tracker.

  2. Unsuitable functionality and pricing system.

  3. Not enough disk space and no possibility to increase it at your current cloud provider.

  4. Need to change the data center of the server and save statistics.

  5. Need to make a duplicate, copy of a tracker for scaling funnels or testing new GEOs.

# The actual method of migrating a tracker to a new server

All commands are executed on the server to which you want to migrate.

  1. Log in to the server via SSH.

  2. Run the tracker installation script

curl keitaro.io/kctl.sh | bash -s -- install
1
  1. After the tracker will be installed — run screen
screen
1

Processes running inside the screen are not interrupted when the connection to the server is lost.

  1. Start data migration from the old server to the new one with the command
[SSH_PASSWORD=somepass] kctl transfers copy-from <OLD-SERVER-IP>
1

Where somepass is the ssh password to the old server, OLD-SERVER-IP is the IP address of the old server.

Example:

SSH_PASSWORD=123123 kctl transfers copy-from 111.12.19.19
1

If the server works with a specific port, use the command:

SSH_PORT=port SSH_PASSWORD=password kctl transfers copy-from s.e.r.v.e.r.i.p
1

Example:

SSH_PORT=3333 SSH_PASSWORD=123123 kctl transfers copy-from 111.12.19.19
1

If the access to the server from which you want to migrate is possible only with a key — add the key to the new server and run the script

SSH_PATH_TO_KEY="/path/to/my/ssh.private.key" kctl transfer copy-from OLD_SERVER_IP
1

All statistics and settings, including local landing pages, offers, user lists of bots, and user agents are transferred automatically.

  1. Go to your account on the website Keitaro.io, tab Licenses, and press Unlink for the license key that you want to bind to the new tracker. Then enter this key when logging in to the new tracker.

WARNING

Do not create campaigns, affiliate networks, and other entities in the new tracker until the migration process is complete. When the migration script finishes, the new tracker will contain only data from the old tracker.

TIP

Wait until the kctl transfer script finishes and start working with the new tracker.

# Creating an archive copy of the tracker locally

Create an archive copy of the tracker locally on the current server. Including MySQL data, ClickHouse data, system settings, local landing pages, salt, Postback key, SSL-certificates, filters, custom bot lists, etc.

  1. Run screen
screen
1

Processes running inside the screen are not interrupted when the connection to the server is lost.

  1. Run the command to create a dump
kctl transfers dump
1

WARNING

When creating a dump, it is important to pay attention to the terminal output — if there were errors in the process, they could affect the integrity of the dump. In the future, it will not be possible to restore the tracker in full from such a dump.

Data will be saved in /var/lib/kctl-transfers and available for downloading.

# FAQ

How to restore from dump.gz (dump.sql)?

To restore a tracker from a database dump, use the kctl-transfer command with the restore-from-sql local action, for example:

SALT=test kctl-transfers restore-from-sql local path/to/dump.gz
1

On creating a dump in phpmyadmin, the language of the panel must be English.

# Restoring tracker from an archive local copy

Restore the tracker from the local archive copy on the current server. Including MySQL data, ClickHouse data, system settings, local landing pages, salt, Postback key, SSL-certificates, filters, custom bot lists, etc.

kctl transfers restore
1

Data will be taken from /var/lib/kctl-transfers

# If the Installation Method is not Approved

  1. Create an SQL dump of the database on the old server
mysqldump keitaro | gzip > dump.sql.gz
1
  1. Copy the SQL dump archive to the new server.

  2. Save the SALT and POSTBACK_KEY values from var/www/keitaro/application/config/config.ini.php of the old server

  3. Run on the new server

SALT=yoursalt POSTBACK_KEY=yourkey kctl transfers restore-from-sql local <PATH_TO_SQL_DUMP>
1
  1. Copy to the new server from the old server the folder with the lendings var/www/keitaro/lander/.