Sei sulla pagina 1di 35

VMware Management Resources

Module 3

2015 VMware Inc. All rights reserved.


You Are Here

1. Course Introduction 7. Storage Scalability

2. vSphere Security 8. Storage Optimization

3. VMware Management 9. CPU Optimization


Resources
10. Memory Optimization
4. Performance in a Virtualized
11. Virtual Machine and Cluster
Environment
Optimization
5. Network Scalability
12. Host and Management
6. Network Optimization Scalability

VMware vSphere: Optimize and Scale 3-2


2015 VMware Inc. All rights reserved.
Importance
Performing configuration and troubleshooting tasks from the command
line is a useful skill for a VMware vSphere administrator.
VMware vSphere Command-Line Interface, which is available with
VMware vSphere Management Assistant, provides the administrator
with these command-line capabilities.

VMware vSphere: Optimize and Scale 3-3


2015 VMware Inc. All rights reserved.
Learner Objectives
By the end of this module, you should be able to meet the following
objectives:
Understand the purpose of the vSphere CLI commands
Discuss options for running commands
Deploy and configure vSphere Management Assistant
Use the vmware-cmd command for virtual machine operations

VMware vSphere: Optimize and Scale 3-4


2015 VMware Inc. All rights reserved.
Methods to Run Commands
You access the command line on a VMware ESXi host in various
ways:
VMware vSphere ESXi Shell
vSphere CLI
vSphere Management Assistant, which includes vSphere CLI

VMware vSphere: Optimize and Scale 3-5


2015 VMware Inc. All rights reserved.
About vSphere ESXi Shell
vSphere ESXi Shell includes a set of fully supported configuration
commands and a set of commands for diagnosing and repairing ESXi
hosts.
Use vSphere ESXi Shell only at the request of VMware technical
support.
vSphere ESXi Shell is accessed in the following ways:
Locally, from the Direct Console User Interface (DCUI)
Remotely, from an SSH session

VMware vSphere: Optimize and Scale 3-6


2015 VMware Inc. All rights reserved.
Accessing vSphere ESXi Shell Locally
To access vSphere ESXi Shell locally, you must have access to the
DCUI, as well as administrator privileges.
By default, the local vSphere ESXi Shell is disabled:
Enable the local vSphere ESXi Shell from either the DCUI or VMware
vSphere Web Client.
After you enable vSphere ESXi Shell access, you can access the local
shell:
In the main DCUI screen, press Alt+F1 to open a virtual console window to the
host.
To return to the DCUI, press Alt+F2.

Local and domain users that have been assigned administrator


privileges on the ESXi host have root-equivalent permissions in the local
vSphere ESXi Shell.

VMware vSphere: Optimize and Scale 3-7


2015 VMware Inc. All rights reserved.
Accessing vSphere ESXi Shell Remotely
You access vSphere ESXi Shell remotely with a secure shell client like
SSH or PuTTY.
Disable SSH access when you finish using it.

Enable SSH on an ESXi host only as a last resort for


troubleshooting. Enabling SSH creates a potential
security vulnerability and reduces ESXi resources.

VMware vSphere: Optimize and Scale 3-8


2015 VMware Inc. All rights reserved.
About vSphere CLI
The vSphere CLI command set enables you to run common system
administration commands against ESXi hosts.
You run most vSphere CLI commands against a VMware vCenter
Server system and target the ESXi hosts that it manages.
vSphere CLI commands normally require a server name, user name,
and password to connect and log in to a server.
vSphere CLI commands run on top of the VMware vSphere SDK for
Perl.
You install a vSphere CLI package on a Linux or Microsoft Windows
system. Or you deploy the vSphere Management Assistant on an ESXi
host.

VMware vSphere: Optimize and Scale 3-9


2015 VMware Inc. All rights reserved.
About vSphere Management Assistant
vSphere Management Assistant is a virtual appliance that includes
several components:
SUSE Linux Enterprise Server 11 SP3
VMware Tools
vSphere CLI
vSphere SDK for Perl
Java JRE version 1.6
vi-fastpass, an authentication component for
the appliance

VMware vSphere: Optimize and Scale 3-10


2015 VMware Inc. All rights reserved.
Setting Up a vSphere Management Assistant Appliance
To set up a vSphere Management Assistant appliance:
1. Deploy vSphere Management Assistant from a URL or a downloaded file.
2. Configure vSphere Management Assistant time-zone and network settings.
3. Add target servers to vSphere Management Assistant.
Target servers include either the vCenter Server system, the ESXi hosts, or
both.
4. Initialize vi-fastpass authentication.

Deploy Configure Add Targets Authenticate

VMware vSphere: Optimize and Scale 3-11


2015 VMware Inc. All rights reserved.
Step 1: Deploying vSphere Management Assistant
You deploy vSphere Management Assistant like any other virtual
appliance.

VMware vSphere: Optimize and Scale 3-12


2015 VMware Inc. All rights reserved.
Step 2: Configuring vSphere Management Assistant
To access vSphere Management Assistant through the Web UI to
configure it:
1. Go to https://appliance_name_or_IP_address:5480.
2. Log in as vi-admin.
3. In the Web interface, configure the following options:
Time-zone settings
Network and proxy server settings
4. Update to the latest version.

VMware vSphere: Optimize and Scale 3-13


2015 VMware Inc. All rights reserved.
Step 3: Adding a Target Server
A target server is a vCenter Server system or ESXi host that you access
from vSphere Management Assistant.
The vifp interface enables administrators to add, list, and remove
target servers and to manage the vi-admin users password.
Use the vifp command to add a server for vi-fastpass authentication:
vifp addserver server -authpolicy fpauth -username root

After a server is added as a vSphere Management Assistant target, you


can run the vifptarget command. This command enables seamless
authentication for remote vSphere CLI and vSphere SDK for Perl API
commands.
Use the vifptarget command to indicate which server commands are
to be run on:
vifptarget s server

The vifptarget command changes the prompt to indicate the active


server.

VMware vSphere: Optimize and Scale 3-14


2015 VMware Inc. All rights reserved.
Step 4: Initializing vi-fastpass Authentication
The vi-fastpass authentication component vSphere
supports unattended authentication to vCenter Management
Assistant
Server system or ESXi host targets.
vi-fastpass alleviates the need to add login Authenticated
Commands Logging
credentials to every command being executed.
vi-fastpass facilitates unattended scripted
operations. ESXi
vi-fastpass is used as an alternative to Active
vCenter
Directory (AD) authentication. Server

VMware vSphere: Optimize and Scale 3-15


2015 VMware Inc. All rights reserved.
Joining vSphere Management Assistant to AD
vSphere Management Assistant can be configured for AD. The ESXi
hosts and vCenter Server systems can be added without storing
passwords in the vSphere Management Assistant credential store.

Active
Directory

Platform Services
Controller
vSphere Management ESXi Host
Assistant vCenter Server

VMware vSphere: Optimize and Scale 3-16


2015 VMware Inc. All rights reserved.
Connecting to the Infrastructure
vSphere Management Assistant connects directly to ESXi hosts or
through the vCenter Server system.

vCenter Server

vSphere Management
Assistant

vSphere SDK for Perl API (Port 443)


vCenter Server Protocol (Port 902) ESXi Host

. VMware vSphere: Optimize and Scale 3-17


2015 VMware Inc. All rights reserved.
vSphere CLI Command Structure
vSphere CLI syntax on a vSphere Management Assistant appliance
follows this structure.

command conn_options target_option command_options

A vSphere CLI command can be targeted directly at an ESXi host.


vicfg-nics --server esx01 --username esxadm --password vmware -l

A vSphere CLI command can be targeted at an ESXi host through a


vCenter Server instance or Platform Services Controller.
vicfg-nics --server vC1 --username vcadmin --password vmware --vihost esx01 -l

Using vi-fastpass eliminates the --username and -password options


from these commands.
VMware vSphere: Optimize and Scale 3-18
2015 VMware Inc. All rights reserved.
Common Connection Options for vSphere CLI Execution
Connection options define parameters in vSphere CLI commands.

Connection Option Description

--server Specifies the ESXi host or vCenter


Server system

--username Specifies the user name to log in to the


system
--password Specifies the login password.

--vihost Name of the ESXi host to run the


command against
--savesessionfile Saves a session to the specified file

--sessionfile Loads a previously saved session

--verbose Displays additional debugging


information

VMware vSphere: Optimize and Scale 3-19


2015 VMware Inc. All rights reserved.
vSphere Management Assistant Commands
vSphere Management Assistant includes the following command sets:
esxcli
resxtop
svmotion
vicfg- commands
vifs
vmkfstools
vmware-cmd

VMware vSphere: Optimize and Scale 3-20


2015 VMware Inc. All rights reserved.
Managing Hosts with vSphere Management Assistant
vicfg- commands are used to manage host settings.

Host Management Task Command

Reboot and shut down hosts. vicfg-hostops

Enter and exit maintenance mode. vicfg-hostops

Back up and restore host vicfg-cfgbackup


configuration settings.

Add ESXi hosts to an AD domain. vicfg-authconfig

VMware vSphere: Optimize and Scale 3-21


2015 VMware Inc. All rights reserved.
Using vicfg- Commands
An ESXi host can be shut down and restarted using the vicfg-host
command options.
Use the vicfg-hostops command to shut down or reboot hosts:
vicfg-hostops --operation shutdown cmd_options
vicfg-hostops --operation reboot cmd_options

Use the vicfg-hostops command to enter or exit maintenance mode:


vicfg-hostops --operation enter cmd_options
vicfg-hostops --operation exit cmd_options
vicfg-hostops --operation info cmd_options

VMware vSphere: Optimize and Scale 3-22


2015 VMware Inc. All rights reserved.
Overview of the vmware-cmd Command
You can manage virtual machines with vSphere Web Client or the
vmware-cmd vSphere CLI command.
You use the vmware-cmd command to perform virtual machine
operations:
Retrieve and change virtual machine attributes such as power state.
Register or unregister a virtual machine.
Manage virtual machine snapshots.
Connect and disconnect virtual devices.
Work with the AnswerVM API.

VMware vSphere: Optimize and Scale 3-23


2015 VMware Inc. All rights reserved.
Connection Options for vmware-cmd
The vmware-cmd vSphere CLI command supports only a limited set of
connection options.
Connection Option Description

-H Specifies an ESXi host or a vCenter Server system.

-h | --vihost Specifies the target host if the H option specifies a


vCenter Server system.
-O Specifies an alternate port. The default is 902.
-U Specifies the name of the user who connects to the target.
-P Specifies the password of the user.

--config Specifies the location of a configuration file that specifies


connection information.
--credstore Specifies the name of a credential store file.

--sessionfile Specifies the name of a session file that was saved


earlier.

VMware vSphere: Optimize and Scale 3-24


2015 VMware Inc. All rights reserved.
Virtual Machines Operation Examples Using the vmware-cmd Command

The vmware-cmd command performs many virtual machine operations:


To register a virtual machine:
vmware-cmd -s register /vmfs/volumes/Storage1/testvm/testvm.vmx
To view how long a virtual machine has been running:
vmware-cmd /vmfs/volumes/Storage1/testvm/testvm.vmx getuptime
To check whether a virtual machine has a snapshot:
vmware-cmd /vmfs/volumes/Storage1/testvm/testvm.vmx hassnapshot
To connect an IDE CD/DVD drive to a virtual machine:
vmware-cmd /vmfs/volumes/Storage1/testvm/testvm.vmx
connectdevice CD/DVD drive 2

VMware vSphere: Optimize and Scale 3-25


2015 VMware Inc. All rights reserved.
Working with the AnswerVM API
The AnswerVM API enables users to provide input to questions.
Some virtual machine operations can be blocked until the question
is answered.
vmware-cmd answer enables you to access the input. This option can
be used when you want to configure a virtual machine based on a users
input.

VMware vSphere: Optimize and Scale 3-26


2015 VMware Inc. All rights reserved.
esxcli Namespaces
The esxcli command includes many namespaces to focus on different
elements of the vSphere environment. Each namespace includes a set
of commands or additional namespaces:
esxcli
esxcli fcoe
esxcli hardware
esxcli iscsi
esxcli license
esxcli network
esxcli software
esxcli storage
esxcli system
esxcli vm
esxcli command list for a full listing

VMware vSphere: Optimize and Scale 3-27


2015 VMware Inc. All rights reserved.
Using the esxcli Command
An ESXi host can be shut down and restarted using the esxcli
command.
Use the esxcli system shutdown command to shut down or reboot
hosts. The host must be in maintenance mode:
esxcli system shutdown poweroff
esxcli system shutdown reboot

Use the esxcli system maintenanceMode command to enter or


exit maintenance mode:
esxcli system maintenanceMode get
esxcli system maintenanceMode set -enable=true
esxcli system maintenanceMode set -enable=false

VMware vSphere: Optimize and Scale 3-28


2015 VMware Inc. All rights reserved.
Using esxcli to Obtain the World ID
Use the esxcli command with the vm namespace to list all the virtual
machine processes:
esxcli vm process list

VMware vSphere: Optimize and Scale 3-29


2015 VMware Inc. All rights reserved.
Using esxcli for Virtual Machine Management
Use the esxcli command to forcibly kill a virtual machine that is stuck
and not responding. The world ID is found by using the vm process
list command.
Several methods are available to kill a virtual machine:
Graceful (similar to SIGTERM): Recommended method:
esxcli vm process kill --world-id=worldid --type=soft
Immediate (similar to SIGKILL):
esxcli vm process kill --world-id=worldid --type=hard
Last resort:
esxcli vm process kill --world-id=worldid -type=force

VMware vSphere: Optimize and Scale 3-30


2015 VMware Inc. All rights reserved.
Using esxcli to Create a Standard Switch
Use the esxcli command with the network vswitch standard
namespace to manage standard switches:
To create a standard switch:
esxcli network vswitch standard add --vswitch-name=vSwitch5
To add a port group to a standard switch:
esxcli network vswitch standard portgroup add
--portgroup-name=TestDev --vswitch-name=vSwitch5
To add an uplink to a standard switch:
esxcli network vswitch standard uplink add --uplink-name=vmnic3
--vswitch-name=vSwitch5

VMware vSphere: Optimize and Scale 3-31


2015 VMware Inc. All rights reserved.
Using esxcli to Examine Storage
Use the esxcli command with the storage namespace to display
storage characteristics:
To list all logical devices known to a host:
esxcli storage core device list
To display host bus adapter (HBA) information:
esxcli storage core adapter list
To display mappings between HBAs and devices:
esxcli storage core path list
To rescan all adapters:
esxcli storage core adapter rescan --all
To print mappings of datastores to their mount points and UUIDs:
esxcli storage filesystem list

VMware vSphere: Optimize and Scale 3-32


2015 VMware Inc. All rights reserved.
Lab 2: Using vSphere Management Assistant
Use vSphere Management Assistant to manage ESXi hosts and virtual
machines
1. Start SSH and vSphere ESXi Shell Services
2. Log In to the vSphere Management Assistant Appliance
3. Add the vCenter Server System and the ESXi Host as Target Servers
4. Add the ESXi Host Thumbprint to the vCenter Server Certificate Store
5. Use ESXCLI Commands to Query ESXi Host Properties
6. Use vicfg-ntp Commands to Configure NTP

VMware vSphere: Optimize and Scale 3-33


2015 VMware Inc. All rights reserved.
Review of Learner Objectives
You should be able to meet the following objectives:
Understand the purpose of the vSphere CLI commands
Discuss options for running commands
Deploy and configure vSphere Management Assistant
Use the vmware-cmd command for virtual machine operations

VMware vSphere: Optimize and Scale 3-34


2015 VMware Inc. All rights reserved.
Key Points
vSphere ESXi Shell is useful in troubleshooting situations.
vSphere CLI is a command-line interface to manage the infrastructure, either
by running commands or by executing scripts.
vSphere Management Assistant is a virtual appliance that is used to manage
the infrastructure at the command prompt.
vSphere Management Assistant includes vSphere CLI.
vSphere Management Assistant can be used to monitor, configure, and
manage hosts, storage, and virtual networking.
Questions?

VMware vSphere: Optimize and Scale 3-35


2015 VMware Inc. All rights reserved.

Potrebbero piacerti anche