Move the Data Repository Data Directory

If necessary, you can move the Data Repository data directory from an existing location to another location on the same Vertica cluster.
If necessary, you can move the data repository data directory from an existing location to another location on the same Vertica cluster.
This process involves the following steps:
  1. Create the new location.
  2. Move the data.
  3. Drop the old location.
For more information, see the Vertica documentation.
You might need to move the Data Repository data directory for the following reasons:
  • You want to add new storage to an existing server.
  • You want to move the database from an old mount point to a new mount point because of an updated server build template.
The following process causes some downtime for
DX NetOps Performance Management
while the move occurs.
The following factors impact the total amount of downtime:
  • Size of the database
  • Storage input and output speed
The following process covers only moving the data repository data directory.
For information about moving the data repository database from one server to another, see Disaster Recovery.
Example:
  • You are moving the data directory for a three-node cluster:
    • node0001
    • node0002
    • node0003
  • The current data directory is:
    /spare/dbdata/data
  • The new data directory is:
    /opt/application/CA/drdata
  • The Vertica database name is
    drdata
    .
  • The
    dbadmin
    user for Vertica is
    dradmin
    .
  • The following end goals apply to this scenario:
    /spare/dbdata/data/drdata/v_drdata_node0001_data >> /opt/application/CA/drdata/drdata/v_drdata_node0001_data
    /spare/dbdata/data/drdata/v_drdata_node0002_data >> /opt/application/CA/drdata/drdata/v_drdata_node0002_data
    /spare/dbdata/data/drdata/v_drdata_node0003_data >> /opt/application/CA/drdata/drdata/v_drdata_node0003_data
Follow these steps:
  1. On each node, create the new data directory by issuing the following command:
    mkdir -p /
    new_data_directory
    /
    dbname
    /v_
    dbname
    _node000
    x
    _data
    • new_data_directory
      Specify the new data directory.
    • dbname
      Specify the name of the database.
    • x
      Specify the existing node number.
  2. Grant permissions to the new data directory by issuing the following command:
    chown -R dradmin:verticadba /
    new_data_directory
    /
    dbname
  3. For each parent in the path to
    /
    new_data_directory
    /dbname
    , grant permissions by issuing the following command:
    chown dradmin:verticadba /parent
  4. As
    dradmin
    , create the new storage location for each node in Vertica by issuing the following command:
    create location '/
    new_data_directory
    /
    dbname
    /v_
    dbname
    _node000
    x
    _data' NODE 'v_
    dbname
    _node000
    x
    ' USAGE 'DATA,TEMP' LABEL '
    TO_DATA_TEMP
    ';
    • TO_DATA_TEMP
      Specify a label for the new storage location. This label is required when you set the object policy.
  5. Confirm the new storage locations by issuing the following command:
    select * from storage_locations;
  6. Set the object policy by issuing the following command:
    select set_object_storage_policy('
    schema_name
    ', '
    TO_DATA_TEMP
    ', true );
    • schema_name
      Specify the name for the schema.
      Example:
      dauser
      To view a lists of the available schemas, issue the following command:
      dradmin=> \dn
    • TO_DATA_TEMP
      Specify the same label used when you created the new storage location.
  7. Trigger the object to move by issuing the following command:
    select enforce_object_storage_policy('
    schema_name
    ');
  8. Confirm that the policy is applied by issuing the following command:
    select * from storage_policies;
  9. Retire the old storage locations for each node by issuing the following command:
    select retire_location('/
    existing_data_directory
    /
    dbname
    /v_
    dbname
    _node000
    x
    _data', 'v_
    dbname
    _node000
    x
    ', true);
    • existing_data_directory
      Specify the existing data location.
  10. Confirm that the old storage locations are retired by issuing the following command:
    select is_retired, location_path from storage_locations;
  11. Drop the old storage location for each node:
    select drop_location('/
    existing_data_directory
    /
    dbname
    /v_
    dbname
    _node000
    x
    _data', 'v_
    dbname
    _node000
    x
    ');
  12. Clear the storage policy by issuing the following command:
    select clear_object_storage_policy( '
    schema_name
    ' );
  13. Remove the label from the new storage location for each node by issuing the following command:
    select alter_location_label('/
    new_data_directory
    /
    dbname
    /v_
    dbname
    _node000
    x
    _data', 'v_
    dbname
    _node000
    x
    ', '');