Friday, October 26, 2018

#664 OCI - Load Balancer




















The Oracle Cloud Infrastructure Load Balancing service provides automated traffic distribution from one entry point to multiple servers reachable from your virtual cloud network (VCN). The service offers a load balancer with your choice of a public or private IP address, and provisioned bandwidth.


Public Load Balancer 

- accepts traffic from the Internet.

A public load balancer is regional in scope and requires two subnets, each in a separate availability domain. One subnet hosts the primary load balancer and the other hosts a standby load balancer to ensure accessibility even during an availability domain outage. 

A public load balancer consumes two private IP addresses, one from each host subnet.

Private Load Balancer

To isolate your load balancer from the internet and simplify your security posture, you can create a private load balancer. The Load Balancing service assigns it a private IP address that serves as the entry point for incoming traffic.

So what do I need to try this out?

Yes - 2 compute instances in different ADs.
These are my backend servers


















I also need an Internet Gateway - one was created by default when I created my VCN.












I then install an Apache server on both Compute instances























I open the firewall for ports 80/443 on both instances -





Then reload the firewall -
firewall-cmd --reload
I start the http server on both machines -
systemctl start httpd
I then add a different index file for each - NiallC1/NiallC2
echo 'NiallC1' >/var/www/html/index.html

Your load balancer must reside in different subnets from your application instances. This configuration allows you to keep your application instances secured in subnets with stricter access rules, while allowing public internet traffic to the load balancer in the public subnets.

So let's create those 2 subnets -

4 tasks here -
1. Add a Security List

























Note: I have deleted the default ingress and egress rules.

2. Add a Routing Table - makes sense!

























3. Create SubNet1


I called it LB-Subnet1
























4. Same procedure for LB-Subnet2























Essentially - this is what I have created









Create a Load Balancer































































We are now here -



















A load balancer directs traffic to what's known as a Backend Set, e.g. my 2 Compute Instances.

I now create this backend set -







































































Now I add the 2 instances to the backend set -

For this I need the OCID of each -

























It's back to editing the Backend Set now -


































































We are now here -




















Now I need to create a Listener for the Load Balancer -

A listener is an entity that checks for connection requests. The load balancer listener listens for ingress client traffic using the port you specify within the listener and the load balancer's public IP.

I want to accept http requests on port 80.

































































































When you create a listener, you must also update your VCN's security list to allow traffic to that listener.













































Now to see if all is working -


THE BIG TEST


I open a browser and enter the public ip of my load balancer









I refresh the page -












This blog post is based 100% on a great lab from the Oracle OCI team.
It is available here


Well done folks!



Thursday, October 25, 2018

#663 OCI - Compute Service in some more detail


Create Compute Instance




























Please note: All text in italics is from the Oracle docs

Check out the shape types above  - Virtual Machine or Bare Metal

Bare Metal

A bare metal compute instance gives you dedicated physical server access for highest performance and strong isolation.

Essentially a single-tenant model - no noisy neighbours. You also get direct hardware access.
So who should go for this? For example, customers with performance intensive requirements.

Virtual Machine

A Virtual Machine (VM) is an independent computing environment that runs on top of physical bare metal hardware. The virtualization makes it possible to run multiple VMs that are isolated from each other. VMs are ideal for running applications that do not require the performance and resources (CPU, memory, network bandwidth, storage) of an entire physical machine.

Details of the available shapes for both options are here

Bare Metal includes GPU based shapes, optimal for high performance and machine learning.

The VM shapes support the following operating systems -


















BYOI is also supported for older versions of a particular O/S etc.

Here I am creating an Oracle Linux based VM -





















Boot Volumes

When you launch a virtual machine (VM) or bare metal instance based on an Oracle-provided image or custom image, a new boot volume for the instance is created in the same compartment. That boot volume is associated with that instance until you terminate the instance. When you terminate the instance, you can preserve the boot volume and its data.

All boot volumes are encrypted and ensure faster boot times and enable compute instance scaling.
You can create a custom image based on a boot volume and then select that when creating a new instance. Backups/cloning is also supported.

Block Volumes


The Oracle Cloud Infrastructure Block Volume service lets you dynamically provision and manage  block storage volumes . You can create, attach, connect and move volumes as needed to meet your storage and application requirements. Once attached and connected to an instance, you can use a volume like a regular hard drive. Volumes can also be disconnected and attached to another instance without the loss of data.











































Regarding the Backup Policy -
gold - daily
silver - weekly
bronze - monthly

















Now I can attach it to my compute instance -








































iSCSI: A TCP/IP-based standard used for communication between a volume and attached instance.
Paravirtualized: A virtualized attachment available for VMs.







The iSCSI commands are available here -










































I ssh into the vm and execute the register cmd -






Note the positive response above.

I now execute the cmd to automatically re-connect after reboot -





I do sudo su - and login to iSCSI -






fdisk -l
















note the root volume sda and the new volume sdb

I format it -mkfs.ext3















and then mount it - mount /dev/sdb /mnt/hotd













Edit /etc/fstab to mount automatically -

Firstly, I need the UUID for sdb - blkid







Format of entry in fstab is as follows -
UUID=699a776a-3d8d-4c88-8f46-209101f318b6 /mnt/vol1 xfs defaults,_netdev,nofail 0 2
In my case -












File Systems

Oracle Cloud Infrastructure File Storage service provides a durable, scalable, distributed, enterprise-grade network file system. You can connect to a File Storage service file system from any bare metal, virtual machine, or container instance in your Virtual Cloud Network (VCN). You can also access a file system from outside the VCN using Oracle Cloud Infrastructure FastConnect and Internet Protocol security (IPSec) virtual private network (VPN).































































Now to mounting the file system I just created - again, all I need to do is to copy and paste the commands -