Chapter 2. Ceph Instant Deployment

In this chapter, we will cover the following topics:

  • Creating a sandbox environment with VirtualBox
  • From zero to Ceph – deploying your first Ceph cluster
  • Scaling up your Ceph cluster – monitor and OSD addition

Creating a sandbox environment with VirtualBox

We can test deploy Ceph in a sandbox environment using Oracle VirtualBox virtual machines. This virtual setup can help us discover and perform experiments with Ceph storage clusters as if we are working in a real environment. Since Ceph is an open source software-defined storage deployed on top of commodity hardware in a production environment, we can imitate a fully functioning Ceph environment on virtual machines, instead of real-commodity hardware, for our testing purposes.

Oracle VirtualBox is a free software available at http://www.virtualbox.org for Windows, Mac OS X, and Linux. We must fulfil system requirements for the VirtualBox software so that it can function properly during our testing. The Ceph test environment that we will create on VirtualBox virtual machines will be used for the rest of the chapters in this book. We assume that your host operating system is a Unix variant; for Microsoft windows, host machines use an absolute path to run the VBoxManage command, which is by default c:Program FilesOracleVirtualBoxVBoxManage.exe.

The system requirement for VirtualBox depends upon the number and configuration of virtual machines running on top of it. Your VirtualBox host should require an x86-type processor (Intel or AMD), a few gigabytes of memory (to run three Ceph virtual machines), and a couple of gigabytes of hard drive space. To begin with, we must download VirtualBox from http://www.virtualbox.org/ and then follow the installation procedure once this has been downloaded. We will also need to download the CentOS 6.4 Server ISO image from http://vault.centos.org/6.4/isos/.

To set up our sandbox environment, we will create a minimum of three virtual machines; you can create even more machines for your Ceph cluster based on the hardware configuration of your host machine. We will first create a single VM and install OS on it; after this, we will clone this VM twice. This will save us a lot of time and increase our productivity. Let's begin by performing the following steps to create the first virtual machine:

Note

The VirtualBox host machine used throughout in this demonstration is a Mac OS X which is a UNIX-type host. If you are performing these steps on a non-UNIX machine that is, on Windows-based host then keep in mind that virtualbox hostonly adapter name will be something like VirtualBox Host-Only Ethernet Adapter #<adapter number>. Please run these commands with the correct adapter names. On windows-based hosts, you can check VirtualBox networking options in Oracle VM VirtualBox Manager by navigating to File | VirtualBox Settings | Network | Host-only Networks.

  1. After the installation of the VirtualBox software, a network adapter is created that you can use, or you can create a new adapter with a custom IP:

    For UNIX-based VirtualBox hosts

    # VBoxManage hostonlyif remove vboxnet1
    # VBoxManage hostonlyif create
    # VBoxManage hostonlyif ipconfig vboxnet1 --ip 192.168.57.1 --netmask 255.255.255.0
    

    For Windows-based VirtualBox hosts

    # VBoxManage.exe hostonlyif remove "VirtualBox Host-Only Ethernet Adapter"
    # VBoxManage.exe hostonlyif create
    # VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter" --ip 192.168.57.1 --netmask 255.255.255.0
    
  2. VirtualBox comes with a GUI manager. If your host is running Linux OS, it should have the X-desktop environment (Gnome or KDE) installed. Open Oracle VM VirtualBox Manager and create a new virtual machine with the following specifications using GUI-based New Virtual Machine Wizard, or use the CLI commands mentioned at the end of every step:
    • 1 CPU
    • 1024 MB memory
    • 10 GB X 4 hard disks (one drive for OS and three drives for Ceph OSD)
    • 2 network adapters
    • CentOS 6.4 ISO attached to VM

    The following is the step-by-step process to create virtual machines using CLI commands:

    1. Create your first virtual machine:
      # VBoxManage createvm --name ceph-node1 --ostype RedHat_64 --register
      # VBoxManage modifyvm ceph-node1 --memory 1024 --nic1 nat  --nic2 hostonly --hostonlyadapter2 vboxnet1
      

      For Windows VirtualBox hosts:

      # VBoxManage.exe modifyvm ceph-node1 --memory 1024 --nic1 nat --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter"
      
    2. Create CD-Drive and attach CentOS ISO image to first virtual machine:
      # VBoxManage storagectl ceph-node1 --name "IDE Controller" --add ide --controller PIIX4 --hostiocache on --bootable on
      # VBoxManage storageattach ceph-node1 --storagectl "IDE Controller" --type dvddrive --port 0 --device 0 --medium CentOS-6.4-x86_64-bin-DVD1.iso
      

      Note

      Make sure you execute the preceding command from the same directory where you have saved CentOS ISO image or you can specify the location where you saved it.

    3. Create SATA interface, OS hard drive and attach them to VM; make sure the VirtualBox host has enough free space for creating vm disks. If not, select the host drive which have free space:
      # VBoxManage storagectl ceph-node1 --name "SATA Controller" --add sata --controller IntelAHCI --hostiocache on --bootable on
      # VBoxManage createhd --filename OS-ceph-node1.vdi --size 10240
      # VBoxManage storageattach ceph-node1 --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium OS-ceph-node1.vdi
      
    4. Create SATA interface, first ceph disk and attach them to VM:
      # VBoxManage createhd --filename ceph-node1-osd1.vdi --size 10240
      # VBoxManage storageattach ceph-node1 --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium ceph-node1-osd1.vdi
      
    5. Create SATA interface, second ceph disk and attach them to VM:
      # VBoxManage createhd --filename ceph-node1-osd2.vdi --size 10240
      # VBoxManage storageattach ceph-node1 --storagectl "SATA Controller" --port 2 --device 0 --type hdd --medium ceph-node1-osd2.vdi
      
    6. Create SATA interface, third ceph disk and attach them to VM:
      # VBoxManage createhd --filename ceph-node1-osd3.vdi --size 10240
      # VBoxManage storageattach ceph-node1 --storagectl "SATA Controller" --port 3 --device 0 --type hdd --medium ceph-node1-osd3.vdi
      
  3. Now, at this point, we are ready to power on our ceph-node1 VM. You can do this by selecting the ceph-node1 VM from Oracle VM VirtualBox Manager, and then clicking on the Start button, or you can run the following command:
    # VBoxManage startvm ceph-node1 --type gui
    
  4. As soon as you start your VM, it should boot from the ISO image. After this, you should install CentOS on VM. If you are not already familiar with Linux OS installation, you can follow the documentation at https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/index.html.
  5. Once you have successfully installed the operating system, edit the network configuration of the machine:
    • Edit /etc/sysconfig/network and change the hostname parameter HOSTNAME=ceph-node1
    • Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file and add:
      ONBOOT=yes
      BOOTPROTO=dhcp
    • Edit the /etc/sysconfig/network-scripts/ifcfg-eth1 file and add:
      ONBOOT=yes
      BOOTPROTO=static
      IPADDR=192.168.57.101
      NETMASK=255.255.255.0
    • Edit the /etc/hosts file and add:
      192.168.57.101 ceph-node1
      192.168.57.102 ceph-node2
      192.168.57.103 ceph-node3
  6. Once the network settings have been configured, restart VM and log in via SSH from your host machine. Also, test the Internet connectivity on this machine, which is required to download Ceph packages:
  7. Once the network setup has been configured correctly, you should shut down your first VM so that we can make two clones of your first VM. If you do not shut down your first VM, the cloning operation might fail.
    1. Create clone of ceph-node1 as ceph-node2:
      # VBoxManage clonevm --name ceph-node2 ceph-node1 --register
      
    2. Create clone of ceph-node1 as ceph-node3:
      # VBoxManage clonevm --name ceph-node3 ceph-node1 --register
      
  8. After the cloning operation is complete, you can start all three VMs:
    # VBoxManage startvm ceph-node1 
    # VBoxManage startvm ceph-node2 
    # VBoxManage startvm ceph-node3 
    
  9. Set up VM ceph-node2 with the correct hostname and network configuration:
    • Edit /etc/sysconfig/network and change the hostname parameter:
      HOSTNAME=ceph-node2
    • Edit the /etc/sysconfig/network-scripts/ifcfg-<first interface name> file and add:
      DEVICE=<correct device name of your first network interface, check ifconfig -a>
      ONBOOT=yes
      BOOTPROTO=dhcp
      HWADDR= <correct MAC address of your first network interface, check ifconfig -a >
    • Edit the /etc/sysconfig/network-scripts/ifcfg-<second interface name> file and add:
      DEVICE=<correct device name of your second network interface, check ifconfig -a>
      ONBOOT=yes
      BOOTPROTO=static
      IPADDR=192.168.57.102
      NETMASK=255.255.255.0
      HWADDR= <correct MAC address of your second network interface, check ifconfig -a >
    • Edit the /etc/hosts file and add:
      192.168.57.101 ceph-node1
      192.168.57.102 ceph-node2
      192.168.57.103 ceph-node3

    After performing these changes, you should restart your virtual machine to bring the new hostname into effect. The restart will also update your network configurations.

  10. Set up VM ceph-node3 with the correct hostname and network configuration:
    • Edit /etc/sysconfig/network and change the hostname parameter:
      HOSTNAME=ceph-node3
    • Edit the /etc/sysconfig/network-scripts/ifcfg-<first interface name> file and add:
      DEVICE=<correct device name of your first network interface, check ifconfig -a>
      ONBOOT=yes
      BOOTPROTO=dhcp
      HWADDR= <correct MAC address of your first network interface, check ifconfig -a >
    • Edit the /etc/sysconfig/network-scripts/ifcfg-<second interface name> file and add:
      DEVICE=<correct device name of your second network interface, check ifconfig -a>
      ONBOOT=yes
      BOOTPROTO=static
      IPADDR=192.168.57.103
      NETMASK=255.255.255.0
      HWADDR= <correct MAC address of your second network interface, check ifconfig -a >
    • Edit the /etc/hosts file and add:
      192.168.57.101 ceph-node1 
      192.168.57.102 ceph-node2 
      192.168.57.103 ceph-node3 

    After performing these changes, you should restart your virtual machine to bring a new hostname into effect; the restart will also update your network configurations.

At this point, we prepare three virtual machines and make sure each VM communicates with each other. They should also have access to the Internet to install Ceph packages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.72.15