Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Ceph Cookbook
Ceph Cookbook

Ceph Cookbook: Practical recipes to design, implement, operate, and manage Ceph storage systems , Second Edition

Arrow left icon
Profile Icon Umrao Profile Icon Hackett Profile Icon Karan Singh
Arrow right icon
AU$36.99 AU$53.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (9 Ratings)
eBook Nov 2017 466 pages 2nd Edition
eBook
AU$36.99 AU$53.99
Paperback
AU$67.99
Subscription
Free Trial
Renews at AU$24.99p/m
Arrow left icon
Profile Icon Umrao Profile Icon Hackett Profile Icon Karan Singh
Arrow right icon
AU$36.99 AU$53.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (9 Ratings)
eBook Nov 2017 466 pages 2nd Edition
eBook
AU$36.99 AU$53.99
Paperback
AU$67.99
Subscription
Free Trial
Renews at AU$24.99p/m
eBook
AU$36.99 AU$53.99
Paperback
AU$67.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Ceph Cookbook

Working with Ceph Block Device

In this chapter, we will cover the following recipes:

  • Configuring Ceph client
  • Creating Ceph Block Device
  • Mapping Ceph Block Device
  • Resizing Ceph RBD
  • Working with RBD snapshots
  • Working with RBD clones
  • Disaster recovery replication using RBD mirroring
  • Configuring pools for RBD mirroring with one way replication
  • Configuring image mirroring
  • Configuring two-way mirroring
  • Recovering from a disaster!

Introduction

Once you have installed and configured your Ceph storage cluster, the next task is performing storage provisioning. Storage provisioning is the process of assigning storage space or capacity to physical or virtual servers, either in the form of block, file, or object storage. A typical computer system or server comes with a limited local storage capacity that might not be enough for your data storage needs.

Storage solutions such as Ceph provide virtually unlimited storage capacity to these servers, making them capable of storing all your data and making sure that you do not run out of space. Using a dedicated storage system instead of local storage gives you the much-needed flexibility in terms of scalability, reliability, and performance.

Ceph can provision storage capacity in a unified way, which includes block, filesystem, and object storage. The following diagram...

Configuring Ceph client

Any regular Linux host (RHEL or Debian-based) can act as a Ceph client. The client interacts with the Ceph storage cluster over the network to store or retrieve user data. Ceph RBD support has been added to the Linux mainline kernel, starting with 2.6.34 and later versions.

 How to do it...

As we did earlier, we will set up a Ceph client machine using Vagrant and VirtualBox. We will use the same Vagrantfile that we cloned in the last chapter. Vagrant will then launch a CentOS 7.3 virtual machine that we will configure as a Ceph client:

  1. From the directory where we cloned the Ceph-Cookbook-Second-Edition GitHub repository, launch the client virtual machine using Vagrant:
         $ vagrant status...

Creating Ceph Block Device

Up to now, we have configured Ceph client, and now we will demonstrate creating a Ceph Block Device from the client-node1 machine.

How to do it...

  1. Create a RADOS Block Device named rbd1 of size 10240 MB:
        # rbd create rbd1 --size 10240 --name client.rbd
  1. There are multiple options that you can use to list RBD images:
        ## The default pool to store block device images is "rbd",
you can also specify the pool name with the rbd
command using -p option:

# rbd ls --name client.rbd
# rbd ls -p rbd --name client.rbd
# rbd list --name client.rbd
  1. Check the details of the RBD image:
        # rbd --image rbd1 info --name client.rbd
...

Mapping Ceph Block Device

Now that we have created a block device on a Ceph cluster, in order to use this block device, we need to map it to the client machine. To do this, execute the following commands from the client-node1 machine.

How to do it...

  1. Map the block device to the client-node1:
        # rbd map --image rbd1 --name client.rbd
Notice the mapping of the images has failed due to a feature set mismatch!
  1. With Ceph Jewel the new default format for RBD images is 2 and Ceph Jewel default configuration includes the following default Ceph Block Device features:
    • layering: layering support
    • exclusive-lock: exclusive locking support
    • object-map: object map support (requires exclusive-lock)
    • deep-flatten: snapshot flatten...

Resizing Ceph RBD

Ceph supports thin provisioned block devices, which means that the physical storage space will not get occupied until you begin storing data on the block device. The Ceph Block Device is very flexible; you can increase or decrease the size of an RBD on the fly from the Ceph storage end. However, the underlying filesystem should support resizing. Advance filesystems such as XFS, Btrfs, EXT, ZFS, and others support filesystem resizing to a certain extent. Please follow filesystem specific documentation to know more about resizing.

XFS does not currently support shrinking, Btrfs, and ext4 do support shrinking but should be done with caution!

How to do it...

To increase or decrease the Ceph RBD image size, use...

Working with RBD snapshots

Ceph extends full support to snapshots, which are point-in-time, read-only copies of an RBD image. You can preserve the state of a Ceph RBD image by creating snapshots and restoring the snapshot to get the original data.

If you take a snapshot of an RBD image while I/O is in progress to the image the snapshot may be inconsistent. If this occurs you will be required to clone the snapshot to a new image for it to be mountable. When taking snapshots it is recommended to cease I/O from the application to the image before taking the snapshot. This can be done by customizing the application to issue a freeze before a snapshot or can manually be done using the fsfreeze command (man page for fsfreeze details this command further).

How to do it...

...

Working with RBD clones

Ceph supports a very nice feature for creating Copy-On-Write (COW) clones from RBD snapshots. This is also known as snapshot layering in Ceph. Layering allows clients to create multiple instant clones of Ceph RBD. This feature is extremely useful for cloud and virtualization platforms such as OpenStack, CloudStack, Qemu/KVM, and so on. These platforms usually protect Ceph RBD images containing an OS/VM image in the form of a snapshot. Later, this snapshot is cloned multiple times to spawn new virtual machines / instances. Snapshots are read-only, but COW clones are fully writable; this feature of Ceph provides a greater level of flexibility and is extremely useful in cloud platforms. In the later chapters, we will discover more on COW clones for spawning OpenStack instances:

Every cloned image (child image) stores references of its parent snapshot to read...

Disaster recovery replication using RBD mirroring

RBD mirroring is an asynchronous replication of RBD images between multiple Ceph clusters. RBD mirroring validates a point-in-time consistent replica of any change to an RBD image, including snapshots, clones, read and write IOPS and block device resizing. RBD mirroring can run in an active+active setup or an active+passive setup. RBD mirroring utilizes the RBD journaling and exclusive lock features which enables the RBD image to record all changes to the image in order of which they occur. These features validate that a crash-consistent copy of the remote image is available locally. Before mirroring can be enabled on a Ceph cluster the journaling feature must be enabled on the RBD image.

The daemon responsible for ensuring point-in-time consistency from one Ceph cluster to the other is the rbd-mirror daemon. Depending on your...

Configuring pools for RBD mirroring with one way replication

RBD mirroring is configured by enabling it on a pool basis in a primary and secondary Ceph cluster. There are two modes that can be configured with RBD mirroring depending on what level of data you choose to mirror. Note that the enabled RBD mirroring configuration must be the same per pool on primary and secondary clusters.

  • Pool mode: Any image in a pool with journaling enabled is mirrored to the secondary cluster.
  • Image mode: Only specifically chosen images with mirroring enabled will be mirrored to the secondary cluster. This requires the image to have mirroring enabled for it.

How to do it...

Before any data can be mirrored from the Ceph cluster to the backup...

Configuring image mirroring

Image mirroring can be used when you choose to only want to mirror a specific subset of images and not an entire pool. The next recipe we will enable mirroring on a single image in the data pool and not mirror the other two images in the pool. This recipe requires you to have completed step 1 - step 9 in Disaster recovery replication using RBD mirroring recipe and have rbd-mirror running on backup site:

How to do it...

  1. Create three images in the ceph cluster as we did in the previous recipe:
       # rbd create image-1 --size 1024 --pool data 
--image-feature exclusive-lock,journaling
  1. Enable image mirroring on the data pool on the ceph and backup clusters:
        # rbd mirror pool enable...

Configuring two-way mirroring

Two-way mirroring requires a rbd-mirror daemon running on both clusters, the primary and the secondary. With two way mirroring it is possible to mirror data or images from the primary site to a secondary site, and the secondary site can mirror data or images back to the primary site.

We will not be demoing this configuration in this book at it is very similar to one-way configuration, but we will highlight the changes needed for two way replication at the pool level, these steps are covered in the one-way replication recipe.

How to do it...

  1. Both clients must have the rbd-mirror installed and running:
        # yum install rbd-mirror
# systemctl enable ceph-rbd-mirror.target
#...

Recovering from a disaster!

The following recipes will show how to fail over to the mirrored data on the backup cluster after the primary cluster ceph has encountered a disaster and how to failback once the ceph cluster has recovered. There are two methods for failover when dealing with a disaster:

  • Orderly: Failover after an orderly shutdown. This would be a proper shutdown of the cluster and demotion and promotion of the image.
  • Non-orderly: Failover after a non-orderly shutdown. This would be a complete loss of the primary cluster. In this case, the failback would require a resynchronizing of the image.

How to do it...

  1. How to properly failover after an orderly shutdown:
    • Stop all client's that are writing to the primary...
Left arrow icon Right arrow icon

Key benefits

  • •Implement a Ceph cluster successfully and learn to manage it.
  • •Recipe based approach in learning the most efficient software defined storage system
  • •Implement best practices on improving efficiency and security of your storage cluster
  • •Learn to troubleshoot common issues experienced in a Ceph cluster

Description

Ceph is a unified distributed storage system designed for reliability and scalability. This technology has been transforming the software-defined storage industry and is evolving rapidly as a leader with its wide range of support for popular cloud platforms such as OpenStack, and CloudStack, and also for virtualized platforms. Ceph is backed by Red Hat and has been developed by community of developers which has gained immense traction in recent years. This book will guide you right from the basics of Ceph , such as creating blocks, object storage, and filesystem access, to advanced concepts such as cloud integration solutions. The book will also cover practical and easy to implement recipes on CephFS, RGW, and RBD with respect to the major stable release of Ceph Jewel. Towards the end of the book, recipes based on troubleshooting and best practices will help you get to grips with managing Ceph storage in a production environment. By the end of this book, you will have practical, hands-on experience of using Ceph efficiently for your storage requirements.

Who is this book for?

This book is targeted at storage and cloud engineers, system administrators, or anyone who is interested in building software defined storage, to power your cloud or virtual infrastructure. If you have basic knowledge of GNU/Linux and storage systems, with no experience of software defined storage solutions and Ceph, but eager to learn then this book is for you

What you will learn

  • • Understand, install, configure, and manage the Ceph storage system
  • • Get to grips with performance tuning and benchmarking, and learn practical tips to help run Ceph in production
  • • Integrate Ceph with OpenStack Cinder, Glance, and Nova components
  • • Deep dive into Ceph object storage, including S3, Swift, and Keystone integration
  • • Configure a disaster recovery solution with a Ceph Multi-Site V2 gateway setup and RADOS Block Device mirroring
  • • Gain hands-on experience with Ceph Metrics and VSM for cluster monitoring
  • • Familiarize yourself with Ceph operations such as maintenance, monitoring, and troubleshooting
  • • Understand advanced topics including erasure-coding, CRUSH map, cache pool, and general Ceph cluster maintenance

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 24, 2017
Length: 466 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788392150
Vendor :
Canonical
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Nov 24, 2017
Length: 466 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788392150
Vendor :
Canonical
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
AU$249.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts
AU$349.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 211.97
Ceph Cookbook
AU$67.99
Learning Ceph
AU$75.99
Mastering Ceph
AU$67.99
Total AU$ 211.97 Stars icon

Table of Contents

14 Chapters
Ceph – Introduction and Beyond Chevron down icon Chevron up icon
Working with Ceph Block Device Chevron down icon Chevron up icon
Working with Ceph and OpenStack Chevron down icon Chevron up icon
Working with Ceph Object Storage Chevron down icon Chevron up icon
Working with Ceph Object Storage Multi-Site v2 Chevron down icon Chevron up icon
Working with the Ceph Filesystem Chevron down icon Chevron up icon
Monitoring Ceph Clusters Chevron down icon Chevron up icon
Operating and Managing a Ceph Cluster Chevron down icon Chevron up icon
Ceph under the Hood Chevron down icon Chevron up icon
Production Planning and Performance Tuning for Ceph Chevron down icon Chevron up icon
The Virtual Storage Manager for Ceph Chevron down icon Chevron up icon
More on Ceph Chevron down icon Chevron up icon
An Introduction to Troubleshooting Ceph Chevron down icon Chevron up icon
Upgrading Your Ceph Cluster from Hammer to Jewel Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(9 Ratings)
5 star 66.7%
4 star 0%
3 star 22.2%
2 star 11.1%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Toby366 Mar 02, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Easy to follow helped me so much!
Amazon Verified review Amazon
Allen Murphey May 19, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Despite being a few versions behind a fast-moving system, this book has been a life-saver for getting up and going with Ceph quickly. The checklist/recipe format is extremely reference friendly, but the overall book is a readable introduction as well. But it is definitely hands-on and that has definitely helped me.
Amazon Verified review Amazon
John May 04, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've worked with Ceph for over six years. Production Ceph deployments often start at the petabyte level, and grow from there. Additionally, Ceph supports file, block and object interfaces on the same storage platform. Ceph is open-source, free and powerful. It is also a de facto back end for OpenStack Nova, Glance and Cinder. These factors make Ceph both very exciting and a little bit intimidating for first time users.By contrast, learning how to use Ceph usually starts on a much smaller scale--often with a personal computer and some virtual machines. The Ceph Cookbook identifies all of the required software (open source, and free), and step-by-step guidance for deploying a Ceph cluster on a small scale. The skills you learn from the Ceph Cookbook can transfer directly to production environments. Ceph Cookbook also provides detailed step-by-step guidance on how to use the file, block and object interfaces, including their advanced features such as taking snapshots, disaster recovery, and even how to integrate Ceph with OpenStack! With the Ceph Cookbook, you can learn Ceph concepts and features on a small scale and transfer those skills directly to large scale production environments.By following the step-by-step examples provided by Ceph veterans, Vikhyat, Michael and Karan, the Ceph Cookbook will take you from a novice level to a competent Ceph user in short order. The Ceph Cookbook is well worth it!
Amazon Verified review Amazon
Amazon Customer Jan 29, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I was a newby to Ceph and software defined storage, and this book has helped greatly with my success with the product. Highly recommend!!
Amazon Verified review Amazon
Joe Q. Jan 25, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have been working with Ceph for almost 2 years now, and many times I find myself searching many different documents to find the required commands or configurations that I require. Since aquiring this book I have been able to perform all of my daily tasks while referencing the book for any steps or procedures I need to manage my clusters, I no longer need to bounce between multiple guides. All of the steps are very detailed and easy to follow, and even include nice screenshots. I would recommend this cookbook for anyone just starting out with Ceph or anyone that deploys or manages Ceph on a daily basis. This is an excellent resource to have handy!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.