Book Image

Ceph Cookbook

Book Image

Ceph Cookbook

Overview of this book

Ceph is a unified, distributed storage system designed for excellent performance, reliability, and scalability. This cutting-edge technology has been transforming the storage industry, and is evolving rapidly as a leader in software-defined storage space, extending full support to cloud platforms such as Openstack and Cloudstack, including virtualization platforms. It is the most popular storage backend for Openstack, public, and private clouds, so is the first choice for a storage solution. Ceph is backed by RedHat and is developed by a thriving open source community of individual developers as well as several companies across the globe. This book takes you from a basic knowledge of Ceph to an expert understanding of the most advanced features, walking you through building up a production-grade Ceph storage cluster and helping you develop all the skills you need to plan, deploy, and effectively manage your Ceph cluster. Beginning with the basics, you’ll create a Ceph cluster, followed by block, object, and file storage provisioning. Next, you’ll get a step-by-step tutorial on integrating it with OpenStack and building a Dropbox-like object storage solution. We’ll also take a look at federated architecture and CephFS, and you’ll dive into Calamari and VSM for monitoring the Ceph environment. You’ll develop expert knowledge on troubleshooting and benchmarking your Ceph storage cluster. Finally, you’ll get to grips with the best practices to operate Ceph in a production environment.
Table of Contents (18 chapters)
Ceph Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting up a virtual infrastructure


To set up a virtual infrastructure, you will require open source software such as Oracle VirtualBox and Vagrant to automate virtual machine creation for you. Make sure you have the following software installed and working correctly on your host machine. The installation processes of the software are beyond the scope of this book; you can follow their respective documentation in order to get them installed and working correctly.

Getting ready

You will need the following software to get started:

  • Oracle VirtualBox: This is an open source virtualization software package for host machines based on x86 and AMD64/Intel64. It supports Microsoft Windows, Linux, and Apple MAC OSX host operating systems. Make sure it's installed and working correctly. More information can be found at https://www.virtualbox.org. Once you have installed VirtualBox, run the following command to ensure the installation:

    # VBoxManage --version
    
  • Vagrant: This is software meant for creating virtual development environments. It works as a wrapper around virtualization software such as VirtualBox, VMware, KVM, and so on. It supports the Microsoft Windows, Linux, and Apple MAC OSX host operating systems. Make sure it's installed and working correctly. More information can be found at https://www.vagrantup.com/. Once you have installed Vagrant, run the following command to ensure the installation:

    # vagrant --version
    
  • Git: This is a distributed revision control system and the most popular and widely adopted version control system for software development. It supports Microsoft Windows, Linux, and Apple MAC OSX operating systems. Make sure it's installed and working correctly. More information can be found at http://git-scm.com/. Once you have installed Git, run the following command to ensure the installation:

    # git --version
    

How to do it…

Once you have installed the mentioned software, we will then proceed with virtual machine creation:

  1. Git clone ceph-cookbook repositories to your VirtualBox host machine:

    $ git clone https://github.com/ksingh7/ceph-cookbook.git
    
  2. Under the cloned directory, you will find Vagrantfile, which is our Vagrant configuration file that basically instructs VirtualBox to launch the VMs that we require at different stages of this book. Vagrant will automate the VM's creation, installation, and configuration for you; it makes the initial environment easy to set up:

    $ cd ceph-cookbook ; ls -l
    
  3. Next, we will launch three VMs using Vagrant; they are required throughout this chapter:

    $ vagrant up ceph-node1 ceph-node2 ceph-node3
    
  4. Check the status of your virtual machines:

    $ vagrant status ceph-node1 ceph-node2 ceph-node3
    

    Note

    The username and password that Vagrant uses to configure virtual machine are vagrant and Vagrant has sudo rights. The default password for root user is vagrant.

  5. Vagrant will, by default, set up hostnames as ceph-node<node_number>, IP address subnet as 192.168.1.X, and will create three additional disks that will be used as OSDs by the Ceph cluster. Log in to each of these machines one by one and check if the hostname, networking, and additional disks have been set up correctly by Vagrant:

    $ vagrant ssh ceph-node1
    $ ip addr show
    $ sudo fdisk -l
    $ exit
    
  6. Vagrant is configured to update hosts file on the VMs. For convenience, update the /etc/hosts file on your host machine with the following content.

    192.168.1.101 ceph-node1
    192.168.1.102 ceph-node2
    192.168.1.103 ceph-node3
    
  7. Generate root SSH keys for ceph-node1 and copy the keys to ceph-node2 and ceph-node3. The password for root user on these VMs is vagrant. Enter the root user password when it's asked by the ssh-copy-id command and proceed with the default settings:

    $ vagrant ssh ceph-node1
    $ sudo su -
    # ssh-keygen
    # ssh-copy-id root@ceph-node2
    # ssh-copy-id root@ceph-node3
    
  8. Once the ssh keys are copied to ceph-node2 and ceph-node3, the root user from ceph-node1 can do an ssh login to VMs without entering the password:

    # ssh ceph-node2 hostname
    # ssh ceph-node3 hostname
    
  9. Enable ports that are required by the Ceph MON, OSD, and MDS on the operating system's firewall. Execute the following commands on all VMs:

    # firewall-cmd --zone=public --add-port=6789/tcp --permanent
    # firewall-cmd --zone=public --add-port=6800-7100/tcp --permanent
    # firewall-cmd --reload
    # firewall-cmd --zone=public --list-all
    
  10. Disable SELINUX on all the VMs:

    # setenforce 0
    # sed –i  s'/SELINUX.*=.*enforcing/SELINUX=disabled'/g /etc/selinux/config
    
  11. Install and configure ntp on all VMs:

    # yum install ntp ntpdate -y
    # ntpdate pool.ntp.org
    # systemctl restart ntpdate.service
    # systemctl restart ntpd.service
    # systemctl enable ntpd.service
    # systemctl enable ntpdate.service
    
  12. Add repositories on all nodes for the Ceph giant version and update yum:

    # rpm -Uhv http://ceph.com/rpm-giant/el7/noarch/ceph-release-1-0.el7.noarch.rpm
    # yum update -y