Search This Blog

Saturday, December 22, 2012

Accessing Eucalyptus 3.1/3.2 DataBase

Hi Folks,
There may be a need to open up Eucalyptus 3.1/3.2 DataBase in-order either to tweak, or add new features based existing schema ( suggested for good practices :P). So let me tel you the step by step guide to open it up.

Step 1: We don't have the password generated by eucalyptus at the time of initialization of the cloud. So first we make a small tweak to find the secret password

# cd <installed eucalyptus directory>/etc/eucalyptus/cloud.d/scripts
# nano setup_db.groovy

Get to line no: 138 
Next to the line containing
LOG.debug("Postgres 9.1 command : " + args.toString( ) )

Add these lines

final File passFile1 = new File("<installed eucalyptus directory>/password.txt")
passFile1.write( getPassword() )

Step 2: Restart eucalyptus cloud

# <installed eucalyptus directory>/etc/init.d/eucalyptus-cloud restart

Step 3: Now open the file password.txt and this is your password for the database access

# cat <installed eucalyptus directory>/password.txt

Step 4: Next we can straight away try to access the database by doing the following prerequisites

# chmod 777 <installed eucalyptus directory>/var/lib/eucalyptus/db/
# chmod 777 <installed eucalyptus directory>/var/lib/eucalyptus/db/data
# chmod 777 <installed eucalyptus directory>/var/lib/eucalyptus/db/data/.s.PGSQL.8777

# su postgres
# export PGPASSWORD="<password displayed/copied in step 3>"

Step 5: Finally we can use different set of psql commands to view/use the eucalyptus database

example to list the databases present

# psql -l -p 8777 -h <installed eucalyptus directory>/var/lib/eucalyptus/db/data/ -U eucalyptus

example to open on of its database

# psql -p 8777 -h <installed eucalyptus directory>/var/lib/eucalyptus/db/data/ -U eucalyptus eucalyptus_general

Thats it this how you can play around with the eucalyptus database. (version 3.1/3.2)
This can extend to next to eucalyptus versions too.. :)

No comments:

Post a Comment