In this short tutorial we will see how to change the location of our Data Storage in Vertica
Checkout the Video tutorial on how this is done
VIDEO
Use the script here to guide yourself thru the procedure:
Move Vertica Data Directory
What is the Action
/ vertica / data / analytics / v_analytics_node0001_data / -- /vertica/data/analytics/v_analytics_node0004_data/
/ vertica / data / analytics / v_analytics_node0002_data / -- /vertica/data/analytics/v_analytics_node0005_data/
/ vertica / data / analytics / v_analytics_node0003_data / -- /vertica/data/analytics/v_analytics_node0006_data/
--Create SO Location and grant dbadmin ownership
mkdir - p / vertica / data / analytics / v_analytics_node0004_data chown - R dbadmin : verticadba / vertica / data / analytics / v_analytics_node0004_data
mkdir - p / vertica / data / analytics / v_analytics_node0005_data chown - R dbadmin : verticadba / vertica / data / analytics / v_analytics_node0005_data
mkdir - p / vertica / data / analytics / v_analytics_node0006_data chown - R dbadmin : verticadba / vertica / data / analytics / v_analytics_node0006_data
mkdir - p / vertica_storage / data / chown - R dbadmin : verticadba / vertica / data
mkdir - p / vertica_storage / data / chown - R dbadmin : verticadba / vertica / data
mkdir - p / vertica_storage / data / chown - R dbadmin : verticadba / vertica / data
--Create DB Location
CREATE LOCATION '/vertica/data/analytics/v_analytics_node0004_data' NODE 'v_analytics_node0004' USAGE 'DATA,TEMP' LABEL 'T0_DATA_TEMP' ;
CREATE LOCATION '/vertica/data/analytics/v_analytics_node0005_data' NODE 'v_analytics_node0005' USAGE 'DATA,TEMP' LABEL 'T0_DATA_TEMP' ;
CREATE LOCATION '/vertica/data/analytics/v_analytics_node0006_data' NODE 'v_analytics_node0006' USAGE 'DATA,TEMP' LABEL 'T0_DATA_TEMP' ;
CREATE LOCATION '/vertica_storage/data/' NODE 'v_analytics_node0004' USAGE 'DATA,TEMP' LABEL 'DATA_TEMP' ;
CREATE LOCATION '/vertica_storage/data/' NODE 'v_analytics_node0005' USAGE 'DATA,TEMP' LABEL 'DATA_TEMP' ;
CREATE LOCATION '/vertica_storage/data/' NODE 'v_analytics_node0006' USAGE 'DATA,TEMP' LABEL 'DATA_TEMP' ;
select * from storage_locations ;
--Set object Policy
select set_object_storage_policy ( 'blabla' , 'T0_DATA_TEMP' , true );
--Trigger the object move
select enforce_object_storage_policy ( 'blabla' );
-- See that policy was applied
select * from storage_policies ;
SELECT alter_location_label ( '/home/dbadmin/stage' , '' , 'T0_DATA_TEMP1' );
-- Retire Storage Location
SELECT RETIRE_LOCATION ( '/vertica/data/analytics/v_analytics_node0001_data' , 'v_analytics_node0004' , true );
SELECT RETIRE_LOCATION ( '/vertica/data/analytics/v_analytics_node0002_data' , 'v_analytics_node0005' , true );
SELECT RETIRE_LOCATION ( '/vertica/data/analytics/v_analytics_node0003_data' , 'v_analytics_node0006' , true );
select is_retired , location_path from storage_locations ;
-- Drop Storage Location
SELECT DROP_LOCATION ( '/vertica/data/analytics/v_analytics_node0001_data' , 'v_analytics_node0004' );
SELECT DROP_LOCATION ( '/vertica/data/analytics/v_analytics_node0002_data' , 'v_analytics_node0005' );
SELECT DROP_LOCATION ( '/vertica/data/analytics/v_analytics_node0003_data' , 'v_analytics_node0006' );