Top Banner
[email protected] | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard
25
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

[email protected] | nectar.org.au

NECTAR TRAINING

Module 10

Beyond the Dashboard

Page 2: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Beyond the Dashboard

• Everything in the last modules can be done using command line only!

• Covered in this module: Using command line for• Launching and terminating an instance• Taking snapshots of instances and re-launching from snapshots• Creating and deleting volumes• Making backups and taking snapshots of volumes• Accessing the object store

• This module is made up of a collection of exercises, performing resource management in the command line.• A demo will be given to each exercise, after which it’s your turn.

Page 3: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Beyond the Dashboard

• Prerequisites for this Module:• You must be familiar with all terminology and concepts from the last modules, in

particular Module 7 and 9.• While you don’t need to be familiar with the command line, it is helpful if you are.• It is great if you already have a resource allocation including Volumes – if you

don’t, you may still watch the demonstration.

• Preparation:• Open a terminal on your local computer (on Windows, open the Windows

Command Line).• Open the On-Line Documentation which contains detailed instructions to all

exercises<Paste Documentation Link>

Page 4: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

• OpenStack provides command line clients which allow you to manage NeCTAR resources.

• Different command line clients available, e.g. swift for object store access, nova for compute resource management, etc.

• A more recent version of OpenStack provides only one command line tool called openstack which can be used for all resource management tasks. • In this course, we will use this openstack tool.

• You may install the command line clients on any computer, e.g. on your VM or your local computer (Win/Mac/Linux).

Page 5: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

• There are also application programming interfaces (APIs) available for Python, C++, Java and more.• APIs are not part of this tutorial — for a list of known software

development kits refer to https://wiki.openstack.org/wiki/SDKs

Page 6: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

Exercise 1: Install the openstack command line client on your computer.

Follow instructions in the On-Line Documentation! Summary:

Windows

Install Python incl. pip from www.python.org

Install setuptools (see docs).

Open windows command line:$ pip install pyOpenSSL$ set PATH=%PATH%; C:\Python27\Scripts$ pip install python- openstackclient

Mac OS X:$ brew install python or install from www.python.org Install setuptools (see documentatiaon).Upgrade setuptools and install clients:$ sudo pip install --upgrade setuptools$ sudo pip install python-openstackclient

Ubuntu Linux:

$ sudo apt-get install python-openstackclient

Page 7: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

• The openstack command line client is now installed on your computer.

• Before you can use it, you need to load your credentials, so the client can connect to your account.

• Where to get your credentials?

Page 8: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

Exercise 2: Get you OpenStack credentials.• Go to Dashboard Compute Access & Security API Access.• Download your OpenStack RC file (button top right).• You will also need your OpenStack password.

• This is not the same password you use to log onto the Dashboard!• You need to reset your password to activate it.

• Click next to your user name (your e-mail) on the top right and select Settings.

• Click “Reset password” and copy&paste the password, save it as text file somewhere safe.

Page 9: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

Windows:

Change your OpenStack RC file:$env:OS_AUTH_URL= "https://keystone.rc.nectar.org.au:5000/v2.0/" $env:OS_TENANT_ID="f12d34....c" $env:OS_TENANT_NAME= "<your-tentant-name>" $env:OS_USERNAME="<your-email>" $env:OS_PASSWORD=”<OpenStack-Passwd>"; $env:OS_REGION_NAME=”<Region-Name>”

Open PowerShell from Windows Command line:$ powershell.exeLoad the credentials:$ C:\Users\<Your-User-Name>\openrc.ps1

Linux / Mac OSX:

Load your credentials:

$ source <path-to-openrc.sh>

Exercise 3: Load your OpenStack credentials.

Page 10: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

OpenStack clients

• You can now use the openstack command line client.• Every time you open a new terminal to use it, you have to load your

credentials again (“source” your OpenStack RC script file)• The client is structured into several “tools” for various tasks.• To get help on the client, type:$ openstack help

• This will print a list of all the “tools”.• To print help on a tool:

$ openstack help <tool-name>• For example for the server tool:

$ openstack help server

Page 11: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Accessing the Object Store

• The openstack client can be used to access your Object Store.• The underlying tool which is used is called Swift.

• Transferring files to and from the Object Store using Swift is not encrypted! Encrypt sensitive data before transfer.

• In the next exercise we will create a container and upload/download a file to it.

• The Object Store can also be accessed from within program code using the APIs!• Not part of this tutorial

Page 12: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Accessing the Object Store

Exercise 4: List objects and create container

Read the help:$ openstack help object $ openstack help containerList your containers:$ openstack container listCreate a container called MyTestContainer:$ openstack container create MyTestContainerList files in the container (still empty):$ openstack object list MyTestContainer

Page 13: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Accessing the Object Store

Exercise 5: Upload / Download files

Create a new text file MyTestFile.txt on your computer and upload it:$ cd <folder-containing-MyNewTextFile.txt>$ openstack object create MyTestContainer MyNewTextFile.txt

List the file in the container:$ openstack object list MyTestContainer

Download file again and save as MyDownloadedFile.txt:$ openstack object save --file MyDownloadedFile.txt MyTestContainer MyNewTextFile.txt

Page 14: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Controlling an instance

• The next exercises will use the openstack client for• Launching an instance• Taking a snapshot of an instance• Launching a new instance from the snapshot

• For supporting and further documentation, please refer to the On-Line Documentation and the official openstack client documentation on openstack.org

Page 15: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Controlling an instance

Exercise 6: Launching an instance.

Read the help:$ openstack help server$ openstack help server createGet the ID of the NeCTAR Ubuntu image you would like to launch:$ openstack image list | grep NeCTARLaunch an instance called ClientLaunchedInstance:$ openstack server create --flavor m1.small --key-name Nectar_Key --security-group icmp --security-group ssh --image <image-id> ClientLaunchedInstanceList your instances:$ openstack server list

Page 16: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Controlling an instance

Exercise 7: Create a snapshot of the instance.

Create a snapshot called ClientLaunchedSnapshot:$ openstack server image create --name ClientLaunchedSnapshot ClientLaunchedInstanceShow details of the snapshot:$ openstack image show ClientLaunchedSnapshot

Page 17: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Controlling an instance

Exercise 8: Launch a new instance from the snapshot.

List your private images (incl. snapshots):$ openstack image list --privateLaunch a new instance:$ openstack server create --flavor m1.small --key-name Nectar_Key --security-group icmp --security-group ssh --image ClientLaunchedSnapshot CopyOfClientLaunchedInstanceShow details of the new instance:$ openstack server show CopyOfClientLaunchedInstance

Page 18: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing Volumes

• The last part of this tutorial will deal with managing volumes.• Creating and deleting volumes• Attaching / detaching volumes to an instance.• Make a “backup” of a volume

• Backup vs. Snapshot was discussed in Module 9.

• Restore a volume from a backup.• Create a snapshot of a volume• Create a new volume of a snapshot

• If you are still using the NeCTAR Trial Account, you won’t have access to volume storage and cannot do the exercises.• Watch the demonstration of the exercises instead.

Page 19: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing volumes

Exercise 9: Create a new volume (only users with allocation)Read the help:$ openstack help volume$ openstack help volume createList availability zones:$ openstack availability zone listCreate a new volume called MyNewStorage:$ openstack volume create --description "Description of the volume" --availability-zone <your zone name> --size 1 MyNewStorageList all volumes:$ openstack volume list

Page 20: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing volumes

Exercise 10: Attach a volume (only users with allocation)

Read the help:$ openstack server help | grep volumeAttach to your instance ClientLaunchedInstance:$ openstack server add volume ClientLaunchedInstance MyNewStorageList the volumes:$ openstack volume listDetach the volume:$ openstack server remove volume ClientLaunchedInstance MyNewStorage

Page 21: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing Volumes

Exercise 11: Backup a volume

Read the help:$ openstack help backup $ openstack help backup create

Create a backup of your volume MyNewStorage:$ openstack backup create --container Backups --name Backup1 --description "Backup MyNewStorage" MyNewStorageList your backup files:$ openstack backup listDisplay your backup file in the object store:$ openstack container list $ openstack object list Backups

Page 22: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing Volumes

Exercise 12: Restore from a backup and delete the backup.

Read the help:$ openstack help backup restoreGet the ID of your backup:$ openstack backup listRestore the backup onto your volume MyNewStorage:$ openstack backup restore <Backup-ID> MyNewStorageDelete the backup file from the Object Store:$ openstack backup delete <Backup-ID>

Page 23: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing Volumes

Exercise 13: Create a snapshot of a volume.

Make sure the volume is detached (status “available”):$ openstack volume listCreate a snapshot of the new Volume MyNewStorage:$ openstack snapshot create --name MyNewStorageSnapshot1 --description "First snapshot" MyNewStorage

Page 24: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Managing Volumes

Exercise 14: Create a new volume of the snapshot.

List the snapshots and copy the snapshot’s ID:$ openstack snapshot listCreate a new volume called MyRestoredVolume of the snapshot:$ openstack volume create --snapshot <ID of MyNewStorageSnapshot1> --description "My restored Volume" --size 2 MyRestoredVolumeList your volumes to see the new one:$ openstack volume listTo delete your snapshot:$ openstack snapshot delete MyNewStorageSnapshot1

Page 25: Communications@nectar.org.au | nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.

Closing note

Congratulations!!

You have successfully completed the course.

Now you are ready to get started with using the NeCTAR Research Cloud for your research!

For more information, refer to the On-Line Documentation.Don’t hesitate to contact support if you run into any issues!