본문 바로가기
Tech/Stroage

ceph-deploy로 ceph 설치하기

by 타이호 2017. 12. 24.
반응형

Juju를 이용해서 Ceph을 deploy하게 되면 간단하지만, Manual하게 Deploy 해보려고 한다.

 

1. Architecture



 
 
 

2. 준비

a. Machines : ubuntu 16.04로 구성한다.

- Ceph Admin : ceph-deploy를 실행할 호스트. 모든 명령이나 구성등을 가지고 있는 서버라고 생각하면 된다.

- Ceph Mon : Ceph OSD를 모니터링 하기 위한 호스트. 테스트를 위해 우선 1대만 구성한다. (3대로 구성해서 이중화로 구성할 수 있다)

- Ceph OSD : 테스트를 위해 1개의 디스크를 추가가 된 호스트를 2대 구성한다.

b. Network

- Ceph Cluster Network : OSD간 데이터를 Replication 하기 위한 네트워크. 1개의 네트워크로 같이 사용해도 무방하다. (테스트 목적이니..)

- Ceph Public Network : Ceph의 rbd pool에 접근해서 사용하기 위한 네트워크

c. Connectivity

- Ceph Admin은 각 호스트에 ssh로 비밀번호 없이 접근이 가능해야 한다. 그래서 ceph admin에서 ssh-copy-id 명령을 통해 각 호스트에 키를 등록한다.

예) ssh-copy-id ubuntu@10.10.1.56

- /etc/hosts에 해당 ceph machine들의 아이피를 등록한다.

- ntp를 구성한다. ( sudo apt install ntp )

 

3. ceph-deploy 구성

Install ceph-deploy
~$ sudo apt update
~$ wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
최신버전 kraken을 설치 해보자 (Ceph Release Note : http://docs.ceph.com/docs/master/releases/ )
~$ echo deb http://download.ceph.com/debian-kraken/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
~$ sudo apt install ceph-deploy
ceph-deploy에서 사용할 디렉토리를 생성
~$ mkdir cluster
 

4. ceph deployment

deploy ceph
ceph mon 설치 (compute01은 mon으로 쓸 호스트 이름을 /etc/hosts 에 정의 해두었다. compute02~03은 osd용으로 사용한다. controller01은 ceph-admin용도이다)
~$ ceph-deploy new --cluster-network 10.10.1.0/24 --public-network 172.16.1.0/24 compute01
~$ ceph-deploy new compute01 : 이렇게 하면 기본으로 생성되는데 멀티 네트워크에서는 cluster ip로 설정이 되는데 이게 나중에 구성 시 에러를 발생한다.
http://docs.ceph.com/docs/master/start/quick-ceph-deploy/
매뉴얼에 조그마하게 ceph.conf안의 ip는 public ip로 해야 한다고 나온다 (__)
위 명령을 수행하게 되면 ceph.conf, keyring이 생성이 된다
~/cluster$ ls
ceph.conf  ceph-deploy-ceph.log  ceph.mon.keyring
osd는 2개로 구성할 것이기 때문에 ceph.conf 에서 아래를 추가한다. 그리고 network을 분리를 할 것이기 때문에 public과 cluster 네트워크에 대한 부분을 정의한다.
osd pool default size = 2
이제 Ceph을 설치 해보자. admin은 controller01, mon은 compute01, osd는 compute02~03에 설치를 할 것 이다.
~/cluster$ ceph-deploy install controller01 compute01 compute02 compute03
Ceph mon 초기화
~/cluster$ ceph-deploy mon create-initial
초기화를 하고 나면 아래 파일들이 cluster 디렉토리 아래에 생성이 된다
ceph.client.admin.keyring
ceph.bootstrap-mgr.keyring
ceph.bootstrap-osd.keyring
ceph.bootstrap-mds.keyring
ceph.bootstrap-rgw.keyring
참고로 mon 호스트를 확장 할 경우 나중에 아래 명령을 통해 mon 호스트를 확장한다
~$ceph-deploy mon add {ceph-nodes}

 


ceph-deploy mon create-initial 에러
[compute01][INFO  ] Running command: sudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --admin-daemon=/var/run/ceph/ceph-mon.compute01.asok mon_status
[compute01][INFO  ] Running command: sudo /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-compute01/keyring auth
get client.admin
[compute01][ERROR ] "ceph auth get-or-create for keytype admin returned 1
[compute01][DEBUG ] 2017-07-27 08:19:16.453157 7f672c2eb700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f6728059e40 sd=5 :0 s=1 pgs=0 cs=0 l=1 c=0x7f672805cbd0).fault
[compute01][DEBUG ] 2017-07-27 08:19:19.453726 7f672c1ea700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c000cc0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c002000).fault
[compute01][DEBUG ] 2017-07-27 08:19:22.454460 7f672c2eb700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c0052c0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c0065a0).fault
[compute01][DEBUG ] 2017-07-27 08:19:25.455297 7f672c1ea700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c000cc0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c0024d0).fault
[compute01][DEBUG ] 2017-07-27 08:19:28.456106 7f672c2eb700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c0052c0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c002f90).fault
[compute01][DEBUG ] 2017-07-27 08:19:31.456980 7f672c1ea700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c000cc0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c003610).fault
[compute01][DEBUG ] 2017-07-27 08:19:34.457806 7f672c2eb700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c0052c0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c004390).fault
[compute01][DEBUG ] 2017-07-27 08:19:37.458643 7f672c1ea700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c000cc0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c008fa0).fault
[compute01][DEBUG ] 2017-07-27 08:19:40.459491 7f672c2eb700  0 -- :/301425260 >> 10.10.1.56:6789/0 pipe(0x7f671c0052c0 sd=6 :0 s=1 pgs=0 cs=0 l=1 c=0x7f671c009cc0).fault
[compute01][DEBUG ] Traceback (most recent call last):
[compute01][DEBUG ]   File "/usr/bin/ceph", line 948, in <module>
[compute01][DEBUG ]     retval = main()
[compute01][DEBUG ]   File "/usr/bin/ceph", line 852, in main
[compute01][DEBUG ]     prefix='get_command_descriptions')
[compute01][DEBUG ]   File "/usr/lib/python2.7/dist-packages/ceph_argparse.py", line 1300, in json_command
[compute01][DEBUG ]     raise RuntimeError('"{0}": exception {1}'.format(argdict, e))
[compute01][DEBUG ] RuntimeError: "None": exception "['{"prefix": "get_command_descriptions"}']": exception You cannot perform that operation on a Rados object in state configuring.
[compute01][ERROR ] Failed to return 'admin' key from host compute01
[ceph_deploy.gatherkeys][ERROR ] Failed to connect to host:compute01
[ceph_deploy.gatherkeys][INFO  ] Destroy temp directory /tmp/tmpmd2b9L
[ceph_deploy][ERROR ] RuntimeError: Failed to connect any mon
 
이런 에러가 나올 때 해결한 부분은 ceph.conf 안의 ip를 cluster ip 대역으로 설정해서 그런 것 같고 public ip 대역으로 수정하면 된다.

 
ceph osd 설치
 
생성된 keyring들을 이제 각 ceph node로 배포하자
~$ceph-deploy admin compute01 compute02 compute03
 
[option] manager daemon을 deploy한다 (luminous+ builds 일 경우만)
~$ceph-deploy mgr create compute01
 
OSD를 생성한다
~$ceph-deploy osd create compute02:sdb compute03:sdb
 
OSD가 구성이 되고 나면 mon 호스트에서 아래 명령을 통해 상태를 확인 할 수 있다
root@compute01:/etc/ceph# ceph -s
    cluster 69c454fa-10c1-4657-9b0e-b203ae640571
     health HEALTH_OK
     monmap e1: 1 mons at {compute01=172.16.1.56:6789/0}
            election epoch 3, quorum 0 compute01
     osdmap e10: 2 osds: 2 up, 2 in
            flags sortbitwise,require_jewel_osds
      pgmap v16: 64 pgs, 1 pools, 0 bytes data, 0 objects
            69052 kB used, 71575 MB / 71642 MB avail
                  64 active+clean
root@compute01:/etc/ceph# ceph osd tree
ID WEIGHT  TYPE NAME          UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 0.06839 root default
-2 0.03419     host compute02
 0 0.03419         osd.0           up  1.00000          1.00000
-3 0.03419     host compute03
 1 0.03419         osd.1           up  1.00000          1.00000
 


반응형