Showing posts with label EC2. Show all posts
Showing posts with label EC2. Show all posts

Thursday, September 27, 2012

Setting up NFS on EC2

When you get to the point of having a little virtual server farm it is handy to have a place to put common files. In the case of an Oracle DBA we've historically used an NFS mount point to accomplish that. Maybe in today's ever increasing security conscious world there may be a better way then using NFS, but that also may translate into more complexity too.

The NFS setup is fairly simple on EC2 EBS storage. In the case of this example AMI ami-e565ba8c (Amazon t.mirco Linux) image was used as the server, and ami-42778a2b (Oracle Linux aka Red Hat) was used as the client.

1) Insure that nfs utils and rpcbind are instgalled. When doing yum update if you get an on rpcbind, then use 'portmap' instead.

    yum install nfs-utils rpcbind

2) On the server that is going to be the source of the shared storage edit the export file to add the shared directory.

    vi /etc/exports
   
Add the following parameters to the file : your directory path, your public (EIP) address and the options to control access such as read/write options, security, and asychronous options. The EIP is of the client. The file format is reported to be very sensitive. Notice that there is no space after the EIP and before the options as you might exepect there to be. Use only the 'space' character between parameters. There are a lot of options for security and other things. Look up the doc on NFS and the exports file for more detail.

     /yourDIRname ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com(rw,async)

3) Now start the services.

    service rpcbind start   (if rpcbind is not available then use ‘portmap’)
    service nfs start
    service nfslock start

4) Next load the changes. You can add more mount points latter and repeat the export step.

    exportfs –ar

5) Insure that the services are up on the client. If they do not exist, then do the yum update step.

6) Create the nfs mount point on the client. The permissions on the server and the client shared storeage should be open enough to permit the nfs mount, otherwise you will receive a 'permission denied' message. For testing purposes I opened mine to 777. If you receive permission errors also try opening permissions on the parent directory of the mount point.

7) Open permissions on the server's AWS Security Group to allow the NFS mount. In the excellent blog post by Hunter Ford he set the group as follows. For example, for UDP he opened ports 111, and 32806.

    TCP: 111, 2049
    UDP: 111, 32806

However, you will also see in other posts that other ports were opened, and there are some notes stating the the port number used by the NFS process changes during server bounces. I have not confirmed any of this myself. For testing purposes just open TCP and UDP to all ports. Then after testing tighten it down to the desired level. If you get a 'time out, retrying' message then it is probably a security group issue, or, a configuration issue with your exports file.

9) Do the manual mount. The EIP is the NFS server's EIP. I've seen on other systems that the mount can't occur if you have a user sitting within the to-be mounted path. Insure that that you CD out of the shared area.

    mount -t nfs ec2-xxx-xx-xxx-xx.compute-1.amazonaws.com:/var/www/test /var/www/test

8) To make the changes permanent you will need to update the /etc/fstab file and add the services to your server startup.

    chkconfig --level 2345 rpcbind on
    chkconfig --level 2345 nfs on
    chkconfig --level 2345 nfslock on

    ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com:/var/www/test    /var/www/test  nfs rsize=8192,wsize=8192,timeo=14,intr 0 0


Monday, May 14, 2012

Oracle Cloud Control 12c on Amazon Web Services

Oracle Enterprise Manager 12c can run on Amazon's cloud services if you know a few tricks. You can download a copy of the how-to guide at OEMonEC2partTwo.pdf. It is in draft form. Over the next few weeks a bit more will be outlined before I move onto part three of this series. You can obtain part one here.

The highlights of  Part Two are:

  • Brief over of  features and architecture OEM CC 12c.
  • Extensive links to Part One of the series and other sources of necessary information to run an Oracle database repository (OMR) in an AWS EC2 environment.
  • Set up of the Amazon Machine Image to satisfy CC prerequisites.
  • Extensive discussion of  Name Resolution to enable CC to run in a DHCP environment.
  • Scripts for dynamic Hosts file management.
  • Firewall configuration to enable the CC architectural pieces to communicate in an EC2 context.
  • Debugging tips if the installation goes not as planned.
  • How to configure CC security credentials.

 If anyone how has already done this, or, will use this guide to do so I'd like to hear from you.

Monday, April 30, 2012

Security On Top Of Security

Regretfully, we have to put up with security invading our life maybe more than any danger that might occur.  This is true in our personal as well as public life. Recently I spent the day pulling my hair out because I couldn't achieve a very novice accomplishment like turning apache on and accessing a web page. More specifically, port 80 was not accessible while ping and ssh worked... well of course, they are on different ports.

In AWS EC2 parlance the Security Group must allow port 80 to be open.... and it was. I looked at it 10 times over 12 hours doubling checking again and again. It wasn't a mistake at on the apache-level, EC2-configuration, Selinux, iptable conflicts, host files, OS file or group permissions, file ownership, httpd.conf file, unavailable ports, the setroubleshoot service, or anything I could find on the EC2 forum.

It was just a firewall, a second frigging firewall... can you believe it. The Red Hat firewall is set up for you by default. My focus was on the EC2 firewall not knowing that RH already has one running by default. In my case I was using Oracle's Linux, but you always have to remember that it is a RH derivative.

What's my excuse for not knowing this?.... In the parlance of Dr. McCoy... "Damn it Jim, I'm a DBA not a RH nerd."

And I'll be damned if I'm going to make changes to the iptables... port by port, even when I did see a web comment or two in that direction. The syntax is totally greek even for a geek!

Actually, it is quite easy to turn off the RH firewall without making changes to the iptables. The last command supposedly does a permanent disable.

# service iptables save
# service iptables stop
# chkconfig iptables off


But that's not all... oh no, it isn't that simple. After another hour of frustration I needed a dope slap and good. Not because I'm a dope, but because I needed to wake up from 10 hours of security hell frying my brain. The final solution was to turn off IPV4 and IPV6.

# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off


Am I going to turn the RH firewall back on? What do you think.



Monday, April 9, 2012

Highlights of the Installation and Configuration Companion

The Installation and Configuration Companion contains the following topics

•    Quick Start Guides for concise list of steps with links to in depth references.
•    How to obtain access to Oracle Support at a very low cost
•    How to make an EC2 IP/EIP persistant thru server stop/starts
•    How to validate an Amazon Machine Image for an Oracle database
•    How to use YUM during the installation
•    How to create your own server init/rc startup script
•    How to set up ssh, VNC, firewall tunneling and how to solve problems when connecting to your server
•    How to install the Grid Infrastructure (GI) using role separation for security and compliance
•    How to allocate EC2 storage for a production sized OEM repository server, including setting up swap, temp, and an Oracle Fast Recovery Area
•    How to configure Oracle's ASM with GI troubleshooting techniques
•    How to troubleshoot a failed installation and how to start over
•    Bug fixes for: Oracle supplied AMI, Oracle install process, and a fix for ElasticFox enabling it to run in new versions of Firefox
•    How to test a recovery on the EC2 storage and Oracle database levels

An overview of the following important topics

•    EC2 security/firewall setup
•    EC2 storage
•    Setting up EC2 command line tools
•    Extensive list of important ASM and EC2 topics
•    Brief outline of the GI services
•    Brief outline of GI role separation
•    An FDISK primer

Saturday, April 7, 2012

Oracle Grid Infrastructure on Amazon's Web Services

The primary goal of this series of papers will be to document the process of installing, configuring and fine tuning an implementation of the Oracle Enterprise Manager (OEM) 12c Cloud Control product suite on Amazon Web Services (AWS). Follow-on papers will cover in-depth utilization of the rich feature sets of both AWS and OEM.

The intended audience is individuals with at least some familiarity of these technologies, and who desire more in-depth coverage than that given in a cursory installation tutorial.

This series serves as a bridge between the thousands of pages of excellent but daunting official documentation, and the cursory installation tutorials which hide detail and provide a false sense of completion. The series should be used as a companion to the full installation guides. It will fill in details, show examples, explain pitfalls, and in some cases document items missing from other sources.

Some of the highlights are:
  • Quick Start Guides serve as a guide to the overall text. These sections provide a step-by-step approach with references into the main text for further detail.
  • Hundreds of links to authorization sources to help you understand not only what to do but why.
  • Pointers for what to do when things go wrong with debugging tips.
  • Extensive coverage of setting up Amazon's Elastic Compute Cloud for and Oracle database.
  • How to obtain access to Oracle's Knowledge Base and tools almost for free.
You can pull down a copy of  here.