Total Pageviews

Thursday, 1 December 2016

Docker and its Containers !!!

Docker project is an open source project by Docker Inc. By the name Docker should contain containers, here the containers are nothing but different applications which were build and ready to use. All we need to do, is to install Docker and initialize an API of our interest.

Docker has different API's images, an instance of such image is a Container. It provides a open platform for Developers and SysAdmins to build, ship and run applications. Developers do the code part for the Application Images, they will build an application. SysAdmins can run these images using Docker platform with the help few commands.

If client requires a Ubuntu machine, it will be readily deployed by an Admin with the help of Docker. All he needs to do is to install packages related to Docker and start its services, then download the repository of image related to Ubuntu. Last step is to initialize a Docker image of Ubuntu, thats it within few seconds we can have Ubuntu machine.

For easy understanding we can compare Docker platform as Android Play store and its Images as Apps in Play store. All we need to do, select the application, download and install it.

Let us see how easy the working part of Dockers.

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)                         --- Docker is OpenSource, we can run it on any OS.
[root@localhost ~]#

[root@localhost ~]# docker -v
-bash: docker: command not found                            --- As of now, Docker is not installed on my machine
[root@localhost ~]#

[root@localhost ~]# docker version
-bash: docker: command not found
[root@localhost ~]#

Using YUM we can install packages of Docker,

[root@localhost ~]# yum install docker
Loaded plugins: fastestmirror
base                                                                                               | 3.6 kB  00:00:00
extras                                                                                             | 3.4 kB  00:00:00
updates                                                                                            | 3.4 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                                                      | 155 kB  00:00:02
(2/4): extras/7/x86_64/primary_db                                                                  | 166 kB  00:00:02
(3/4): base/7/x86_64/primary_db                                                                    | 5.3 MB  00:00:08
(4/4): updates/7/x86_64/primary_db                                                                 | 8.4 MB  00:00:13
Determining fastest mirrors
 * base: mirrors.centos.webair.com
 * extras: mirrors.centos.webair.com
 * updates: mirrors.centos.webair.com
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 0:1.10.3-46.el7.centos.14 will be installed
--> Processing Dependency: docker-common = 1.10.3-46.el7.centos.14 for package: docker-1.10.3-46.el7.centos.14.x86_64
--> Processing Dependency: oci-systemd-hook >= 1:0.1.4-4 for package: docker-1.10.3-46.el7.centos.14.x86_64
--> Running transaction check
---> Package docker-common.x86_64 0:1.10.3-46.el7.centos.14 will be installed

************** OUTPUT TRUNCATED *************

Dependencies Resolved

==========================================================================================================================
 Package                             Arch                Version                                Repository           Size
==========================================================================================================================
Installing:
 docker                              x86_64              1.10.3-46.el7.centos.14                extras              9.5 M

************** OUTPUT TRUNCATED *************

Transaction Summary
==========================================================================================================================
Install  1 Package (+13 Dependent packages)

Total download size: 12 M
Installed size: 53 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/audit-libs-python-2.4.1-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for audit-libs-python-2.4.1-5.el7.x86_64.rpm is not installed

************** OUTPUT TRUNCATED *************

Installed:
  docker.x86_64 0:1.10.3-46.el7.centos.14

Dependency Installed:
  audit-libs-python.x86_64 0:2.4.1-5.el7                     checkpolicy.x86_64 0:2.1.12-6.el7
  docker-common.x86_64 0:1.10.3-46.el7.centos.14             docker-selinux.x86_64 0:1.10.3-46.el7.centos.14

************** OUTPUT TRUNCATED *************

Complete!
[root@localhost ~]#

I have truncated so much from output, In short it checks for the repositories of CentOS, it checks for dependency packages and then installs all packages related to Dockers of CentOS.

[root@localhost ~]# docker -v
Docker version 1.10.3, build cb079f6-unsupported           ---- Since it is installed, now we can see the version.
[root@localhost ~]#

[root@localhost ~]# docker version                                   ---- For detailed info related to version.
Client:
 Version:         1.10.3                                                        
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
 Go version:      go1.6.3
 Git commit:      cb079f6-unsupported
 Built:           Fri Sep 16 13:24:25 2016
 OS/Arch:         linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[root@localhost ~]#

As of now, we installed Docker thats it. We didn't start its services, Thats Why.......

[root@localhost ~]# docker info
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Let us start the Docker service,

[root@localhost ~]# systemctl status docker
? docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: http://docs.docker.com
[root@localhost ~]#

[root@localhost ~]# systemctl start docker
[root@localhost ~]#

[root@localhost ~]# systemctl status docker
? docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2016-10-20 21:25:19 EDT; 2s ago
     Docs: http://docs.docker.com
 Main PID: 2591 (docker-current)
   CGroup: /system.slice/docker.service
           +-2591 /usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd --selinux-enabled --log-driver=...

************** OUTPUT TRUNCATED *************

Oct 20 21:25:19 localhost.localdomain docker-current[2591]: time="2016-10-20T21:25:19.120444318-04:00" level=info m...ock"
Oct 20 21:25:19 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#

Now the version command shows the complete output, 

[root@localhost ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
 Go version:      go1.6.3
 Git commit:      cb079f6-unsupported
 Built:           Fri Sep 16 13:24:25 2016
 OS/Arch:         linux/amd64

Server:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
 Go version:      go1.6.3
 Git commit:      cb079f6-unsupported
 Built:           Fri Sep 16 13:24:25 2016
 OS/Arch:         linux/amd64
[root@localhost ~]#

All the Docker commands will work now,

[root@localhost ~]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.10.3
Storage Driver: devicemapper
 Pool Name: docker-253:0-1416-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 11.8 MB
 Data Space Total: 107.4 GB

************** OUTPUT TRUNCATED *************

 Volume: local
 Network: host bridge null
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 1
Total Memory: 993 MiB
Name: localhost.localdomain
ID: HQ6K:NYHE:7ACO:SFVG:PO43:7E2Z:TJKA:RXUI:PWSK:D7PK:MM5D:ZJEC
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Registries: docker.io (secure)
[root@localhost ~]#
[root@localhost ~]#

Command to check how many Docker processes are running....

[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]#

Now, let us initialize image of CentOS...

[root@localhost ~]# docker run -it centos /bin/bash
Unable to find image 'centos:latest' locally                       --- Since it is our first container
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
8d30e94188e7: Pull complete
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
Status: Downloaded newer image for docker.io/centos:latest      
                                  ---- For next CentOS container no need to download it, straight away initializes using this Image.
[root@3775b792faf0 /]#
                                                       Immediately after intializing, we logged into our instance.
[root@3775b792faf0 /]#
[root@3775b792faf0 /]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@3775b792faf0 /]#
[root@3775b792faf0 /]# uname -a
Linux 3775b792faf0 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@3775b792faf0 /]#

[root@3775b792faf0 /]# cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2      3775b792faf0                                     ------- This is our Container ID
[root@3775b792faf0 /]#
[root@3775b792faf0 /]#
[root@3775b792faf0 /]# exit
exit
[root@localhost ~]#

Let us check the Docker processes now,

[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
3775b792faf0        centos              "/bin/bash"         50 seconds ago      Exited (0) 4 seconds ago                       trusting_mayer
[root@localhost ~]#

Let us try initializing image of Ubuntu this time....

[root@localhost ~]# docker run -it ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
Trying to pull repository docker.io/library/ubuntu ...
latest: Pulling from docker.io/library/ubuntu
6bbedd9b76a4: Pull complete
fc19d60a83f1: Pull complete
de413bb911fd: Pull complete
2879a7ad3144: Pull complete
668604fde02e: Pull complete
Digest: sha256:2d44ae143feeb36f4c898d32ed2ab2dffeb3a573d2d8928646dfc9cb7deb1315
Status: Downloaded newer image for docker.io/ubuntu:latest
root@7104e28b790f:/#
root@7104e28b790f:/#

root@7104e28b790f:/# cd /etc/
root@7104e28b790f:/etc#
root@7104e28b790f:/etc#
root@7104e28b790f:/etc# cat os-release
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial
root@7104e28b790f:/etc#

On top of any OS, we can run any other OS containers using Docker.

root@7104e28b790f:/etc# uname -a
Linux 7104e28b790f 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@7104e28b790f:/etc#                           ---- Even it is Ubuntu, still it shares our CentOS kernel.

root@7104e28b790f:/etc# cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2      7104e28b790f
root@7104e28b790f:/etc#
root@7104e28b790f:/etc# exit
exit
[root@localhost ~]#

CentOS Kernel...

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                     PORTS               NAMES
7104e28b790f        ubuntu              "/bin/bash"         About a minute ago   Exited (0) 4 seconds ago                       admiring_franklin
3775b792faf0        centos              "/bin/bash"         3 minutes ago        Exited (0) 2 minutes ago                       trusting_mayer
[root@localhost ~]#

Now we have images of both Ubuntu and CentOS ready with us, if we try to initialize a new CentOS or Ubuntu container it will be so easy...

[root@localhost ~]# docker run -it centos /bin/bash
[root@d3e4a6957462 /]#                                     ----- Within few seconds, our new CentOS container created.
[root@d3e4a6957462 /]#

[root@d3e4a6957462 /]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@d3e4a6957462 /]#
[root@d3e4a6957462 /]# uname -a
Linux d3e4a6957462 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@d3e4a6957462 /]#
[root@d3e4a6957462 /]# exit
exit
[root@localhost ~]#
[root@localhost ~]#

It is so simple working with Docker. So platform on which we are initializing APIs is Docker Engine and the instance of images are its Containers.

Let's get familiar with few other commands of Dockers... Let's just try with docker so it shows its usage along with options....

[root@localhost ~]# docker
Usage: docker [OPTIONS] COMMAND [arg...]
       docker daemon [ --help | ... ]
       docker [ --help | -v | --version ]

A self-sufficient runtime for containers.

Options:

  --config=~/.docker              Location of client config files
  -D, --debug                     Enable debug mode
  -H, --host=[]                   Daemon socket(s) to connect to
  -h, --help                      Print usage
  -l, --log-level=info            Set the logging level
  --tls                           Use TLS; implied by --tlsverify
  --tlscacert=~/.docker/ca.pem    Trust certs signed only by this CA
  --tlscert=~/.docker/cert.pem    Path to TLS certificate file
  --tlskey=~/.docker/key.pem      Path to TLS key file
  --tlsverify                     Use TLS and verify the remote
  -v, --version                   Print version information and quit

Commands:
    attach    Attach to a running container
    build     Build an image from a Dockerfile
    commit    Create a new image from a container's changes
    cp        Copy files/folders between a container and the local filesystem
    create    Create a new container
    diff      Inspect changes on a container's filesystem
    events    Get real time events from the server
    exec      Run a command in a running container
    export    Export a container's filesystem as a tar archive
    history   Show the history of an image
    images    List images
    import    Import the contents from a tarball to create a filesystem image
    info      Display system-wide information
    inspect   Return low-level information on a container or image
    kill      Kill a running container
    load      Load an image from a tar archive or STDIN
    login     Register or log in to a Docker registry
    logout    Log out from a Docker registry
    logs      Fetch the logs of a container
    network   Manage Docker networks
    pause     Pause all processes within a container
    port      List port mappings or a specific mapping for the CONTAINER
    ps        List containers
    pull      Pull an image or a repository from a registry
    push      Push an image or a repository to a registry
    rename    Rename a container
    restart   Restart a container
    rm        Remove one or more containers
    rmi       Remove one or more images
    run       Run a command in a new container
    save      Save an image(s) to a tar archive
    search    Search the Docker Hub for images
    start     Start one or more stopped containers
    stats     Display a live stream of container(s) resource usage statistics
    stop      Stop a running container
    tag       Tag an image into a repository
    top       Display the running processes of a container
    unpause   Unpause all processes within a container
    update    Update resources of one or more containers
    version   Show the Docker version information
    volume    Manage Docker volumes
    wait      Block until a container stops, then print its exit code

Run 'docker COMMAND --help' for more information on a command.
[root@localhost ~]#

We can name our container at the time of intializing it...

[root@localhost ~]# docker run --name firstdock -it ubuntu /bin/bash
root@34b3cc40449d:/#
root@34b3cc40449d:/#
root@34b3cc40449d:/# exit
exit
[root@localhost ~]#

[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
34b3cc40449d        ubuntu              "/bin/bash"         17 seconds ago      Exited (0) 3 seconds ago             firstdock
d3e4a6957462        centos              "/bin/bash"         7 days ago          Exited (0) 7 days ago                         angry_euler
fa516d1acb13          centos              "/bin/ksh"          7 days ago           Created                                               stoic_booth
7104e28b790f        ubuntu              "/bin/bash"         7 days ago          Exited (0) 7 days ago                    admiring_franklin
3775b792faf0        centos                "/bin/bash"         7 days ago          Exited (0) 7 days ago                        trusting_mayer
[root@localhost ~]#

To start our container,

[root@localhost ~]#
[root@localhost ~]# docker start firstdock
firstdock
[root@localhost ~]#
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                  PORTS               NAMES
34b3cc40449d        ubuntu              "/bin/bash"         47 seconds ago      Up 5 seconds                                firstdock
d3e4a6957462        centos              "/bin/bash"         7 days ago          Exited (0) 7 days ago                       angry_euler
fa516d1acb13        centos              "/bin/ksh"          7 days ago          Created                                     stoic_booth
7104e28b790f        ubuntu              "/bin/bash"         7 days ago          Exited (0) 7 days ago                       admiring_franklin
3775b792faf0        centos              "/bin/bash"         7 days ago          Exited (0) 7 days ago                       trusting_mayer
[root@localhost ~]#

To stop our container,

[root@localhost ~]# docker stop firstdock
firstdock
[root@localhost ~]#
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                     PORTS               NAMES
34b3cc40449d        ubuntu              "/bin/bash"         About a minute ago   Exited (0) 2 seconds ago                       firstdock
d3e4a6957462        centos              "/bin/bash"         7 days ago           Exited (0) 7 days ago                          angry_euler
fa516d1acb13        centos              "/bin/ksh"          7 days ago           Created                                        stoic_booth
7104e28b790f        ubuntu              "/bin/bash"         7 days ago           Exited (0) 7 days ago                          admiring_franklin
3775b792faf0        centos              "/bin/bash"         7 days ago           Exited (0) 7 days ago                          trusting_mayer
[root@localhost ~]#

To rename our container,

[root@localhost ~]# docker rename firstdock dock1
[root@localhost ~]#
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
34b3cc40449d        ubuntu              "/bin/bash"         3 minutes ago       Exited (0) 2 minutes ago                       dock1
d3e4a6957462        centos              "/bin/bash"         7 days ago          Exited (0) 7 days ago                          angry_euler
fa516d1acb13        centos              "/bin/ksh"          7 days ago          Created                                        stoic_booth
7104e28b790f        ubuntu              "/bin/bash"         7 days ago          Exited (0) 7 days ago                          admiring_franklin
3775b792faf0        centos              "/bin/bash"         7 days ago          Exited (0) 7 days ago                          trusting_mayer
[root@localhost ~]#

To remove a container,

[root@localhost ~]# docker rm angry_euler
angry_euler
[root@localhost ~]#
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
34b3cc40449d        ubuntu              "/bin/bash"         4 minutes ago       Exited (0) 3 minutes ago                       dock1
fa516d1acb13        centos              "/bin/ksh"          7 days ago          Created                                        stoic_booth
7104e28b790f        ubuntu              "/bin/bash"         7 days ago          Exited (0) 7 days ago                          admiring_franklin
3775b792faf0        centos              "/bin/bash"         7 days ago          Exited (0) 7 days ago                          trusting_mayer
[root@localhost ~]#

To check the downloaded image repositories...

[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/ubuntu    latest              f753707788c5        2 weeks ago         127.1 MB
docker.io/centos    latest              980e0e4c79ec        7 weeks ago         196.7 MB
[root@localhost ~]#

So far this is what I worked for the concept of Dockers, Hope soon I will post some other posts related to Docker concept.

######################################################################################

Wednesday, 30 November 2016

Host Side Scanning of Luns (OpenFiler Storage) !!!

In this post we are going to learn how to scan luns from host side. In many of the interviews it is a common question, "Explain me step by step how do you make a LUN visible at host side?"

Let me make it clear what exactly Host side scanning means. Whenever Sys Admins request for new luns, Storage team will assign the LUNs as per the request. Then it is an admin task to make it visible at OS level for the application use.

To make a LUN ready to use and to make it visible at host side we need to follow few steps carefully. When it comes to LUNs visibility and Storage, iSCSI target and iSCSI initiator are the most common terms we come across.

iSCSI initiator initiates a SCSI session, that means it requests the LUN (our Host server).
iSCSI target is the Storage Network, that means it is the server which contains the LUNs (Target Node -- OpenFiler).

In my scenario, I created 4 Luns in my OpenFiler storage. Now I will show you the steps to make them visible at my Solaris host.

Steps we need to follow,

1. Check whether iscsitgt service is online or not. (Make it online)
2. Using "iscsiadm" command, we need to add our iSCSI target to our host.
3. Then comes the actual host side scanning using "devfsadm" command.



Output of format command before assigning luns...

bash-3.2# echo| format
Searching for disks...

AVAILABLE DISK SELECTIONS:
       0. c0d0 <▒x▒▒▒▒▒▒▒▒▒@▒▒▒ cyl 2085 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
Specify disk (enter its number): Specify disk (enter its number):

bash-3.2#

Proceed with our steps,

bash-3.2# svcs iscsitgt
STATE          STIME    FMRI
disabled       15:12:02 svc:/system/iscsitgt:default
bash-3.2#

bash-3.2# svcadm enable iscsitgt
bash-3.2#

bash-3.2# svcs iscsitgt
STATE          STIME    FMRI
online         17:34:06 svc:/system/iscsitgt:default
bash-3.2#

Then the Step 2,

bash-3.2# iscsiadm list static-config
bash-3.2#                                                           ---- No targets are available.

Add the iSCSI target, (Careful with the name, when you have many available targets at Storage end)

bash-3.2# iscsiadm add static-config iqn.2006-01.com.openfiler:tsn.d896e2cf3975,10.0.0.129:3260
bash-3.2#                                                     --- Port 3260 is a TCP port for iSCSI traffic.
bash-3.2# iscsiadm list static-config
Static Configuration Target: iqn.2006-01.com.openfiler:tsn.d896e2cf3975,10.0.0.129:3260
bash-3.2#

Then the final step, scanning disks at host side....

bash-3.2# devfsadm -i iscsi
bash-3.2#

bash-3.2#
bash-3.2# echo|format
Searching for disks...

AVAILABLE DISK SELECTIONS:
       0. c0d0 <▒x▒▒▒▒▒▒▒▒▒@▒▒▒ cyl 2085 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
       1. c2t2d0 <OPNFILE-VIRTUAL-DISK   -0    cyl 1529 alt 2 hd 128 sec 32>
          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.d896e2cf39750001,0
       2. c2t3d0 <OPNFILE-VIRTUAL-DISK   -0    cyl 2043 alt 2 hd 128 sec 32>
          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.d896e2cf39750001,1
       3. c2t4d0 <OPNFILE-VIRTUAL-DISK   -0    cyl 1017 alt 2 hd 64 sec 32>
          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.d896e2cf39750001,2
       4. c2t5d0 <OPNFILE-VIRTUAL-DISK   -0    cyl 505 alt 2 hd 64 sec 32>
          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.d896e2cf39750001,3
Specify disk (enter its number): Specify disk (enter its number):
bash-3.2#

If we have EMC storage in our environment, then there are other commands to deal with powerpath to scan the luns. Similarly to make use of these luns under Veritas control, we use vxscandisks command to scan.... 

Regarding above scenarios, I already posted earlier...

https://solarishandy.blogspot.com/2015/02/making-luns-visible-at-host-side.html

#####################################################################################

Sunday, 20 November 2016

High Availability (HA) in VMware vSphere !!!

Using Cluster concepts among ESXi hosts we can achieve high availability. In VMware we have two types of Clusters. In this post we will cover, incase of any system failure how the VMs will be migrated to other hosts in the cluster.

1. Distributed Resource Scheduler (DRS)
                           is a utility that balances computing workloads with available resources in a virtualized environment. Total resources will be distributed as user requirements among all hosts.

2. High Availability (HA)
                           is a utility that eliminates the need for dedicated standby hardware and software in a virtualized environment. When a Host is down, the VMs within that will be shifted to other hosts automatically. This reduces manual shifting overhead.

For this we need to create a cluster and move our hosts to that cluster...

It is preferred to maintain separate NIC in all the hosts for checking heartbeats. One NIC for normal data transfers and the other is dedicated for Fault tolerance management.

Click on any of the hosts, click on Configuration tab and then click on networking....

We can see only 1 NIC is available for Host1... Now let us add one more NIC. Click on Properties....


We can view the properties of our Virtual Switch...


Click on Management and then add new network....


Select the newly added NIC adapter...


Click Finish and so we added our NIC...


As we can see our second NIC is not yet assigned with any IP...


Click on properties to add a Network to this new NIC...


Select Connection Type "VMkernel" ... (We use this NIC for host management)


Here I am using my existing virtual switch for our Network traffic...


Give a desired name as "Network Label"


We can obtain IP automatically or can assign as per our range...


Review Summary one last time...


We can see the changes in our Networking tab...


Similarly I added NIC to my second host (Host2) and also assigned IP....


Host2 Networking tab....


Now we are good to configure HA cluster... Right Click on our cluster and click on settings...


Once we Enable HA, we can see vSphere HA in our Cluster Features...


Modify VM options as per our requirement....


Read the description of VM monitoring and choose accordingly, I prefer "Disabled" otherwise while monitoring even for short network drops the VMs will be restarted.


Datastore Hearbeating manages the preferences about what storage to be used. I selected both the storages, so both the storages will be used by cluster....


So far done with the minimum requirements and configuration part of HA cluster.

                                                   
                                         vSphere HA configured on both the hosts successfully........
 

Removed and deleted few VMs for space issue, dont get confused...

Current Scenario:
                        Below is the current status of VMs in my host1...... Windows_VM is on shared storage and VMware vCenter Server is on local datastore of Host1....

                                 HOST1                                                                                      HOST2
 

Let us test our cluster by powering off one of our hosts..... Click on Shut Down....

 

After shut down of Host1 my Windows_VM migrated to Host2 automatically, but VMware Vcenter VM is still down since it is originally located on datastore of Host1.


Now I powered on my Host1, so lets try connecting to it....


Now Host1 is back and so VMware vCenter VM is also back....


After Host1 is rebooted, below is the status of VMs in both hosts.....

                                  Host2                                                                                         Host1
 

Now lets try it in the other way, what happens when we shut down the Host2...


 

Shut Down Initiated....


Since Host2 is unavailable, both the VMs within Host2 are down...


Windows_VM is unrecheable for a while and switched back to Host1 with few network drops...


Windows_VM is back to Host1, since it is on shared storage but the other VM couldn't....


Finally after powering on the Host2, we have all our VMs back....


At first the Windows_VM is on Host1, so we shut down the Host1 and then the VM is migrated to Host2 automatically.

Then we tried with shut down of Host2, this time Windows_VM is switched back to available Host which is Host1. We have seen working of HA cluster in both the example scenarios.

#####################################################################################