728x90
반응형

모든 커맨드는 루트로 작업

 

  1. 필요 패키지 설치(모든 서버)
    $ apt update; apt install -y ansible

  2. 첫번째 서버에 Cephadm-ansible git repo 복제
    $ git clone https://github.com/YoungjuWang/ubuntu-cephadm-ansible.git
  3. ubuntu-cephadm-ansible 폴더로 들어가서 vars.yml 수정
    $ cd ubuntu-cephadm-ansible/
    vi vars.yml
    ---
    container_engine: "docker"         수정
    ---
  4. ansible inventory 수정
    $ vi ceph.inventory
    ---
     bootstrap ansible_connection=local
    mon2 ansible_host="host2 ip"
    mon3 ansible_host=""host3 ip"
    mon4 ansible_host=""host4 ip"
    (host 개수만큼 추가)
    
    all:vars] ansible_ssh_common_args='-o StrictHostKeyChecking=no'
    ---
  5. ssh-key를 생성하고 copy
    $ ssh-keygen -N "" -f ~/.ssh/id_rsa
    $ ssh-copy-id "host ip"
    (host 전부 등록)
  6. ssh connection 확인
    $ ansible -i ceph.inventory -m ping all


    결과 예시:
    $ ansible -i ceph.inventory -m ping all
    ceph-1 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python3"
        },
        "changed": false,
        "ping": "pong"
    }
    ceph-2 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python3"
        },
        "changed": false,
        "ping": "pong"
    }
    ceph-3 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python3"
        },
        "changed": false,
        "ping": "pong"
    }
    ceph-4 | SUCCESS => {
         "ansible_facts": {
             "discovered_interpreter_python": "/usr/bin/python3" 
         }, 
         "changed": false, 
         "ping": "pong" 
    }

  7. Ceph 패키지 설치
    $ ansible-playbook -i ceph.inventory preflight.yml

  8. Ceph 클러스터 구성
    $ cephadm bootstrap --mon-ip "첫번째 host ip"

    # 아래 항목이 구성됨
    - Create a monitor and manager daemon for the new cluster on the local host.
    - Generate a new SSH key for the Ceph cluster and add it to the root user’s /root/.ssh/authorized_keys file.
    - Write a minimal configuration file to /etc/ceph/ceph.conf. This file is needed to communicate with the new cluster.
    - Write a copy of the client.admin administrative (privileged!) secret key to /etc/ceph/ceph.client.admin.keyring.
    - Write a copy of the public key to /etc/ceph/ceph.pub.

    결과 예시:
$ cephadm bootstrap --mon-ip "첫번째 host ip"

Fetching dashboard port number...
Ceph Dashboard is now available at:

             URL: https://ceph-1:8443/
            User: admin
        Password: kxnjyyu66x

Enabling client.admin keyring and conf on hosts with "admin" label
You can access the Ceph CLI with:

        sudo /usr/sbin/cephadm shell --fsid af39f080-af03-11ec-9050-fa163e37df68 -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring

Please consider enabling telemetry to help improve Ceph:

        ceph telemetry on

For more information see:

        https://docs.ceph.com/docs/pacific/mgr/telemetry/

 

참고 : https://yjwang.tistory.com/119

반응형

+ Recent posts