Ubuntu 16.04
Sponsored Link

Ceph : Configure Ceph Cluster
2016/04/23
 
Install Distributed File System "Ceph" to Configure Storage Cluster.
For example on here, Configure Cluster with 1 admin Node and 3 Storage Node like follows.
                                         |
        +--------------------+           |           +-------------------+
        |   [dlp.srv.world]  |10.0.0.30  |   10.0.0.x|   [   Client  ]   |
        |    Ceph-Deploy     +-----------+-----------+                   |
        |                    |           |           |                   |
        +--------------------+           |           +-------------------+
            +----------------------------+----------------------------+
            |                            |                            |
            |10.0.0.51                   |10.0.0.52                   |10.0.0.53 
+-----------+-----------+    +-----------+-----------+    +-----------+-----------+
|   [node01.srv.world]  |    |   [node02.srv.world]  |    |   [node03.srv.world]  |
|     Object Storage    +----+     Object Storage    +----+     Object Storage    |
|     Monitor Daemon    |    |                       |    |                       |
|                       |    |                       |    |                       |
+-----------------------+    +-----------------------+    +-----------------------+

[1]
Add a user for Ceph admin on all Nodes.
It adds "ubuntu" user on this exmaple.
[2] Grant root priviledge to Ceph admin user just added above with sudo settings.
And also install required packages.
root@dlp:~#
apt-get -y install openssh-server python-ceph
root@dlp:~#
echo -e 'Defaults:ubuntu !requiretty\nubuntu ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/ceph

root@dlp:~#
chmod 440 /etc/sudoers.d/ceph

[3] Login as a Ceph admin user and configure Ceph.
Set SSH key-pair from Ceph Admin Node (it's "dlp.srv.world" on this example) to all storage Nodes.
ubuntu@dlp:~$
ssh-keygen

Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa):
Created directory '/home/ubuntu/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ubuntu/.ssh/id_rsa.
Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ogXYs9lEWNcve2h8RvYKpCD01eHuyOe2A5/rcoRgkOA ubuntu@dlp.srv.world
The key's randomart image is:

ubuntu@dlp:~$
vi ~/.ssh/config
# create new ( define all nodes and users )

Host dlp
    Hostname dlp.srv.world
    User ubuntu
Host node01
    Hostname node01.srv.world
    User ubuntu
Host node02
    Hostname node02.srv.world
    User ubuntu
Host node03
    Hostname node03.srv.world
    User ubuntu

ubuntu@dlp:~$
chmod 600 ~/.ssh/config
# transfer key file

ubuntu@dlp:~$
ssh-copy-id node01

ubuntu@node01.srv.world's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'node01'"
and check to make sure that only the key(s) you wanted were added.

ubuntu@dlp:~$
ssh-copy-id node02

ubuntu@dlp:~$
ssh-copy-id node03

[5] Install Ceph to all Nodes from Admin Node.
ubuntu@dlp:~$
sudo apt-get -y install ceph-deploy ceph-common ceph-mds
ubuntu@dlp:~$
mkdir ceph

ubuntu@dlp:~$
cd ceph

ubuntu@dlp:~/ceph$
ceph-deploy new node01

ubuntu@dlp:~/ceph$
vi ./ceph.conf
# add to the end

osd pool default size = 2
# install Ceph on each Node

ubuntu@dlp:~/ceph$
ceph-deploy install dlp node01 node02 node03
# settings for monitoring and keys

ubuntu@dlp:~/ceph$
ceph-deploy mon create-initial

[6] Configure Ceph Cluster from Admin Node.
Beforeit, Create a directory /storage01 on Node01, /storage02 on Node02, /storage03 on node03 and chown them with "ceph:ceph" on this example.
# prepare Object Storage Daemon

ubuntu@dlp:~/ceph$
ceph-deploy osd prepare node01:/storage01 node02:/storage02 node03:/storage03
# activate Object Storage Daemon

ubuntu@dlp:~/ceph$
ceph-deploy osd activate node01:/storage01 node02:/storage02 node03:/storage03
# transfer config files

ubuntu@dlp:~/ceph$
ceph-deploy admin dlp node01 node02 node03

# show status (display like follows if no ploblem)

ubuntu@dlp:~/ceph$ sudo
ceph health

HEALTH_OK
[7] By the way, if you'd like to clean settings and re-configure again, do like follows.
# remove packages

ubuntu@dlp:~/ceph$
ceph-deploy purge dlp node01 node02 node03
# remove settings

ubuntu@dlp:~/ceph$
ceph-deploy purgedata dlp node01 node02 node03

ubuntu@dlp:~/ceph$
ceph-deploy forgetkeys
Matched Content
 
Tweet