Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

NDS Labs Project: QMCDB

Using NDS Labs: Ray's Notes

...

Created a default SSH key pair used to log into the machines you create 1.

  1. Select "Compute->Access & Security" at left; select "Key Pairs" tab.

...

  1. Click "+Create Key Pair"

...

  1. In pop up, provide a name (I used "default") and click "Create Key Pair"

...

  1. The key-pair will be offered for download (via usual browser "Save As" pop-up). This is in the form of a PEM-formatted private key. Save it into the ~/.ssh dir with a name; I used "labs-default".

It shouldn't be necessary to have the public key (that's used on the nebula side
, inserted into the machines as they created); however, if you need it, you can
extract it using the ssh-keygen command (on your local machine):

Code Block
languagetext
ssh-keygen -f labs-default.pem -y bq. labs-default.pub

 

Security Groups

Security Groups provide different firewall rules that can be applied to created machines.

The NDSLabs Project had 4 security groups defined when I started, two named "remote SSH". None appeared to have SSH actually enabled, so I added an SSH rule the first "remote SSH" group:

  1. Select "Compute->Access & Security" at left; select "Security Groups" tab.
  2. Click "Manage Rules" for the Security Group. This shows the current list of configured rules. Originally this contained just two Egress (getting out of the machine) rules which appear to allow any connection out (on both IPv4 and IPv6).
  3. Click "+Add Rule"
  4. In the pop-up, select under "Rule": "SSH"; this removes a bunch of inputs from the form. Leave the others as-is to allow SSH in from anywhere.
  5. Click "Add"
    The new rule should appear in the list.

Note that I had to rename the 2nd "remote SSH" group to get it to apply to a machine (below).

-(If we want to play fast and loose, it appears that the default group allows anything in or out.)-

Security Groups will also be need to be created to open ports to other application components, like databases (e.g. see RaysNotesMongoDB).

Get an IP address

If you want to log into a machine from the outside world, a public IP needs to be assigned to it. Of course, a particular address can be attached to one running machine at a time. An address is pulled from a pool (of 50) "floatnig IPs":

  1. Select "Compute->Access & Security" at left; select "Floating IPs" tab.
  2. Click on "Allocate IP To Project"
  3. In pop-up, just click "Allocate IP"

We attach the IP address when we start the machine.

Create a machine

Running machines-so-called "instances"-are created and started from one of the provided OS images. Here's me creating a test machine:

  1. Select "Images" at left; select "Public" button at top. This shows images with a bunch of different OSes.
  2. For the desired OS, click "Launch Instance" at the right end of its row; I picked CoreOS
  3. In the pop-up (under the "Details" tab):
    1. enter an "Instance Name" ("ray-test")
    2. select a Flavor ("m1.small"), this picks a configuration that sets the amount of RAM and system disk, shown at right (disk=20GB, RAM=2GB).
    3. Leave rest as is (see notes about adding storage volumes): Any Zone, Boot from image, CoreOS
  4. Click on the "Access & Security" tab:
    1. select the name of the desired key-pair
    2. select "remote SSH" under Security Groups
  5. Click "Launch"; this will bring you to the Instances view, and you'll see in the "Power State" column evidence of the machine starting.
  6. From the "Actions" menu for the newly created instance, select "Associate Floating IP"; the pop-up will allow you to pick the IP address you just allocated.

Once the Power State says Running, you should be able to log in remotely via ssh; your ssh public key will be associated with the "core" user:

   ssh -i ~/.ssh/labs-default core@141.142.208.126

You can pause or stop the machine; these will leave the machine available under "Instances". Terminating the machine destroys the instance; to restart, one would need to recreated from the "Images" pane.

Storage Volumes

References:

Volumes provide persistent storage that lasts beyond the life of the machine. They can also be moved across multiple machines.

Create the Volume

  1. In Dashboard, select "Compute" -bq. "Volumes"
  2. Select "+Create Volume"
  3. In pop-up, enter a logical name/description, "No source", disk size (used 4 GB); click "Create Volume"

Attach Volume to machine

  1. In Volumes page, select from menu for newly created volume, "Manage Attachments"
  2. select machine from menu and attach
  3. Note the dev name it gets attached as (e.g. /dev/vdb)

Format and mount Filesystem

When the volume is first created (as an empty volume), it has no filesystems nor partition table; these need to be created.

  1. Log into machine that the machine is attached to
  2. Use fdisk to create a partition table: fdisk /dev/vdb.
    1. type c to create a new table
    2. type n to add a new partition; select "p" for a primary particition; set the beginning and ending sectors. For a single partition disk, take the defaults.
    3. type p to see result; resulting type should be "Linux".
    4. type x to write the table and exit.
  3. Use mkfs to format the partition: mkfs -t ext4 /dev/vdb1

Create the Volume

  1. In Dashboard, select "Compute" -> "Volumes"
  2. Select "+Create Volume"
  3. In pop-up, enter a logical name/description, "No source", disk size (used 4 GB); click "Create Volume"

Attach Volume to machine

  1. In Volumes page, select from menu for newly created volumne, "Manage Attachments"
  2. select machine from menu and attach
  3. Note the dev name it gets attached as (e.g. /dev/vdb)

Format and mount Filesystem

When the volume is first created (as an empty volume), it has no filesystems nor partition table; these need to be created.

  1. Log into machine that the machine is attached to
  2. Use fdisk to create a partition table: fdisk /dev/vdb.
    1. type c to create a new table
    2. type n to add a new partition; select "p" for a primary particition; set the beginning and ending sectors. For a single partition disk, take the defaults.
    3. type p to see result; resulting type should be "Linux".
    4. type x to write the table and exit.
  3. Use mkfs to format the partition: mkfs -t ext4 /dev/vdb1

CoreOS uses systemd to mount drives, so to mount the new partition:

  1. Create a file called DATA.mount (where DATA is the mount point directory name--e.g. data.mount) and the following contents:
Code Block
languagetext
[Unit]
Description = Mount for Container Storage

[Mount]
What=/dev/vdb1
Where=/data
Type=ext4

[Install]
WantedBy = multi-user.target
  1. Install the file into the /etc/systemd/system directory
  2. Type the following to mount (reliably)
Code Block
     systemctl enable data.mount
     systemctl start data.mount