NDS Labs Project: QMCDB
Using NDS Labs: Ray's Notes
These are my real-time notes which I'll use to create more helpful documentation. I expect that some of this will be one-time actions would not be applicable to all.
Starting up Machines (via the OpenStack Dashboard)
Reference: The OpenStack End-User Guide – discusses using the OpenStack dashboard.
After account is enabled, log into OS portal on nebula
Working in the -("NDSLabs")- "NDSLabsQMCDB" Project.
SSH key
When you create an ssh key, OS can use it to allow you to log into a machine after it starts.
Created a default SSH key pair used to log into the machines you create
- Select "Compute->Access & Security" at left; select "Key Pairs" tab.
- Click "+Create Key Pair"
- In pop up, provide a name (I used "default") and click "Create Key Pair"
- 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):
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:
- Select "Compute->Access & Security" at left; select "Security Groups" tab.
- 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).
- Click "+Add Rule"
- 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.
- 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":
- Select "Compute->Access & Security" at left; select "Floating IPs" tab.
- Click on "Allocate IP To Project"
- 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:
- Select "Images" at left; select "Public" button at top. This shows images with a bunch of different OSes.
- For the desired OS, click "Launch Instance" at the right end of its row; I picked CoreOS
- In the pop-up (under the "Details" tab):
- enter an "Instance Name" ("ray-test")
- 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).
- Leave rest as is (see notes about adding storage volumes): Any Zone, Boot from image, CoreOS
- Click on the "Access & Security" tab:
- select the name of the desired key-pair
- select "remote SSH" under Security Groups
- Click "Launch"; this will bring you to the Instances view, and you'll see in the "Power State" column evidence of the machine starting.
- 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
- In Dashboard, select "Compute" -bq. "Volumes"
- Select "+Create Volume"
- In pop-up, enter a logical name/description, "No source", disk size (used 4 GB); click "Create Volume"
Attach Volume to machine
- In Volumes page, select from menu for newly created volume, "Manage Attachments"
- select machine from menu and attach
- 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.
- Log into machine that the machine is attached to
- Use
fdisk
to create a partition table:fdisk /dev/vdb
.- type
c
to create a new table - 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. - type
p
to see result; resulting type should be "Linux". - type
x
to write the table and exit.
- type
- Use
mkfs
to format the partition:mkfs -t ext4 /dev/vdb1
Create the Volume
- In Dashboard, select "Compute" -> "Volumes"
- Select "+Create Volume"
- In pop-up, enter a logical name/description, "No source", disk size (used 4 GB); click "Create Volume"
Attach Volume to machine
- In Volumes page, select from menu for newly created volumne, "Manage Attachments"
- select machine from menu and attach
- 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.
- Log into machine that the machine is attached to
- Use
fdisk
to create a partition table:fdisk /dev/vdb
.- type
c
to create a new table - 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. - type
p
to see result; resulting type should be "Linux". - type
x
to write the table and exit.
- type
- Use
mkfs
to format the partition:mkfs -t ext4 /dev/vdb1
CoreOS uses systemd to mount drives, so to mount the new partition:
- Create a file called DATA
.mount
(where DATA is the mount point directory name--e.g.data.mount
) and the following contents:
[Unit] Description = Mount for Container Storage [Mount] What=/dev/vdb1 Where=/data Type=ext4 [Install] WantedBy = multi-user.target
- Install the file into the
/etc/systemd/system
directory - Type the following to mount (reliably)
systemctl enable data.mount systemctl start data.mount