<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hojat Gazestani on Medium]]></title>
        <description><![CDATA[Stories by Hojat Gazestani on Medium]]></description>
        <link>https://medium.com/@hojat_gazestani?source=rss-6fbbd5f657a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*o7D3SfKkmxnFsWRV</url>
            <title>Stories by Hojat Gazestani on Medium</title>
            <link>https://medium.com/@hojat_gazestani?source=rss-6fbbd5f657a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:11:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hojat_gazestani/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ Basic Ceph RGW Setup and S3 Access with AWS CLI and Python boto3]]></title>
            <link>https://medium.com/@hojat_gazestani/basic-ceph-rgw-setup-and-s3-access-with-aws-cli-and-python-boto3-c3db142d3b55?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3db142d3b55</guid>
            <category><![CDATA[aws-cli]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[ceph]]></category>
            <category><![CDATA[rgw]]></category>
            <category><![CDATA[object-storage]]></category>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Sun, 27 Apr 2025 02:22:44 GMT</pubDate>
            <atom:updated>2025-04-30T20:14:18.748Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*e4_KHt8Fndgw3YsBOH5OMw.png" /><figcaption><strong>RADOS Gateway</strong></figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5qCOdSccfDs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5qCOdSccfDs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5qCOdSccfDs%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b478622e1f0579d576e3d9db882b13d/href">https://medium.com/media/0b478622e1f0579d576e3d9db882b13d/href</a></iframe><p>Object storage solutions are becoming increasingly essential in today&#39;s rapidly growing data. <strong>Ceph’s RADOS Gateway (RGW)</strong> offers a robust, S3-compatible object storage service that can seamlessly integrate with your applications.</p><p>In this article, we’ll walk through setting up a basic Ceph RGW, creating a user, connecting with the AWS CLI, managing objects, and even interacting programmatically via Python’s boto3 library.</p><p>All commands are also available through my <a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/octapus/11-Basic%20Ceph%20RGW%20Setup%20and%20S3%20Access%20with%20AWS%20CLI.md">GitHub repository</a>.</p><h3>📦 Deploying the RGW Service</h3><p>We need to deploy the RADOS Gateway (RGW) instance in the Ceph storage cluster. Thanks to the <strong>Ceph Orchestrator</strong>, this is straightforward.</p><pre># Deploy a basic RADOS Gateway (RGW) instance using Ceph Orchestrator.<br>ceph orch apply rgw rgw-basic<br><br># Verify that the RGW service is running.<br>ceph -s | grep rgw<br>ceph orch ls | grep rgw<br>ceph orch ps | grep rgw<br><br># Check the default pools created for RGW.<br>ceph osd pool ls | grep rgw</pre><h4>⚠️ Ceph Orchestrator RGW Deployment Failure Due to Port Conflict on Port 80</h4><p>🔍 Root Cause</p><p>The orchestrator is trying to deploy a <strong>second RGW instance</strong> (rgw.rgw-basic) on ceph-mon2, <strong>binding to port 80</strong>, but that port is already in use—possibly by another RGW instance, web service, or even an admin dashboard.</p><pre>HEALTH_WARN Failed to place 1 daemon(s)<br>...<br>Cannot bind to IP 0.0.0.0 port 80: [Errno 98] Address already in use</pre><p>✅ Fix Options</p><h4>🛠 Option 1: Remove rgw.tgwtest</h4><p>To remove the RGW service rgw.tgwtest, you can use the ceph orch rm command.</p><p>Here&#39;s how:</p><pre>ceph orch rm rgw.tgwtest</pre><h4>🛠 Option 2: Change the port used by the second RGW daemon</h4><p>Update the RGW rgw.rgw-basic service to use a different port (e.g. 8080):</p><pre>ceph orch apply rgw rgw-basic --port 8080 --placement=&quot;count:2&quot;</pre><h3>👤 Creating a Basic RGW User</h3><p>To access the RGW service, we’ll need a user.</p><pre># Create a new RGW user.<br>radosgw-admin user create --uid=rgwuser-basic --display-name=&quot;RGWuser Basic&quot;<br><br># List all users and get user details.<br>radosgw-admin user list<br>radosgw-admin user info --uid rgwuser-basic</pre><h3>🔗 Connecting to RGW Endpoint Using AWS CLI on Ubuntu</h3><p>Once your user is created, the next step is setting up AWS CLI on Ubuntu to interact with the Ceph RGW endpoint.</p><pre>sudo apt  install awscli<br><br># Configure AWS CLI with the new profile.<br>aws configure --profile=rgwuser-basic<br># Provide:<br># - Access Key<br># - Secret Key<br># - Output format (e.g., json)<br><br># Verify configuration<br>cat ~/.aws/config<br>cat ~/.aws/credentials<br><br># Test connection to RGW endpoint<br>RGW_ENDPOINT=http://192.168.1.1<br>aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3 ls</pre><h3>🛠 Uploading, Listing, and Managing Objects</h3><p>With the connection established, you can now perform common object storage operations using the AWS CLI:</p><pre>export BUCKET_NAME=buckebasic<br>export RGW_ENDPOINT=&lt;Your Endpoint URL&gt;<br>export AWS_ACCESS_KEY_ID=&lt;Your key ID&gt;<br>export AWS_SECRET_ACCESS_KEY=&lt;Your access key&gt;<br><br># Create a Bucket<br>aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3 mb s3://${BUCKET_NAME}<br>radosgw-admin user info --uid rgwuser-basic<br>radosgw-admin bucket list --uid=rgwuser-basic<br>radosgw-admin bucket stats --bucket=buckebasic<br><br># Upload a File<br>aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3api put-object --bucket ${BUCKET_NAME} --key testfile --body /etc/services<br># List Objects<br>aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3api list-objects --bucket ${BUCKET_NAME}<br></pre><p>You can also upload larger files and measure the performance:</p><pre># Create a 100MB file<br>dd if=/dev/zero of=100mb.file bs=1M count=100<br><br># Upload<br>time aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3 cp 100mb.file s3://${BUCKET_NAME}/</pre><p><strong>Pro tip</strong>: To upload or delete multiple files, loop through commands with a simple Bash for loop! 😉</p><pre><br># Upload multiple files<br>for num in {1..20}; do <br>    dd if=/dev/zero of=100mb.file${num} bs=1M count=100 <br>done<br><br># Upload multiple files<br>for num in {1..20}; do <br>    aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3api put-object --bucket ${BUCKET_NAME} --key testfile${num} --body /etc/services <br>done<br><br># Delete multiple files<br>for num in {1..20}; do <br>    aws --profile rgwuser-basic --endpoint-url=${RGW_ENDPOINT} s3api delete-object --bucket ${BUCKET_NAME} --key testfile${num} <br>done</pre><h3>🐍 Managing AWS S3 Objects Programmatically with Python (boto3)</h3><p>Here’s how you can use <strong>Python’s boto3 library</strong> to manage your Ceph RGW storage!</p><pre>import boto3<br>import os<br><br># Load config from environment variables<br>config = {<br>    &#39;endpoint_url&#39;: os.environ[&#39;RGW_ENDPOINT&#39;],<br>    &#39;aws_access_key_id&#39;: os.environ[&#39;AWS_ACCESS_KEY_ID&#39;],<br>    &#39;aws_secret_access_key&#39;: os.environ[&#39;AWS_SECRET_ACCESS_KEY&#39;]<br>}<br><br># Initialize S3 client<br>s3 = boto3.client(&#39;s3&#39;, **config)<br><br># Test connection<br>try:<br>    s3.list_buckets()<br>    print(&quot;✅ Successfully connected to RGW!&quot;)<br>except Exception as e:<br>    print(f&quot;❌ Connection failed: {str(e)}&quot;)<br><br># Upload a file<br>s3.upload_file(&#39;100mb.file&#39;, &#39;buckebasic&#39;, &#39;100mb.file&#39;)<br><br># List objects in bucket<br>response = s3.list_objects(Bucket=&#39;buckebasic&#39;)<br>for obj in response[&#39;Contents&#39;]:<br>    print(obj[&#39;Key&#39;])<br><br># Generate a pre-signed URL (valid for 1 hour)<br>url = s3.generate_presigned_url(https://medium.com/&#39;get_object&#39;,%20Params={&#39;Bucket&#39;:%20&#39;buckebasic&#39;,%20&#39;Key&#39;:%20&#39;100mb.file&#39;},%20ExpiresIn=3600)<br>print(url)</pre><h3>🧠 Final Thoughts</h3><p>Setting up Ceph RGW and accessing it through the AWS CLI (or programmatically via boto3) opens up a powerful, flexible world of <strong>S3-compatible storage</strong> under your full control.</p><p>With these basic steps, you can build scalable, high-availability storage solutions for your infrastructure.</p><p>If you found this guide helpful, consider sharing it or leaving a comment! 🚀<br> Happy storing! 🌟</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3db142d3b55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Ceph RBD as a Persistent Storage Backend for MariaDB on Ubuntu]]></title>
            <link>https://medium.com/@hojat_gazestani/how-to-use-ceph-rbd-as-a-persistent-storage-backend-for-mariadb-on-ubuntu-eed70e09a4e9?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/eed70e09a4e9</guid>
            <category><![CDATA[ceph]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[distributed-storage]]></category>
            <category><![CDATA[mariadb]]></category>
            <category><![CDATA[backend-storage]]></category>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Thu, 24 Apr 2025 11:23:52 GMT</pubDate>
            <atom:updated>2025-04-26T10:49:52.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*weV2nOkpwzGMY-r9NcBP-g.png" /><figcaption>How to Use Ceph RBD as a Persistent Storage Backend for MariaDB on Ubuntu</figcaption></figure><p>My YouTube video tutorial</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FgPww_mr2ngs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DgPww_mr2ngs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FgPww_mr2ngs%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/27cd355a1fa8367b18ccfeb0fd2be91e/href">https://medium.com/media/27cd355a1fa8367b18ccfeb0fd2be91e/href</a></iframe><h3>Introduction</h3><p>Ceph is a powerful open-source storage platform that provides unified storage for block, object, and file workloads. One of its key features is the <strong>RADOS Block Device (RBD)</strong>, which offers block storage similar to AWS EBS volumes.</p><p>In this tutorial, we’ll demonstrate how to use a <strong>Ceph RBD volume as persistent storage for MariaDB</strong> on an <strong>Ubuntu 22.04</strong> server. This setup is especially useful for high-availability and distributed environments where multiple clients may need access to the same data.</p><p>We will cover the entire process — from creating the Ceph pool and volume to mounting the volume on a client machine and configuring MariaDB to use it as its data directory. By the end, you’ll also see how to access the same database volume from another host using the Ceph cluster.</p><p>💡 All commands and configuration files used in this tutorial are available on my <a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/octapus/10-ceph-rbd-mariadb.md">GitHub repository</a>.</p><h4>Prerequisites</h4><pre>## Prerequisites<br><br>- Ubuntu 22.04 server (client and Ceph cluster)<br>- Ceph 19.2.1 (Squid release)<br>- MariaDB 10.6.x<br>- A working Ceph cluster<br>- `ceph-common` and `rbd` tools installed on the client</pre><h3>Step 1: Create a Ceph Block Storage Pool</h3><p>Before we can create a block device (RBD), we need a <strong>storage pool</strong> in the Ceph cluster. A pool is a logical group of storage objects, and it’s where our RBD volume will reside.</p><p>Let’s create a pool named mariadb-pool and initialize it for RBD usage:</p><pre>ceph osd pool create mariadb-pool <br>ceph osd pool get mariadb-pool all --format json-pretty<br>ceph osd pool ls detail         <br>rbd pool init mariadb-pool   <br>ceph osd pool ls detail      </pre><p>✅ <strong>Note:</strong> The rbd pool init command enables the pool to store RBD images. This is essential for RBD functionality.</p><h3>Step 2: Create an RBD Volume</h3><p>Now that we have a storage pool, we can create an RBD image (volume) inside it. This volume will act like a raw disk that we can attach and mount on our Linux client.</p><p>Let’s create a <strong>10 GB</strong> RBD volume named mariadb-volume:</p><pre>rbd create --size 10G --pool mariadb-pool mariadb-volume  <br>rbd ls --pool mariadb-pool -l  <br>ceph osd pool get mariadb-pool all --format json-pretty<br><br>rbd info mariadb-pool/mariadb-volume</pre><p>💡 You can change the volume size as needed. For production, consider your database size and growth estimates.</p><h3>Step 3: Configure CephX Authentication</h3><p>Ceph uses a built-in authentication system called <strong>CephX</strong> to secure access to its services. Since we’re working with a shared storage cluster, it’s important to create a <strong>restricted client</strong> that only has access to the resources it needs.</p><p>Let’s create a client named client.mariadb with:</p><ul><li><strong>Read access</strong> to the monitor (mon)</li><li><strong>Read/write/execute access</strong> to the mariadb-pool:</li></ul><pre>ceph auth add client.mariadb mon &#39;allow r&#39; osd &#39;allow rwx pool=mariadb-pool&#39;  <br>ceph auth get client.mariadb  <br><br>ceph config generate-minimal-conf</pre><h3>Step 4: Prepare the Client Machine</h3><p>Now let’s set up the <strong>Ubuntu client</strong> that will use the Ceph RBD volume. This involves installing the necessary tools, configuring the Ceph client, and ensuring the system can communicate with the cluster.</p><pre>CEPH_RELEASE=19.2.1<br>curl --silent --remote-name --location https://download.ceph.com/rpm-${CEPH_RELEASE}/el9/noarch/cephadm<br>chmod +x cephadm<br>sudo ./cephadm add-repo --release squid<br>sudo apt update -y<br>sudo apt install ceph-common -y<br>ceph -v</pre><h3>📄 Configure Ceph on the Client</h3><p><strong>Copy the minimal config file</strong> generated in Step 3 (ceph.conf) from the Ceph cluster to the client:</p><pre>sudo vim /etc/ceph/ceph.conf  <br># Paste minimal Ceph config</pre><p><strong>Add the client keyring</strong>:</p><pre>sudo vim /etc/ceph/ceph.keyring  <br># Paste client.mariadb’s keyring</pre><p>🧩 Load the RBD Kernel Module</p><p>Finally, make sure the client can interact with RBD devices:</p><pre>sudo modprobe rbd</pre><h3>Step 5: Map and Mount the RBD Volume</h3><p>With the Ceph client configured and the kernel module loaded, it’s time to <strong>attach the RBD volume to the client machine</strong> and mount it so MariaDB can use it as its data directory.</p><pre>sudo rbd -n client.mariadb device map --pool mariadb-pool mariadb-volume  <br>sudo mkfs.ext4 /dev/rbd0 <br>mkdir /var/lib/mysql <br>sudo mount /dev/rbd0 /var/lib/mysql  <br>ls -l /var/lib/mysql<br>df -h | grep rbd  </pre><h3>Step 6: Install MariaDB and Use the RBD Storage Backend</h3><p>Now that the RBD volume is mounted, we can install <strong>MariaDB</strong> and configure it to use the mounted Ceph volume as its data directory.</p><pre>sudo apt install -y mariadb-server<br>sudo systemctl start mariadb<br>sudo systemctl enable mariadb<br>sudo systemctl status mariadb</pre><h3>🗂️ Configure MariaDB Database</h3><p>Let’s create a test database and verify everything is working as expected:</p><pre><br>sudo mysql -u root -e &quot;CREATE DATABASE cephrbd;&quot;<br><br>sudo mysql -u root -e &quot;SHOW DATABASES;&quot;<br><br># Stop MariaDB and unmount the volume (since we need to configure it)<br>sudo systemctl stop mariadb<br>sudo umount /var/lib/mysql</pre><h3>Step 7: Install MariaDB on Another Client and Use the Databases</h3><p>In this step, we’ll mount the <strong>Ceph RBD volume</strong> on a second client, allowing access to the same MariaDB database from another machine.</p><h3>🔗 Map the RBD Volume on the New Client</h3><p>On the second client, map the RBD volume as follows:</p><pre>sudo rbd -n client.mariadb device map --pool mariadb-pool mariadb-volume<br>sudo mkdir -p /var/lib/mysql<br>sudo mount /dev/rbd0 /var/lib/mysql<br></pre><h3>🚀 Install MariaDB</h3><p>Install the MariaDB server package on the second client:</p><pre>sudo apt install -y mariadb-server<br><br>sudo systemctl start mariadb<br>sudo systemctl enable mariadb<br><br>sudo mysql -u root<br>show databases;</pre><h3>Conclusion</h3><p>Congratulations! You’ve successfully set up a <strong>Ceph RBD-backed MariaDB</strong> storage system on your Ubuntu clients. This setup allows you to leverage <strong>Ceph’s distributed storage</strong> capabilities to provide scalable, reliable, and high-performance storage for your MariaDB databases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eed70e09a4e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Used CephFS to Sync NGINX Configurations Across Multiple Servers]]></title>
            <link>https://medium.com/@hojat_gazestani/how-i-used-cephfs-to-sync-nginx-configurations-across-multiple-servers-f8200685fd8d?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8200685fd8d</guid>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 09:10:22 GMT</pubDate>
            <atom:updated>2025-04-23T17:58:06.586Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*nGE8kTAmiBU8f6Z-upTCMw.png" /></figure><h4>If you need a starting point, I explained how to create a CephFS volume on a fresh Ceph cluster in the following <a href="https://medium.com/@hojat_gazestani/the-complete-cephfs-tutorial-for-2024-2d0e3d161fa4">story</a>.</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FT0DW0Sd8yss%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DT0DW0Sd8yss&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FT0DW0Sd8yss%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c17430cc38132583b7af7b9e4e9c1ff0/href">https://medium.com/media/c17430cc38132583b7af7b9e4e9c1ff0/href</a></iframe><p><a href="https://medium.com/@hojat_gazestani/the-complete-cephfs-tutorial-for-2024-2d0e3d161fa4">Set up, configure, and test Cephfs distributed file storage with proper permission management and…</a></p><p>I’ve also created a YouTube video tutorial for this setup, let&#39;s build a Content Delivery Network using Ceph and Nginx. 😁.<br>All commands are available through my <a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/octapus/08-cephfs-file-storage.md">GitHub</a>.</p><h4>📡 Cluster Monitoring Commands</h4><p>Here are monitoring commands to observe the health and state of ceph cluster and CephFS. These tools help you to keep an eye on the cluster status and changes.</p><pre>ceph -w<br>watch ceph orch ps<br>watch ceph osd pool ls<br>watch ceph orch ls</pre><h4>📦 Create and Authorize CephFS Volume</h4><p>Create a new CephFS volume `cephfs-nginx` and take a look at its status.</p><pre>ceph fs volume create cephfs-nginx<br><br>ceph fs ls<br>ceph mds stat<br>ceph fs status</pre><h4>🔐 CephX client authorization</h4><p>The `ceph fs authorize command is used to grant specific clients controlled access to the CephFS. Here we grant read-write access to the root (`/`) of the `cephfs-nginx file system for the client named `client..nginx`.</p><pre>ceph fs authorize cephfs-nginx client.nginx / rw<br>ceph auth get client.nginx</pre><p>To generate ceph cluster configuration</p><pre>ceph config generate-minimal-conf</pre><h4>🔐 CephX Client Configuration</h4><p>Install required packages on the client side and add the required key, and mount the file system using `ceph-fuse. This enables clients to interact with the CephFS volume through a local mount point like `/usr/share/nginx/html/`.</p><pre>apt install ceph-fuse ceph-common ceph-fuse<br><br>cleint1 # vim /etc/ceph/ceph.keyring<br># Paste key here<br>cleint1 # vim /etc/ceph/ceph.conf<br># Paste cluster config here</pre><p>✅ Mount CephFS on both nodes at `/mnt/cephfs`.</p><pre>sudo ceph-fuse --id nginx --keyring /etc/ceph/ceph.keyring -c /etc/ceph/ceph.conf /mnt/cephfs/nginx<br>sudo ceph-fuse --id nginx /mnt/cephfs/nginx<br>df -h</pre><h4>🧪 Shared File System Consistency Test</h4><p>Verify if multiple NGINX instances (across different nodes/containers) correctly reflect changes made to the configuration or content when using a shared CephFS mount.</p><p>📌 This Test Is Useful When…</p><ul><li>You use CephFS for distributed NGINX content or config delivery</li><li>You’re deploying load-balanced NGINX servers in a clustered setup</li><li>You’re validating CephFS as a shared config/content backend</li></ul><p>Area You’re Checking</p><p>🔄 Real-time sync: Changes in /mnt/cephfs reflect immediately<br>📁 Shared mount validity: Both NGINX servers see and use the same files<br>🔒 Permission consistency: Files are readable by NGINX on both ends<br>🧩 Stat cache invalidation: NGINX reloads config/content without restart<br>🚀 Hot reload test: Whether nginx -s reload picks up new config</p><p>📦 Ensure both NGINX instances include that config file:</p><pre>sudo vim /etc/nginx/nginx.conf<br>include /mnt/cephfs/nginx/*.conf;</pre><p>📝 Edit config on Node A `/mnt/cephfs/nginx/ceph.conf`.</p><pre>sudo vim /mnt/cephfs/nginx/ceph.conf<br>http {<br>    server {<br>        listen 80 default_server;<br>        listen [::]:80 default_server;<br><br>        root /mnt/cephfs/nginx/var/www/html;<br><br>        index ceph.html index.html index.htm index.nginx-debian.html;<br><br>        server_name _;<br><br>        location / {<br>            try_files $uri $uri/ =404;<br>        }<br>    }<br>}</pre><p>📝 Edit Content on Node A `/mnt/cephfs/nginx/ceph.conf`.</p><pre>vim /mnt/cephfs/nginx/var/www/html/ceph.html<br>&quot;Hello from Ceph!&quot;</pre><p>🔁 On Node B, run:</p><pre>sudo nginx -t &amp;&amp; sudo nginx -s reload</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8200685fd8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Next.js Force Runtime Evaluation]]></title>
            <link>https://medium.com/@hojat_gazestani/next-js-force-runtime-evaluation-214536634b30?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/214536634b30</guid>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 14:50:50 GMT</pubDate>
            <atom:updated>2025-04-21T14:50:50.909Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build-Time vs. Runtime Variables</h3><h4>Problem:</h4><p>I have three backend servers with different URLs defined in the Gitlab environment variable. I am trying to build a Docker container once and use it multiple times on the `dev`, `stage`, and `prod` environments.<br>But my problem was that Next.js only recognizes variables during the build time, not at runtime. So, I solved the problem as explained in the following.</p><p>- This is my Gitlab pipeline, and I extended the run stage, but I have different variables for each one.</p><pre>vim .gitlab-ci.yml<br>stages:<br> - build<br> - run<br>build:<br> stage: build<br> variables:<br> IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA<br> NEXT_PUBLIC_BACKEND_IP: &quot;192.168.1.1&quot;<br> BACKEND_IP: &quot;192.168.1.1&quot;<br> before_script:<br> - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY<br> script:<br> - docker build -f docker/Dockerfile -t $IMAGE_TAG .<br> - docker push $IMAGE_TAG<br> only:<br> - stage<br> tags:<br> - gitlab-docker<br>.run:<br> stage: run<br> before_script:<br> - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY<br> script:<br> - echo &quot;$ENVS&quot; &gt; docker/.env<br> - docker compose -p ${PROJ} -f docker/docker-compose.yml up -d<br> only:<br> - stage<br>run-dev:<br> extends: .run<br> environment: dev<br> when: manual<br> tags:<br> - dev<br>run-stage:<br> extends: .run<br> environment: stage<br> when: manual<br> tags:<br> - stage<br>run-prod:<br> extends: .run<br> environment: prod<br> when: manual<br> tags:<br> - prod</pre><pre>vim docker/docker-compose.yml<br> - -<br>services:<br> tala-be:<br> image: $CI_REGISTRY_IMAGE:latest<br> pull_policy: always<br> container_name: fron-${PROJ}<br> restart: always<br> ports:<br> - &quot;${LPORT}:3000&quot;<br> env_file:<br> - .env</pre><h3>Build-Time</h3><h4>Creating the next.js simple application</h4><pre>npx create-next-app@latest my-simple-app<br>cd my-simple-app/<br>vim src/app/page.tsx</pre><pre>export const dynamic = &#39;force-dynamic&#39;;<br>import Image from &quot;next/image&quot;;<br>export default function Home() {<br> return (<br> &lt;div className=&quot;grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var( - font-geist-sans)]&quot;&gt;<br> &lt;main className=&quot;flex flex-col gap-[32px] row-start-2 items-center sm:items-start&quot;&gt;<br> &lt;Image<br> className=&quot;dark:invert&quot;<br> src=&quot;/next.svg&quot;<br> alt=&quot;Next.js logo&quot;<br> width={180}<br> height={38}<br> priority<br> /&gt;<br> &lt;p className=&quot;text-lg font-semibold&quot;&gt;<br> I am connected to backend server with IP: {process.env.NEXT_PUBLIC_BACKEND_IP}<br> &lt;/p&gt;<br> &lt;p className=&quot;text-lg font-semibold&quot;&gt;<br> I am connected to backend server with IP: {process.env.BACKEND_IP}<br> &lt;/p&gt;<br>…</pre><pre>export BACKEND_IP=&quot;192.168.1.1&quot;<br>export NEXT_PUBLIC_BACKEND_IP=&quot;192.168.1.1&quot;<br>npm run dev</pre><h4>Dockerizing the project</h4><pre>mkdir docker<br>vim docker/Dockerfile<br>FROM node:20-alpine AS builder<br>WORKDIR /app<br>COPY package*.json ./<br>RUN npm install<br>COPY . .<br>RUN npm run build<br>FROM node:20-alpine AS runner<br>WORKDIR /app<br>COPY - from=builder /app/.next ./.next<br>COPY - from=builder /app/public ./public<br>COPY - from=builder /app/package*.json ./<br>RUN npm install - omit=dev<br>ENV NODE_ENV production<br>EXPOSE 3000<br>CMD [&quot;npm&quot;, &quot;start&quot;]</pre><h4>Build the Docker Image</h4><pre>docker build -f docker/Dockerfile -t my-nextjs-app - no-cache .<br>docker run -p 80:3000 -e NEXT_PUBLIC_BACKEND_IP=&quot;1.1.1.1&quot; -e BACKEND_IP=&quot;1.1.1.1&quot; my-nextjs-app</pre><h4>Runtime Variables</h4><p>- `NEXT_PUBLIC_` variables are available at build time for static site generation (SSG) or client-side rendering. And the variables provided at runtime via `docker run -e` are not included in the built JavaScript bundle. To ensure `NEXT_PUBLIC_BACKEND_IP` and `BACKEND_IP` are correctly passed and rendered, Force Runtime Evaluation.</p><p>- Next.js is statically generating the page, which means environment variables are embedded at build time. To make `NEXT_PUBLIC_BACKEND_IP` and `BACKEND_IP` available at runtime:</p><p>- **Disable Static Generation:** Ensure the page is server-rendered (SSR) or client-rendered (CSR) so it can access runtime environment variables.<br>- Add dynamic to page.tsx to force dynamic rendering:</p><pre>export const dynamic = &#39;force-dynamic&#39;;<br>import Image from &quot;next/image&quot;;<br>export default function Home() {<br> return (<br> &lt;div className=&quot;grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var( - font-geist-sans)]&quot;&gt;<br> &lt;main className=&quot;flex flex-col gap-[32px] row-start-2 items-center sm:items-start&quot;&gt;<br> &lt;Image<br> className=&quot;dark:invert&quot;<br> src=&quot;/next.svg&quot;<br> alt=&quot;Next.js logo&quot;<br> width={180}<br> height={38}<br> priority<br> /&gt;<br> &lt;p className=&quot;text-lg font-semibold&quot;&gt;<br> I am connected to backend server with IP: {process.env.NEXT_PUBLIC_BACKEND_IP}<br> &lt;/p&gt;<br> &lt;p className=&quot;text-lg font-semibold&quot;&gt;<br> I am connected to backend server with IP: {process.env.BACKEND_IP}<br> &lt;/p&gt;<br>…</pre><p>- The `dynamic = ‘force-dynamic’` ensures the page is rendered on the server for each request, allowing runtime environment variables to be used.</p><h4>Rebuild the Docker Image</h4><pre>docker build -f docker/Dockerfile -t my-nextjs-app - no-cache .</pre><h4>Test the Application</h4><pre>docker run -p 80:3000 -e NEXT_PUBLIC_BACKEND_IP=&quot;1.1.1.1&quot; -e BACKEND_IP=&quot;1.1.1.1&quot; my-nextjs-app</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=214536634b30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set up, configure, and test Cephfs distributed file storage with proper permission management and…]]></title>
            <link>https://medium.com/@hojat_gazestani/the-complete-cephfs-tutorial-for-2024-2d0e3d161fa4?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d0e3d161fa4</guid>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Thu, 17 Apr 2025 21:35:38 GMT</pubDate>
            <atom:updated>2025-04-24T09:57:16.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>Set up, configure, and test Cephfs distributed file storage with proper permission management and high availability testing.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AW9qARij8F5h0zHoIuqrxA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvNAjlogwbtk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvNAjlogwbtk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvNAjlogwbtk%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3514250f861b9214119ec953b099e3c5/href">https://medium.com/media/3514250f861b9214119ec953b099e3c5/href</a></iframe><h4>🔧 Covered</h4><p>✅ How to create a CephFS volume using the new methods</p><p>✅ Client-side mounting with ceph-fuse</p><p>✅ Configuring granular user permissions</p><p>✅ Testing high availability during OSD failures</p><p>✅ Real-world simultaneous access scenarios</p><h3>📡 Cluster Monitoring Commands</h3><p>This section includes essential monitoring commands like ceph -w and watch utilities to observe the health and state of orchestrator daemons, pools, and services in real-time. These tools help administrators keep an eye on cluster status and quickly detect issues or changes.</p><pre>ceph -w<br>watch ceph orch ps<br>watch ceph osd pool ls<br>watch ceph orch ls</pre><h3>📦 Create and Authorize CephFS Volume</h3><p>You create a new CephFS volume (cephfs-test) and assign fine-grained access permissions to clients using ceph fs authorize. For example, client.foo gets read-write access to the root (/), while client.bar has read access to / and read-write access to /dir1. This allows flexible multi-user access control within the file system.</p><pre>ceph fs volume create cephfs-test</pre><h3>🔐 CephFS Client Authorization</h3><p>The ceph fs authorize command is used to grant specific clients controlled access to the CephFS.</p><ul><li>ceph fs authorize cephfs-test client.foo / rw: Grants <strong>read-write</strong> access to the root (/) of the cephfs-test file system for the client named client.foo.</li><li>ceph fs authorize cephfs-test client.bar / r /dir1 rw: Gives <strong>read-only</strong> access to the root (/) and <strong>read-write</strong> access to /dir1 for client.bar. This is useful for fine-grained access control based on directories.</li><li>The command ceph auth get client.foo retrieves the authentication keyring for client.foo, which the client will use to mount the file system securely.</li></ul><pre>ceph fs authorize cephfs-test client.foo / rw<br>ceph fs authorize cephfs-test client.bar / r /dir1 rw<br><br>ceph auth get client.foo</pre><h3>💻 Client-Side Mounting</h3><p>Clients install Ceph packages (ceph-fuse and ceph-common), add the required key, and mount the file system using ceph-fuse. This enables clients to interact with the CephFS volume through a local mount point like /mnt/cephfs/test, providing a seamless POSIX-like file system experience.</p><pre>apt install ceph-fuse ceph-common ceph-fuse<br><br>vim /etc/ceph/client.key<br># Paste key here<br>cleint1 # vim /etc/ceph/ceph.conf<br># Paste cluster config here<br><br>client1 # ceph-fuse --id foo /mnt/cephfs/test<br><br>client2 # ceph-fuse --id foo /mnt/cephfs/test</pre><h3>🧪 Testing High Availablitiy Simultaneous File Access Verification</h3><p>Multiple clients mount the same CephFS volume and access files concurrently. One client writes to a file (foo.txt), while the other watches for changes in real time. This confirms that CephFS supports simultaneous access and synchronization across distributed nodes without conflict.</p><pre>root@client1# mkdir /mnt/test<br>root@client1# ceph-fuse --id foo /mnt/test/<br><br>root@client1# ls /mnt/test/<br>root@client1# foo.txt<br>root@client1# echo c1 &gt;&gt; foo.txt<br><br>root@client2:/mnt/test# watch -d -n 1 &quot;cat foo.txt&quot;</pre><h3>🔐 User Permission Enforcement Test</h3><p>This test ensures that CephFS enforces client-specific permissions correctly. client.foo can read and write files, while client.bar is restricted to read-only access. Attempts to write by unauthorized users result in permission errors, validating that access controls are applied as intended.</p><pre>root@client1# mkdir /mnt/test<br>root@client1# ceph-fuse --id foo /mnt/test/<br><br>root@client1# cd /mnt/test/<br>root@client1# echo cleint1 &gt;&gt; foo.txt<br><br>root@client2# mkdir /mnt/test<br>root@client2# ceph-fuse --id bar /mnt/test/<br><br>root@client2# cd /mnt/test/<br>root@client2:# echo clien2 &gt;&gt; foo.txt<br>bash: foo.txt: Permission denied        # bar user dont have permission to change <br><br>root@client2:# cat foo.txt              # but can read<br>client2<br>client22<br>client223<br>c1</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d0e3d161fa4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ceph Performance Boost SSD as Cache for HDD Writeback Mode]]></title>
            <link>https://medium.com/@hojat_gazestani/ceph-performance-boost-ssd-as-cache-for-hdd-writeback-mode-5a1080a8c2e5?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a1080a8c2e5</guid>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 11:12:37 GMT</pubDate>
            <atom:updated>2025-04-24T09:52:32.198Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sYLBpZmRH86JRUGECLY1CQ.png" /><figcaption>Ceph Performance Boost SSD as Cache for HDD Writeback Mode</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6yNx8SPeYYU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6yNx8SPeYYU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F6yNx8SPeYYU%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ddce47cd9cef7905190917146061e56/href">https://medium.com/media/2ddce47cd9cef7905190917146061e56/href</a></iframe><h4>SSDs as a cache layer for HDDs</h4><p>- The SSD pool acts as a cache tier for frequently accessed (“hot”) data<br>- The HDD pool acts as the base tier for storing all data, including less frequently accessed (“cold”) data.</p><ul><li>Ceph automatically promotes hot data to the cache tier (SSD) and demotes cold data to the base tier (HDD).</li></ul><h4>Create CRUSH Rules for SSD and HDD</h4><p>Here, you define custom CRUSH rules to separate SSD and HDD OSDs into their respective classes. This classification allows Ceph to apply different data placement strategies to the cache and base tiers by using the appropriate CRUSH rules when creating pools.</p><pre>ceph osd crush class ls<br>ceph osd crush rule list<br>ceph osd crush rule dump<br><br>ceph osd crush rule create-replicated hdd_rule default host hdd<br>ceph osd crush rule create-replicated ssd_rule default host ssd</pre><h4>Steps to Set Up SSD as a Cache Tier for HDD</h4><p>This step-by-step guide walks you through creating two pools: one on HDDs as the base storage, and another on SSDs to act as a cache tier. It includes instructions for linking the tiers and configuring the cache mode (writeback), ensuring data flows correctly between the two tiers.</p><pre># Create the Base Tier (HDD Pool)<br>ceph osd pool create hdd_pool 128 128 hdd_rule<br><br># Create the Cache Tier (SSD Pool)<br>ceph osd pool create ssd_cache_pool 128 128 ssd_rule<br><br># Verification<br>ceph osd pool get hdd_pool crush_rule<br>ceph osd pool get ssd_cache_pool crush_rule<br><br># Set Up Cache Tiering<br>ceph osd tier add hdd_pool ssd_cache_pool<br><br># Configure Cache Mode<br>ceph osd tier cache-mode ssd_cache_pool writeback</pre><p>Data is written to the cache tier (SSD) first and then flushed to the base tier (HDD) later.</p><p>Reads are served from the cache tier if the data is present; otherwise, data is read from the base tier and promoted to the cache tier.</p><h4>Configure Cache Tiering Parameters</h4><p>This section fine-tunes the behavior of the cache pool. Parameters such as the maximum cache size, promotion policies, and eviction thresholds are set to control how data moves in and out of the SSD cache. It balances performance, efficiency, and reliability.</p><pre># Set the maximum size of the cache tier.<br>ceph osd pool set ssd_cache_pool target_max_bytes 100000000000  # 100GB<br><br># Set the maximum number of objects in the cache tier.<br>ceph osd pool set ssd_cache_pool target_max_objects 1000000  # 1 million objects<br><br># Define how many hit sets to track for promoting data.<br>ceph osd pool set ssd_cache_pool hit_set_count 8<br><br># Define the time period for tracking hits.<br>ceph osd pool set ssd_cache_pool hit_set_period 300  # 300 seconds<br><br># Minimum number of hits required to promote data.<br>ceph osd pool set ssd_cache_pool min_read_recency_for_promote 2<br><br># Minimum number of hits required to promote data.<br>ceph osd pool set ssd_cache_pool min_write_recency_for_promote 2<br><br># object-based cache limit<br>ceph osd pool set ssd_cache_pool target_max_objects 1000000  # Adjust based on expected object size<br><br># cache eviction thresholds<br>ceph osd pool set ssd_cache_pool cache_target_dirty_ratio 0.4<br>ceph osd pool set ssd_cache_pool cache_target_full_ratio 0.8<br><br>ceph osd pool set ssd_cache_pool hit_set_type bloom<br>ceph osd pool set ssd_cache_pool hit_set_fpp 0.05  # 5% false positive rate<br><br># writeback safety<br>ceph osd pool set ssd_cache_pool cache_min_flush_age 600  # 10 minutes<br>ceph osd pool set ssd_cache_pool cache_min_evict_age 1800  # 30 minutes<br><br># Performance monitoring<br>ceph osd pool set ssd_cache_pool target_max_bytes 100000000000  # 100GB</pre><h4>Enable Overlay</h4><p>By enabling the overlay, Ceph redirects all client I/O on the base (HDD) pool through the cache (SSD) pool. This effectively integrates the two pools, ensuring cache tiering becomes transparent to the client applications.</p><pre>ceph osd tier set-overlay hdd_pool ssd_cache_pool</pre><h4>Verify the Setup</h4><p>Commands to validate that the tiering configuration was successfully applied. It helps confirm that the overlay and tier relationships are correctly established and active within the Ceph cluster.</p><pre>ceph osd dump | grep tier</pre><h4>Create volume</h4><p>Here you create and configure CephX authentication for a client that will access the SSD cache pool. The client gets permissions to read and write to the RBD volume, and configuration/authentication files are generated for later use on the client side.</p><pre>rbd create --size 10G --pool ssd_cache_pool ssd_cache_volume<br>rbd ls --pool ssd_cache_pool -l</pre><h4>CephX client</h4><pre>ceph auth add client.cache mon &#39;allow r&#39; osd &#39;allow rwx pool=ssd_cache_pool&#39;<br>ceph auth get client.cache<br># COPUY AUTH<br>ceph config generate-minimal-conf     # cat /etc/ceph/ceph.config<br># COPY CONFIG</pre><h4>Client config</h4><p>This section explains how to set up the Ceph client with the required configuration and keyring files. These settings allow the client machine to securely communicate with the Ceph cluster and interact with the RBD volume.</p><pre>sudo vim /etc/ceph/ceph.conf<br># PASTE CONFIG<br><br>sudo vim /etc/ceph/ceph.keyring<br># PASTE AUTH</pre><h4>Mount and map on client</h4><p>Finally, this section details the steps to map the RBD volume to a block device on the client, format it with a filesystem, and mount it for use. It also shows how to cleanly unmount and unmap the volume when it’s no longer needed.</p><pre>rbd -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.keyring -n client.cache ls pool --pool ssd_cache_pool -l<br>sudo rbd -n client.cache device map --pool ssd_cache_pool  ssd_cache_volume<br>sudo mkfs.ext4 /dev/rbd0<br>fdisk -l<br>sudo mount /dev/rbd0 /mnt<br>df -h<br>sudo umount /dev/rdb0<br>sudo rbd unmap /dev/rbd0</pre><h4>Advantages of Cache Tiering</h4><p>- **Improved Performance**: Frequently accessed data is served from the faster SSD tier.</p><p>- **Cost Efficiency**: Less frequently accessed data is stored on the cheaper HDD tier.</p><ul><li>**Automatic Data Management**: Ceph automatically promotes and demotes data based on access patterns.</li></ul><h4>Considerations</h4><p>1. Writeback Mode Risks:<br> — In writeback mode, data is written to the cache tier first. If the cache tier fails before data is flushed to the base tier, data loss can occur.<br> — Ensure proper monitoring and redundancy for the cache tier.</p><p>2. Cache Sizing:<br> — Size the cache tier appropriately to balance performance and cost. Too small a cache may not provide significant performance benefits; too large a cache may be unnecessarily expensive.</p><p>3. Workload Suitability:<br> — Cache tiering works best for workloads with a high degree of locality (e.g., frequently accessed data). For random or write-heavy workloads, the benefits may be limited.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a1080a8c2e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Configure Ceph Storage Tiering: SSD vs HDD Pools + Linux Client Setup]]></title>
            <link>https://medium.com/@hojat_gazestani/how-to-configure-ceph-storage-tiering-ssd-vs-hdd-pools-linux-client-setup-a418f6afd148?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a418f6afd148</guid>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 02:05:58 GMT</pubDate>
            <atom:updated>2025-04-24T09:58:03.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*rlAWUq2tbHhc6pDZKcalWQ.png" /><figcaption>Ceph Storage SSD vs HDD Pools + Ubuntu Linux Client</figcaption></figure><p>A step-by-step guide to creating optimized Ceph pools for SSDs and HDDs, mapping RBD volumes, and benchmarking performance- with video tutorial.</p><p>Have access to command on my <a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/octapus/05-Pool-SSD-HDD.md">Github</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9MmiQdu4kIY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9MmiQdu4kIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F9MmiQdu4kIY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d805d6ec24da737591993304c209b025/href">https://medium.com/media/d805d6ec24da737591993304c209b025/href</a></iframe><p><strong>Introduction</strong><br>Why Use Tiered Storage (SSD + HDD)?<br>⚡ Performance (SSD): Faster I/O for latency-sensitive workloads (databases, VMs, metadata).<br>💰 Cost-Efficiency (HDD): Cheaper bulk storage for cold data (backups, archives).<br>🔀 Automatic Tiering: Hot data moves to SSD; cold data shifts to HDD (optimizes cost/performance).<br>📈 Scalability: Combine speed and capacity without buying all-SSD (expensive) or all-HDD (slow).</p><p>Example: A database uses SSD for active transactions, while logs/backups stay on HDD</p><h4>Prerequisites</h4><pre>- A working Ceph cluster (Octopus or later)  <br>- Linux client (Ubuntu/CentOS)  <br>- `ceph-common` installed on the client  </pre><h4>Verify OSD Classes</h4><p>This step ensures that your Ceph cluster recognizes the correct OSD device classes (e.g., hdd, ssd). You use commands to list the current OSD tree and available device classes to confirm that everything is set correctly.</p><pre>ceph osd tree<br>ceph osd crush class ls</pre><h4>Create CRUSH Rules for SSD and HDD</h4><p>CRUSH rules define how and where data is stored across your cluster. Here, you’re creating separate rules for SSD and HDD pools to control data placement based on device type, ensuring performance or cost optimization.</p><pre>ceph osd crush rule list<br>ceph osd crush rule dump<br><br># `host` replicas are placed on different hosts for fault tolerance<br>ceph osd crush rule create-replicated {rule-name} {CRUSH-hierarchy} host {device-classes}<br><br># Create a CRUSH rule for HDD<br>ceph osd crush rule create-replicated hdd_rule default host hdd<br><br># Create a CRUSH rule for SSD<br>ceph osd crush rule create-replicated ssd_rule default host ssd<br><br>ceph osd crush rule list<br>ceph osd crush rule dump</pre><h4>Create Pools with the Rules</h4><p>Pools are logical groups of storage. You create separate replicated pools for SSDs and HDDs using the CRUSH rules defined earlier. This separation allows you to manage different storage backends for different workloads.</p><pre># `replicated` specifies that the pool uses replication (not erasure coding).<br>ceph osd pool create {pool-name} {pg} {pgp} replicated {CRUSH-rules}<br><br># Create a pool for HDD<br>ceph osd pool create hdd_pool 128 128 replicated hdd_rule<br><br># Create a pool for SSD<br>ceph osd pool create ssd_pool 128 128 replicated ssd_rule</pre><h4>Verify the Pools</h4><p>After pool creation, you verify them using Ceph commands to check that the pools are correctly created and associated with the intended CRUSH rules.</p><pre>ceph osd pool ls detail</pre><h4>Enable Application Tags</h4><p>Application tagging tells Ceph what kind of application will use the pool (e.g., rbd). It also initializes the pool with metadata, allowing RBD operations and enabling further inspection of internal structures.</p><pre># Sets up internal RBD metadata in the pool<br>rbd pool init hdd_pool<br>rbd pool init ssd_pool<br><br># list any RBD images, which confirms the pool is functional and metadata is in place.<br>rados -p hdd_pool ls<br># inspect RBD stores metadata in omap key/value pairs.<br>rados -p hdd_pool listomapkeys rbd_directory<br>#  inspect the key<br>rados -p hdd_pool getomapval rbd_directory rbd_id.myimage -<br><br># Registers the pools as being used by the RBD application<br>ceph osd pool application enable hdd_pool rbd<br>ceph osd pool application enable ssd_pool rbd</pre><h4>Create Volume</h4><p>In this step, you create RBD images (block devices) within each pool. These are virtual volumes backed by the SSD or HDD pool that can be mapped and used as regular block storage devices.</p><pre>rbd create --size 10G --pool ssd_pool ssd_volume<br>rbd create --size 10G --pool hdd_pool hdd_volume<br>rbd ls --pool ssd_pool -l<br>rbd ls --pool hdd_pool -l</pre><h4>CephX Client</h4><p>You create client authentication entries (client.ssd, client.hdd) that allow secure access to specific pools. The Ceph config and keyring are also generated and copied for use on external clients.</p><pre>ceph auth ls<br>ceph auth add client.hdd mon &#39;allow r&#39; osd &#39;allow rwx pool=hdd_pool&#39;<br>ceph auth get client.hdd<br><br><br>ceph auth ls<br>ceph auth add client.ssd mon &#39;allow r&#39; osd &#39;allow rwx pool=ssd_pool&#39;<br>ceph auth get client.ssd<br># COPUY AUTH<br>ceph config generate-minimal-conf     # cat /etc/ceph/ceph.config<br># COPY CONFIG</pre><h4>Mount and Map on Client</h4><p>This final section covers mapping the RBD volumes to devices on a client machine, formatting them, and mounting for use. It includes commands to view, map, mount, and unmount the volumes securely.</p><pre>rbd -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.keyring -n client.hdd ls pool --pool hdd_pool -l<br>sudo rbd -n client.hdd device map --pool hdd_pool  hdd_volume<br>sudo mkfs.ext4 /dev/rbd0<br>fdisk -l<br>sudo mount /dev/rbd0 /mnt<br>df -h<br>sudo umount /dev/rdb0<br>sudo rbd unmap /dev/rbd0<br><br>rbd -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.keyring -n client.ssd ls pool --pool ssd_pool -l<br>sudo rbd -n client.ssd device map --pool ssd_pool ssd_volume<br>sudo mkfs.ext4 /dev/rbd1<br>fdisk -l<br>sudo mount /dev/rbd1 /mnt<br>df -h<br>sudo umount /dev/rdb1<br>sudo rbd unmap /dev/rbd1</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a418f6afd148" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up Ceph RBD Storage and mount on Ubuntu Linux server: A Step-by-Step Guide for Beginners]]></title>
            <link>https://medium.com/@hojat_gazestani/how-to-set-up-ceph-rbd-storage-and-mount-on-ubuntu-linux-server-a-step-by-step-guide-for-beginners-cdd4f20bad50?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdd4f20bad50</guid>
            <category><![CDATA[sysadmin]]></category>
            <category><![CDATA[block-storage]]></category>
            <category><![CDATA[ceph-storage]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Sat, 05 Apr 2025 17:04:52 GMT</pubDate>
            <atom:updated>2025-04-24T09:44:51.383Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*YJTlXyAq4NxoqWq1Q8DFPg.png" /></figure><p>Ceph RBD on Ubuntu Linux</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8zBwOgSZ5mA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8zBwOgSZ5mA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8zBwOgSZ5mA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/aba7b2104110a5978a769bbf126cd301/href">https://medium.com/media/aba7b2104110a5978a769bbf126cd301/href</a></iframe><h3>Introduction</h3><p>Ceph <strong>RADOS Block Device (RBD)</strong>, allows you to create virtual disk images that can be attached to servers — just like AWS EBS, OpenStack Cinder, or Ubuntu Linux servers.</p><p>In this guide, I’ll walk you through <strong>setting up a Ceph RBD volume</strong>, configuring secure client access, and mounting it on a Linux machine. Whether you’re a sysadmin, a DevOps engineer, or just exploring Ceph, this tutorial will help you get started.</p><p><em>All commands used in this guide are available in my Ceph RBD </em><a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/octapus/07-block-device.md#block-device"><em>Command Reference on GitHub.</em></a><em>”</em></p><h3>Step 1: Setting Up a Ceph Storage Pool</h3><p>Before creating an RBD volume, we need a <strong>storage pool</strong> in Ceph. Think of it as a virtual storage bucket where block devices will reside.</p><pre>ceph osd pool create test-pool  # Creates a new pool named &#39;test-pool&#39;<br>ceph osd pool ls detail         # Lists all pools with detailed info.<br>rbd pool init test-pool         # Enables RBD functionality for the pool<br>ceph osd pool ls detail | grep application  # Verify RBD is enabled</pre><p><strong>Why this matters:</strong> Without initializing the pool for RBD, you won’t be able to create block devices.</p><h3>Step 2: Creating an RBD Volume (Virtual Disk)</h3><p>Now, let’s create a <strong>10GB virtual disk</strong> inside our pool. This will act like a raw disk that we can attach to any machine.</p><pre>rbd create --size 10G --pool test-pool test-volume  # Creates a 10GB disk<br>rbd ls --pool test-pool -l  # Lists available RBD images</pre><p><strong>Use case:</strong> This is similar to creating an EBS volume in AWS — except it’s running on your Ceph cluster!</p><h3>Step 3: Securing Access with Ceph Authentication</h3><p>Since Ceph is a shared storage system, we need <strong>fine-grained access control</strong>. We’ll create a restricted client with only the necessary permissions.</p><p><em>“For a breif explanation of CephX security, see my </em><a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/Concept/01-Concept.md#authentication-with-cephx"><em>Ceph Authentication Concepts documentation.</em></a><em>”</em></p><pre>ceph auth add client.test mon &#39;allow r&#39; osd &#39;allow rwx pool=test-pool&#39;  <br>ceph auth get client.test  # Exports the client keyring (save this!)<br># Copy config and use in clients</pre><p><strong>Security best practice:</strong> Always follow the <strong>principle of least privilege</strong> — only grant the permissions needed.</p><p>We need Ceph cluster configuration to login</p><pre>ceph config generate-minimal-conf      # Generates a minimal Ceph config file.<br># Copy config and use in clients</pre><h3>Step 4: Configuring the Client Machine</h3><p>Now, let’s set up a <strong>Linux client</strong> to access the RBD volume.</p><p><strong>Install Ceph tools</strong> (if not already present):</p><pre>CEPH_RELEASE=19.2.1<br>curl --silent --remote-name --location https://download.ceph.com/rpm-${CEPH_RELEASE}/el9/noarch/cephadm<br>chmod +x cephadm<br>sudo ./cephadm add-repo --release squid<br>sudo apt update -y<br>sudo apt install ceph-common -y<br>ceph -v</pre><p><strong>Add the Ceph config &amp; keyring</strong> (from Step 3):</p><p>Without the client tools and authentication, your machine can’t communicate with the Ceph cluster.</p><pre>sudo vim /etc/ceph/ceph.conf  # Paste minimal Ceph config<br>sudo vim /etc/ceph/ceph.keyring  # Paste client.test’s keyring</pre><p><strong>Load the RBD kernel module</strong>:</p><pre>sudo modprobe rbd</pre><h3>Step 5: Mapping &amp; Mounting the RBD Volume on the client</h3><p>Finally, let’s <strong>attach the RBD volume</strong> to our Linux machine and use it like a local disk.</p><pre>rbd -n client.test device map --pool test-pool test-volume  # Maps to /dev/rbd0<br>sudo mkfs.ext4 /dev/rbd0  # Formats the disk as ext4<br>sudo mount /dev/rbd0 /mnt  # Mounts it to /mnt<br>df -h | grep rbd  # Verifies the mount</pre><p><strong>Real-world use case:</strong></p><ul><li>Use this for <strong>database storage</strong> (PostgreSQL, MySQL).</li><li>Deploy it in <strong>Kubernetes</strong> with RBD provisioner.</li><li>Build your own <strong>cloud storage</strong> (like AWS EBS).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdd4f20bad50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ceph concept]]></title>
            <link>https://medium.com/@hojat_gazestani/ceph-concept-a6da65cebddc?source=rss-6fbbd5f657a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6da65cebddc</guid>
            <dc:creator><![CDATA[Hojat Gazestani]]></dc:creator>
            <pubDate>Thu, 03 Apr 2025 07:19:16 GMT</pubDate>
            <atom:updated>2025-04-03T07:39:30.268Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ceph architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcKiest5w-F1he9nNOdHMg.png" /><figcaption>RADOS</figcaption></figure><h4>Ceph feature</h4><ul><li>Vertical Scaling vs Horizontal Scaling</li><li>Redundant array of independent disks (RAID)</li><li>Availability</li><li>Security</li><li>Scalability</li><li>Sharing resources — Storage</li><li>Performance</li><li>Peer to Peer</li></ul><h4>RADOS</h4><p>RADOS is an object storage system layer that provides a data durability and availability framework that all user-facing Ceph services are layered atop. RADOS is:</p><p>Highly available with no single point of failure (SPoF)<br>Reliable and resilient<br>Self-healing<br>Self-managing<br>Adaptive<br>Scalable<br>Not found on the Galactica</p><p>RADOS manages the distribution of data within Ceph. Durability and availability of data are adaptively maintained by initiating operations as needed to recover</p><h4>Storing data</h4><ul><li>The received data will be stored as RADOS objects in OSDs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*1I2KRAMzSGunqF0C_9eNEA.png" /><figcaption>Ceph Object</figcaption></figure><p><a href="https://github.com/hojat-gazestani/openstack/blob/main/Ceph/Concept/01-Concept.md">Link</a> to my Github</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6da65cebddc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>