Migrate Ambari Metrics data

Use the following steps to migrate data from the previous AMS schema to the new AMS schema.

  1. Ensure the Ambari Metrics System is started. If it is not, in the Ambari Web UI, click Ambari Metrics, then select Actions > Start.
  2. SSH into a host that is running a Metrics Collector. You can locate this host by going to the Ambari Web UI and clicking Hosts. Click on the Filter icon and type in "Metrics Collector: All" to find each host that has a Metrics Collector installed on it.
  3. SU to the Ambari Metrics user. This is 'ams' by default, but if you don’t know which user is configured in your cluster go to the Ambari Web UI and click Cluster Admin > Service Accounts, and then look for Ambari Metrics User. # su ams
  4. Run the command to migrate data from the old Ambari Metrics schema to the new.
    $ /usr/sbin/ambari-metrics-collector --config /etc/ambari-metrics-collector/conf/ upgrade_start /etc/ambari-metrics-collector/conf/metrics_whitelist
    /usr/sbin/ambari-metrics-collector --config /etc/ambari-metrics-collector/conf/ upgrade_start /etc/ambari-metrics-collector/conf/metrics_whitelist "365"
    "365" is the amount of days to be preserved and stands for 1 year.
  5. After the upgrade process has started, logs are available in the <ams-log-dir>/ambari-metrics-migration.log file.

Migrate data from the old Ambari Metrics schema to the new, migrating metric records that are matching the ones present in the whitelist file from the last 30 days

$ /usr/sbin/ambari-metrics-collector --config /etc/ambari-metrics-collector/conf/ upgrade_start /etc/ambari-metrics-collector/conf/metrics_whitelist

Migrate data from the old Ambari Metrics schema to the new, migrating all metric records from the last 365 days

$ /usr/sbin/ambari-metrics-collector --config /etc/ambari-metrics-collector/conf/ upgrade_start --allmetrics “365”