Setting up storage on a separate disk

By default, all data is stored in the /var section.

For example you have a separate drive connected to /storage.

  1. Work from the root user
    sudo su
  2. Stop the recievers and DB
    fastor-stop
    fastor-db-stop
  3. Create directories in the /storage section
    mkdir /storage/qoestor
    mkdir /storage/qoestor/clickhouse
    mkdir /storage/qoestor/clickhouse-hot
    mkdir /storage/qoestor/clickhouse-cold
    mkdir /storage/qoestor/dump
  4. Copy tha data on the new drive
    cp -r /var/lib/clickhouse/* /storage/qoestor/clickhouse
    cp -r /var/lib/clickhouse-hot/* /storage/qoestor/clickhouse-hot
    cp -r /var/lib/clickhouse-cold/* /storage/qoestor/clickhouse-cold
    cp -r /var/qoestor/backend/dump/* /storage/qoestor/dump
  5. Change the folder owner /storage/qoestor/clickhouse
    chown -R clickhouse:clickhouse /storage/qoestor/clickhouse
    chown -R clickhouse:clickhouse /storage/qoestor/clickhouse-hot
    chown -R clickhouse:clickhouse /storage/qoestor/clickhouse-cold
  6. Delete the old directories
    rm -rf /var/lib/clickhouse
    rm -rf /var/lib/clickhouse-hot
    rm -rf /var/lib/clickhouse-cold
    rm -rf /var/qoestor/backend/dump
  7. Create simlinks
    ln -s /storage/qoestor/clickhouse /var/lib/clickhouse
    ln -s /storage/qoestor/clickhouse-hot /var/lib/clickhouse-hot
    ln -s /storage/qoestor/clickhouse-cold /var/lib/clickhouse-cold
    ln -s /storage/qoestor/dump /var/qoestor/backend/dump
  8. Check the links
    readlink -f /var/lib/clickhouse
    readlink -f /var/lib/clickhouse-hot
    readlink -f /var/lib/clickhouse-cold
    readlink -f /var/qoestor/backend/dump
  9. Start the DB
    fastor-db-restart
  10. Start the recievers
    fastor-restart