我要评分
获取效率
正确性
完整性
易理解

How Do I Quickly Deploy Multiple OSD Nodes?

The following example describes how to quickly deploy multiple OSD nodes.

Before using the script, you need to configure OSD nodes. For details, see Configuring OSD Nodes.

Assume that there are three servers, each server has 12 drives, and an OSD needs to be deployed on each drive.

  1. Create a create_osd.sh script on ceph1 and deploy OSDs on the 12 drives on each server.
    1
    2
    cd /root/ceph-mycluster/
    vi /root/ceph-mycluster/create_osd.sh
    
  2. Add the following content to the file:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    #!/bin/bash
    
    for node in ceph1 ceph2 ceph3
    do
    j=1
    k=2
    for i in {a..l}
    do
    ceph-deploy disk zap ${node} /dev/sd${i}
    ceph-deploy osd create ${node} --data /dev/sd${i} --block-wal /dev/nvme0n1p${j} --block-db /dev/nvme0n1p${k}
    ((j=${j}+2))
    ((k=${k}+2))
    sleep 3
    done
    done
    
  3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  4. Run the script on ceph1.
    1
    bash create_osd.sh
    

    This script applies only to the current hardware configuration. For other hardware configurations, you need to modify the script.

    • ceph-deploy disk zap is used to clear the target drive. In this command:
      • ${node} specifies the host name of the node.
    • ceph-deploy osd create is used to generate OSD nodes. In this command:
      • ${node} specifies the host name of the node.
      • {a..l} is the drive letter corresponding to the environment in this document. Change the drive letter based on your actual environment.
      • --data specifies the data drive.
      • --block-db specifies the DB partition.
      • --block-wal specifies the WAL partition.