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
Free Trial
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (9 Ratings)
Paperback Nov 2017 466 pages 2nd Edition
eBook
₱1399.99 ₱2000.99
Paperback
₱2500.99
Subscription
Free Trial
Arrow left icon
Profile Icon Umrao Profile Icon Hackett Profile Icon Karan Singh
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (9 Ratings)
Paperback Nov 2017 466 pages 2nd Edition
eBook
₱1399.99 ₱2000.99
Paperback
₱2500.99
Subscription
Free Trial
eBook
₱1399.99 ₱2000.99
Paperback
₱2500.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781788391061
Vendor :
Canonical
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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 ₱260 each
Feature tick icon Exclusive print discounts
$279.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 ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 7,808.97
Ceph Cookbook
₱2500.99
Learning Ceph
₱2806.99
Mastering Ceph
₱2500.99
Total 7,808.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.