How To Configure or Build Ceph Storage Cluster in Openstack
How To Configure or Build Ceph Storage Cluster in Openstack
in Openstack ( CentOS 7 )
Table of Contents
o Monitors:
o Managers:
o Ceph OSDs:
• My infrastructure detail.
• About ceph-deploy tool
• Install pre-requisite rpms
• Configure NTP
• Create ceph user
• Enable Passwordless SSH
• Validate connectivity
• Open firewall ports
o Handle Selinux
• Steps to build ceph storage cluster
o Create the cluster:
o Install Ceph packages from your admin node:
o Add OSDs:
o OSD dump
o CRUSH dump
o OSD list
o Get the quorum status
In my last article I shared the steps to configure controller node in OpenStack manually, now in this
article I will share the steps to configure and build ceph storage cluster using CentOS 7. Ceph is an
open source, scalable, and software-defined object store system, which provides object, block, and
file system storage in a single platform. Ceph has a capability to self-heal, self-manage, and does not
have a single point of failure. It is a perfect replacement for a traditional storage system and an
efficient storage solution for the object and block storage of cloud environments.
Before we start with the steps to build ceph storage cluster, let us understand some basic
terminologies
Monitors:
A Ceph Monitor (ceph-mon) maintains maps of the cluster state, including the monitor map,
manager map, the OSD map, and the CRUSH map. These maps are critical cluster state required for
Ceph daemons to coordinate with each other. Monitors are also responsible for managing
authentication between daemons and clients. At least three monitors are normally required for
redundancy and high availability.
Managers:
A Ceph Manager daemon (ceph-mgr) is responsible for keeping track of runtime metrics and the
current state of the Ceph cluster, including storage utilization, current performance metrics, and
system load. The Ceph Manager daemons also host python-based plugins to manage and expose
Ceph cluster information, including a web-based dashboard and REST API. At least two managers
are normally required for high availability.
Ceph OSDs:
A Ceph OSD (object storage daemon, ceph-osd) stores data, handles data replication, recovery,
rebalancing, and provides some monitoring information to Ceph Monitors and Managers by
checking other Ceph OSD Daemons for a heartbeat. At least 3 Ceph OSDs are normally required for
redundancy and high availability.
My infrastructure detail.
We will build ceph storage cluster with two nodes ceph storage with one OSD per storage node and
one admin node where we will perform most of our tasks. So in total we have three virtual machines
running on Oracle Virtual Box on top of my Windows laptop.
Below are the configuration I have used for my storage and admin nodes
Add the Ceph repository to your yum configuration file at /etc/yum.repos.d/ceph.repo with the
following command. Replace {ceph-stable-release} with a stable Ceph release (e.g., mimic.)
# cat /etc/yum.repos.d/ceph.repo
[ceph-noarch]
name=Ceph noarch packages
baseurl=https://download.ceph.com/rpm-mimic/el7/noarch/
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc
Configure NTP
To build ceph storage cluster it is very important that all the nodes part of the cluster are in time sync
with each other. So NTP is very important. Install the ntp package and configure your ntp.conf with
your nearest server
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
Next start and enable your ntp daemon on both the storage node
# useradd ceph
# echo redhat | passwd --stdin ceph
# ssh-keygen -t rsa
# ssh-copy-id ceph@storage1
# ssh-copy-id ceph@storage2
Modify the ~/.ssh/config file of your ceph-deploy admin node so that ceph-deploy can log in to
Ceph nodes as the user you created without requiring you to specify --username {username} each
time you execute ceph-deploy. This has the added benefit of streamlining ssh and scp usage.
# cat ~/.ssh/config
Host storage1
Hostname storage1
User ceph
Host storage2
Hostname storage2
User ceph
Validate connectivity
Now since our password less is setup it is time to validate the connectivity
# ssh ceph@storage1
Last login: Sat Nov 17 12:48:38 2018 from 10.0.2.10
[ceph@storage1 ~]$ logout
Connection to storage1 closed.
# ssh ceph@storage2
Last login: Sat Nov 17 12:30:31 2018 from 10.0.2.13
[ceph@storage2 ~]$ logout
Connection to storage2 closed.
On monitors
On OSDs
Once you have finished configuring firewalld with the --permanent flag, you can make the changes
live immediately without rebooting:
# firewall-cmd --reload
Handle Selinux
On CentOS and RHEL, SELinux is set to Enforcing by default. To streamline your installation, we
recommend setting SELinux to Permissive or disabling it entirely and ensuring that your installation
and cluster are working properly before hardening your configuration. To set SELinux to Permissive,
execute the following:
# setenforce 0
Ensure that your package manager has priority/preferences packages installed and enabled. On
CentOS, you may need to install EPEL. On RHEL, you may need to enable optional repositories.
Create a directory on your admin node for maintaining the configuration files and keys that ceph-
deploy generates for your cluster.
# mkdir my-cluster
and navigate inside this directory as the ceph-deploy tool will create all the required configuration
file in your current working directory
# cd my-cluster
On your admin node from the directory you created for holding your configuration details, perform
the following steps using ceph-deploy.
Check the output of ceph-deploy with ls and cat in the current directory. You should see a Ceph
configuration file (ceph.conf), a monitor secret keyring (ceph.mon.keyring), and a log file for the
new cluster.
If you have more than one network interface, add the public network setting under the [global]
section of your Ceph configuration file. See the Network Configuration Reference for details.
Once you complete the process, your local directory should have the following keyrings:
ceph.client.admin.keyring
ceph.bootstrap-mgr.keyring
ceph.bootstrap-osd.keyring
ceph.bootstrap-mds.keyring
ceph.bootstrap-rgw.keyring
ceph.bootstrap-rbd.keyring
Use ceph-deploy to copy the configuration file and admin key to your admin node and your Ceph
Nodes so that you can use the ceph CLI without having to specify the monitor address and
ceph.client.admin.keyring each time you execute a command.
Add OSDs:
NOTE:
For the purposes of these instructions, we assume you have an unused disk in each node called
/dev/sdc. Be sure that the device is not currently in use and does not contain any important data.
# ceph-deploy osd create --data /dev/sdc storage1
<< Output trimmed >>
[storage1][INFO ] Running command: sudo /bin/ceph --cluster=ceph osd stat --
format=json
[ceph_deploy.osd][DEBUG ] Host storage1 is now ready for osd use.
# ceph-deploy osd create --data /dev/sdc storage2
<< Output trimmed >>
Now we brought up a functioning Ceph cluster from scratch and incrementally scaled it without
taking it down. Next we’ll explore a number of operations we can perform to customise, populate,
and manage Ceph clusters.
services:
mon: 2 daemons, quorum storage1,storage2
mgr: storage1(active)
osd: 2 osds: 2 up, 2 in
data:
pools: 0 pools, 0 pgs
objects: 0 objects, 0 B
usage: 2.0 GiB used, 6.0 GiB / 8.0 GiB avail
pgs:
OSD dump
The ceph osd dump command shows a wealth of lower-level information about our clusters. This
includes a list of pools with their attributes and a list of OSDs each including reweight adjustment,
up/in status, and more. This command is mostly used in unusual troubleshooting situations.
CRUSH dump
This command presents much the same information as ceph osd tree, though in a different, JSON,
format.
OSD list
The ceph osd ls command simply returns a list of the OSD numbers currently deployed within the
cluster.
{
"election_epoch": 8,
"quorum": [
0,
1
],
"quorum_names": [
"storage1",
"storage2"
],
"quorum_leader_name": "storage1",
"monmap": {
"epoch": 1,
"fsid": "454f796c-ed9f-4242-89b4-e0d43f740ffd",
"modified": "2018-11-17 13:17:57.395486",
"created": "2018-11-17 13:17:57.395486",
"features": {
"persistent": [
"kraken",
"luminous",
"mimic",
"osdmap-prune"
],
"optional": []
},
"mons": [
{
"rank": 0,
"name": "storage1",
"addr": "10.0.2.13:6789/0",
"public_addr": "10.0.2.13:6789/0"
},
{
"rank": 1,
"name": "storage2",
"addr": "10.0.2.14:6789/0",
"public_addr": "10.0.2.14:6789/0"
}
]
}
}
Reference:
Lastly I hope the steps from the article to build ceph storage cluster in Openstack using CentOS 7
Linux was helpful. So, let me know your suggestions and feedback using the comment section
Cinder vs Swift storage in OpenStack – Basic
Difference and Comparison
Earlier I had shared an article with the steps to configure ceph storage cluster in OpenStack. Now
let me give you some brief overview on comparison and difference between cinder vs swift storage
in OpenStack.
Let me give some brief overview and examples to explain you the difference between Cinder vs
Swift Storage.
• Similarly, the cinder service will do the storage team’s job in OpenStack. The Cinder block
storage service will take care of providing the additional disk volume to the user. Once the
new disk volume is allocated to the user tenant (project), the user has the flexibility to map
(attach) the volume storage to any VMs between the same project. A Cinder volume is very
similar to an external HDD; you cannot attach the single cinder volume to two or more
virtual machines at the same time, however we could connect the single cinder volume to
any virtual machine, one at a time.
• The logical architecture diagram shows how various processes and daemons work together
to perform the block storage service (Cinder) in OpenStack, and the interconnection between
them:
Swift (Object storage)
• Swift is a object storage device.
• Object storage is very similar to cloud storage, such as Google Drive or Dropbox. As an
end user, we can only experience the end user window of Google Drive or Dropbox for
storing and retrieving the files. However, the actions carried out by the group of processes
and daemons behind the end user screen to save and recover the file has very complex object
storage architecture.
• The Swift service is quite different from other OpenStack services because we can configure
Swift services as standalone services to provide only the object storage services to the end
users, without setting IAAS features.
• For OpenStack, the Swift service is rated under the additional services, not the core one
because the primary purpose of OpenStack is to provide Infrastructure-as-a-Service
(IAAS) to end users. However, Swift is not a mandatory service to bring up the IAAS
feature.
• As an additional service, the Swift service can be configured with other OpenStack services
like Glance and Cinder for storing/retrieving the Glance images and to back up the cinder-
volumes respectively.
• The following logical architecture diagram shows how various processes and daemons
work together to bring up the object storage service (Swift) in OpenStack, and the
interconnection between the services:
Lastly I hope the steps from the article to understand the difference and comparison between Cinder
vs Swift storage in OpenStack was helpful. So, let me know your suggestions and feedback using the
comment section.
Understanding nova compute architecture
basics in Openstack (flow chart)
Table of Contents
Earlier I had shared an article with the steps to configure ceph storage cluster in OpenStack. Now
let me give you some brief overview on the nova compute architecture and how all the services
within nova compute communicate with each other. What is the role of each service under nova
compute? What is the role of nova-api, nova-scheduler, nova-console, nova-conductor, nova-
console-auth, nova-compute service in OpenStack?
Below are the list of services which are part of nova compute service:
nova-api service
• All services in OpenStack have at least one API process that accepts and responds to end user
API calls, pre-processes them, and passes the request to the appropriate process within the
service.
• For the OpenStack compute service, we have the nova-api service, which listens and
responds to the end user compute API calls. The nova-api service takes care of initiating
most orchestration activities, such as provisioning new virtual machines.
nova-api-metadata service
• The metadata service delivers the instance-specific data to the virtual machine instances. The
instance-specific data includes hostname, instance-id, ssh-keys, and so on. The virtual
machine accesses the metadata service via the special IP address at
http://169.254.169.254.
nova-compute service
• Underneath, the entire lifecycle of the virtual machine is managed by the hypervisors.
Whenever the end user submits the instance creation API call to the nova-api service, the
nova-api service processes it and passes the request to the nova-compute service. The nova-
compute service processes the nova-api call for new instance creation and triggers the
appropriate API request for virtual machine creation in a way that the underlying hypervisor
can understand.
• For example, if we choose to use the KVM hypervisor in the OpenStack setup, when the end
user submits the virtual machine creation request via the OpenStack dashboard, the nova-api
calls will get sent to the nova-api service. The nova-api service will pass the APIs for
instance creation to the nova-compute service. The nova-compute service knows what API
the underlying KVM hypervisor will support. Now, pointing to the underlying KVM
hypervisor, the nova-compute will trigger the libvirt-api for virtual machine creation.
Then, the KVM hypervisor processes the libvirt-api request and creates a new virtual
machine.
• OpenStack has the flexibility to use multi-hypervisor environments in the same setup, that is,
we could configure different hypervisors like KVM and VMware in the same OpenStack
setup. The nova-compute service will take care of triggering the suitable APIs for the
hypervisors to manage the virtual machine lifecycle.
nova-scheduler service
• When we have more than one compute node in your OpenStack environment, the nova-
scheduler service will take care of determining where the new virtual machine will
provision. Based on the various resource filters, such as RAM/CPU/Disk/Availability Zone,
the nova-scheduler will filter the suitable compute host for the new instance:
nova-conductor module
• The nova-compute service running on the compute host has no direct access to the database
because if one of your compute nodes is compromised, then the attacker has (almost) full
access to the database. With the nova-conductor daemon, the compromised node cannot
access the database directly, and all the communication can only go through the nova-
conductor daemon. So, the compromised node is now limited to the extent that the conductor
APIs allow it.
• The nova-conductor module should not be deployed on any compute nodes, or else the
purpose of removing direct database access for the nova-compute will become invalid.
nova-consoleauth daemon
The nova-consoleauth daemon takes care of authorizing the tokens for the end users, to access a
remote console of the guest virtual machines provided by the following control proxies:
• The nova-novncproxy daemon provides a proxy for accessing running instances through a
VNC connection.
• The nova-spicehtml5proxy daemon provides a proxy through a SPICE connection
nova-cert module
• Used to generate X509 certificates for euca-bundle-image, and only needed for the EC2 API.
The queue (AMQP message broker)
Database
• Most of the OpenStack services use an SQL database to store the build-time, and run-time
states for a cloud infrastructure, such as instance status, networks, projects, and the list goes
on. In short, we could say the database is the brain of OpenStack.
• The most tested and preferable databases to use in OpenStack are MySQL, MariaDB, and
PostgreSQL.
Lastly I hope this article on understanding nova compute architecture on OpenStack was helpful. So,
let me know your suggestions and feedback using the comment section.
OpenStack Command Line Cheat Sheet
(Beginner’s Guide)
Table of Contents
• Identity (Keystone)
• Flavor
• Security Group
• Keypair
• Glance Image
• Neutron (Network)
• Server (Instance)
• Block Storage
• Snapshot
• Guestfish
In this article I will share some of the basic OpenStack command line cheat sheet which can be
useful for beginners starting with OpenStack.
Identity (Keystone)
To list the installed users
Flavor
Create flavor named m1.petite with 1 vcpu, 1 GB RAM, 10 GB Disk and must not be publicly
accessible
openstack flavor create --id auto --vcpus 1 --ram 1024 --disk 10 --private
m1.petite
Security Group
Create security group with name ssh
Add a rule to allow ssh and icmp in the ssh security group
openstack security group rule create --ingress --protocol tcp --dst-port 22 ssh
openstack security group rule create --ingress --protocol tcp --protocol icmp ssh
Keypair
Create a keypair with name webkey in your home folder
Glance Image
Create a glance image webimage using a file osp-small.qcow2 available inside /tmp
Neutron (Network)
Create a public and private network under Engineering project
Server (Instance)
Create an instance/server using the flavor m1.petite, key as webkey, security group as ssh and
Router1 network
Block Storage
Create a 2GB block storage volume named storage
Snapshot
Before creating snapshot detach the volume from webserver instance
Here strgsnap is the snapshot name and storage is the name of the volume attached
Guestfish
Edit an image using guestfish
Above we are installing httpd, enabling the service, creating a password less user Sheila, creating a
dummy index.html file and updating the selinux context which is the most important part. Without
this your image will not work.
Lastly I hope this article with OpenStack command line cheat sheet was helpful. So, let me know
your suggestions and feedback using the comment section.
What is the difference between Root Disk vs
Ephemeral Disk in OpenStack
Before starting to understand about different disk types and the difference between root disk vs
ephemeral disk in OpenStack, you must understand what are Flavors and how to create a flavor.
Persistent storage, on the other hand, is designed to survive (“persist”) independent of any
running instance. This storage is used for any data that needs to be reused, either by different
instances or beyond the life of a specific instance.
Each instance needs at least one root disk (that contains the bootloader and core operating system
files), and may have optional ephemeral disk. The content for the root disk either comes from an
image stored within the Glance repository (and copied to storage attached to the destination
hypervisor) or from a persistent block storage volume (via Cinder).
• The root disk contains the operating system for the image, and it is created using an image as
a template.
• If the size of the root disk is smaller than the minimum disk defined by the image,
the instance is not deployed.
• The OpenStack compute service supports the use of root disks based on OpenStack volumes
in order to make root disks persistent.
Ephemeral Disk:
• The ephemeral disk in a flavor defines how much additional disk space is going to be
available to the instance.
• To make this space available, a device is created in the instance.
• The size of that device is the size defined for the ephemeral disk in the flavor.
• This device is a raw device, so it needs to be partitioned and formatted with a file system.
• By default, the size of an ephemeral disk in a flavor is 0 GB.
Lastly I hope the this article on difference between root disk vs ephemeral disk in OpenStack was
helpful. So, let me know your suggestions and feedback using the comment section.
Step by Step Instance Creation Flow in
OpenStack
Have you ever think what happened in the background whenever we create an instance or virtual
machine either via Openstack cli or dashboard, In this this article we will elaborate step by step VM
or instance creation in Openstack. All the Openstack components communicate with each other with
API using Auth-token.
Source the credential file and then execute the nova-boot command,
Once nova boot command is executed then following are steps are executed behind the scene,
Step:1) The Horizon Dashboard or OpenStack CLI gets user credentials and authenticates with
identity service via REST API
• The identity service (Keystone) authenticate the user with the user credentials and then generates
and send back an auth-token, that auth-token which will be used for sending the request to other
components through REST-Call
Step:2) The Dashboard or OpenStack CLI converts new instance request specified in launch instance
or nova boot command to a REST API request and sent it to nova-api
Step:3) Then nova-api service gets the request and send that request to the identity service
(Keystone) for validation of auth-token and access permission,
• Keystone service validates the token and send the updated authentication headers with roles along
with the permissions
Step:4) After getting the repsonse from keystone, then nova-api checks for conflicts with nova-
database and then it creates initial database entry for new instance or VM.
Step:5) nova-api sends the rpc.call request to nova-scheduler expecting to get updated instance entry
with host id specified
Step:7) nova-scheduler talks to nova-database to locate an appropriate host using filtering and
weighing mechanism,
• nova-scheduler returns the updated instance entry with the appropriate host ID after filtering and
weighing
• nova-scheduler sends the rpc.cast request to nova compute for launching an instance on the
appropriate host
Step:8) nova-compute picks the request from the queue and it sends the rpc.call request to nova-
conductor to get the VM or instance info such as host id and flavor (RAM,CPU and Disk)
Step:9) nova-conductor takes the request from queue and communicate with nova-database,
Step:10) nova-compute connects to glance-api by making a REST Call using auth-token and then
nova-compute uses the image id to get the image URI from image service and loads the image from
image storage
Step:11) glance-api validates the auth-token with keystone and after that nova-compute gets the
image metadata
Step:12) Nova-compute make the REST-call by passing the auth-token to Network API (Neutron) to
allocate and configure network so that vm gets the IP address
Step:13) Neutron-server validates the auth-token with keystone and after that nova-compute
retrieves the network information.
Step:14) Nova-Compute makes the REST-call by passing the auth-token to Volume API to attach
the volume to the instance or VM.
Step:15) cinder-api validates the auth-token with keystone and then nova-compute gets the block
storage information.
Step:16) nova-compute generates data for the hypervisor driver and executes the request on the
hypervisor using libvirt or API and then finally a VM is created on the hypervior. We can see that
VM in Dashboard and also using “nova list” command.
That’s all from the article, i hope you find this article informative. Please do share your feedback and
comments.