Thursday, November 22, 2012

Changing Discoverer to run in Amazon EC2 AWS

Installing Discoverer in Amazon EC2 on linux is straightforward with only a few problems so we won't go into that here.
What I want to talk about is how to make Discoverer deal with instance restarts. This is a problem because usually in EC2 public when the instance restarts it will get a new hostname, and so Discoverer will stop working.

Disco Version : 10.1.2.3  NOT CHECKED AND PROBABLY DOESN'T work for WLS Disco 11+

So how do we solve this ?

There is a number of things to fix.


  1. Database
  2. Middle Tier
  3. Apache 

The intent is to fix these in a repeatable, scriptable way ; we're not quite there yet but we have simple steps to fix them all; it's just a question of scripting the damn things. 

1. Database :  
Easy - we assume no DB control, Grid Control, or agent.  In this case all that needs fixing is the local hostname in listener.ora 
Use  curl http://169.254.169.254/latest/meta-data/local-hostname
to find out the local hostname and sub it into listener. ora

2. Middle Tier 
We need to run chgiphost.sh. 
Source the AS environment and cd $ORACLE_HOME/chgipost/scripts
./chgiphost.sh 

oracle@ip-foonew scripts]$ ./chgiphost.sh  -mid
Oracle Home set to /u01/oracle/as
Starting Change Hostname/IP...

Enter fully qualified hostname (hostname.domainname) of destination
 (ip-foonew.eu-west-1.compute.internal)>>
Enter fully qualified hostname (hostname.domainname) of source
 (ip-fooold.eu-west-1.compute.internal)>>
Enter valid IP Address of destination
 (foonew)>>
Enter valid IP Address of source
 (fooold)>>
Change Hostname/IP completed successfully.

( In the above foonew and foold stand for the actuals from my environment.  chgipghost is a neat little script that figures out the new and old IP addresses 


3.  Apache. 

 In order to make Disco serve up properly over the Internet we had had to configure Apache to return the correct servername

Now that the name has changed we need to fix it again. 
So we need the existing public hostname

curl http://169.254.169.254/latest/meta-data/public-hostname

ec2-fooexternal.eu-west-1.compute.amazonaws.com

in httpd.conf change 
ServerName ec2foooldexternal.eu-west-1.compute.amazonaws.com

to 
ServerName ec2fooexternal.eu-west-1.compute.amazonaws.com


All should be OK now

startup db and ias 

$ORACLE_HOME/opmn/bin/opmnctl startall

All works  !  Tea and biscuits for everyone 

More later ! 

No comments: