Pivotal Knowledge Base

Follow

How to Cleanup and Re-Initialize HDB

Environment

 Product  Version
 Pivotal HDB  2.x
 OS  RHEL 6.x

Purpose

This article will describe how to re-initialize Pivotal HDB after a successful or failed installation & initialization.

Cause

Sometimes it is necessary to re-initialize HDB without re-installing the Pivotal HDB package.
For example, if you want to set different default locale for a HDB cluster, database reinitialization is the only way to achieve the task.

Procedure

WARNING: Double confirm again before proceeding with the below procedure as all the data in the HDB system will be LOST. If you still need the data, make sure that it has been backed up to some other place. 

1. Stop HAWQ from the Primary master node:

[hdm1]$ hawq stop cluster

2. Make sure there is no HAWQ instance running on any masters & segment nodes.

3. Delete the HAWQ data directory on the associated HDFS
Note: The actual HAWQ data directory on your HDFS may be different from the example below:

[hdm1]$ sudo -u hdfs hdfs dfs -rmr /hawq_default/*

If data needs to be deleted from HDFS completely without being moved to HDFS trash, use the following command. This will free up all the space used by the HAWQ system on HDFS:

[hdm1]$ sudo -u hdfs hdfs dfs -rmr -skipTrash /hawq_default/* 

4. Delete Master Data directory from both primary & standby master nodes.
Note: The actual HAWQ master data directory may be different from the example below:

[hdm1]$ rm -rf /data/hawq/master/*
[hdm2]$ rm -rf /data/hawq/master/*
5. Delete segment data directory from each segment node. You can use gpssh.
Note: The actual HAWQ segment data directory may be different from the example below:
[hdw1]$ rm -rf /data/hawq/segment/* 
[hdw2]$ rm -rf /data/hawq/segment/*
[hdw3]$ rm -rf /data/hawq/segment/*

6. Initialize the HAWQ database from the primary master:

[hdm1]$ hawq init cluster 

In case you want to use different default locale for your setup, you can specify the options for the locale like in this example below for 'Thai' language:

[hdm1]$ hawq init cluster --locale th_TH.utf8 --lc-collate th_TH.utf8 --lc-ctype th_TH.utf8 --lc-messages th_TH.utf8 --lc-monetary th_TH.utf8 --lc-numeric th_TH.utf8 --lc-time th_TH.utf8

 

 

Comments

Powered by Zendesk