How to make Ceph cluster in ubuntu

How to make Ceph cluster in ubuntu

Creating a Ceph cluster on Ubuntu involves several steps, including setting up Ceph packages, configuring nodes, and deploying the cluster. Here's a basic outline of the process:

Prerequisites

  • Ubuntu Servers: You'll need at least three Ubuntu servers (physical or virtual machines) to create a basic Ceph cluster. Each server should have adequate CPU, RAM, and disk space.

  • Network Configuration: Ensure that all servers can communicate with each other over the network. This typically involves configuring static IPs, DNS resolution, and ensuring firewall rules allow necessary traffic (like Ceph's ports).

Steps to Create a Ceph Cluster on Ubuntu

  1. Install Ceph Packages:

    • Update the package list and install necessary dependencies:

        sudo apt update
        sudo apt install -y lsb-release gnupg
      
    • Add the Ceph repository and install Ceph packages:

        wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
        echo deb https://download.ceph.com/debian-$(lsb_release -sc)/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
        sudo apt update
        sudo apt install -y ceph-deploy
      
  2. Prepare Ceph Nodes:

    • Create a user for Ceph deployment (e.g., cephuser):

        sudo useradd -m -s /bin/bash cephuser
        sudo passwd cephuser  # set a password
        sudo usermod -aG sudo cephuser  # add to sudo group
      
    • Enable passwordless sudo for the cephuser by editing sudoers file (sudo visudo) and adding:

        cephuser ALL = (ALL) NOPASSWD:ALL
      
    • Configure SSH access between nodes. Generate SSH keys on the admin node (ceph-admin) and distribute the public key to all Ceph nodes (ceph-node1, ceph-node2, etc.):

        sudo su - cephuser
        ssh-keygen  # generate SSH keys
        ssh-copy-id cephuser@ceph-node1  # copy SSH key to node1
        ssh-copy-id cephuser@ceph-node2  # copy SSH key to node2
      
  3. Deploy Ceph Cluster:

    • Initialize a new Ceph cluster and create an initial configuration:

        mkdir ~/my-cluster
        cd ~/my-cluster
        ceph-deploy new ceph-node1 ceph-node2 ceph-node3
      
    • Edit ceph.conf file to configure your cluster settings:

        nano ceph.conf
      
    • Install Ceph packages on all nodes:

        ceph-deploy install ceph-node1 ceph-node2 ceph-node3
      
    • Deploy initial monitor nodes:

        ceph-deploy mon create-initial
      
    • Deploy OSDs (Object Storage Daemons) on each storage node (replace /dev/sdX with your actual disk):

        ceph-deploy osd create --data /dev/sdX ceph-node1
        ceph-deploy osd create --data /dev/sdX ceph-node2
        ceph-deploy osd create --data /dev/sdX ceph-node3
      
    • Verify cluster health:

        ceph health
      
  4. Optional Steps:

    • Configure Ceph block devices, RADOS Gateway (RGW), or other Ceph services as needed.

Notes:

  • Scaling: You can add more nodes or disks to the cluster by repeating the steps for adding OSDs and adjusting the ceph.conf as necessary.

  • Documentation: Refer to the Ceph documentation for detailed guidance on advanced configurations, maintenance, and troubleshooting.

Setting up a Ceph cluster involves detailed configuration and planning, especially regarding networking and storage requirements. Ensure to review the Ceph documentation and adjust configurations based on your specific deployment needs and hardware capabilities.