Ceph ntawm iSCSI - lossis caij ski thaum sawv hauv txaj

Puas muaj cov ntawm peb (tsefovodov) uas tsis nyiam "kev tshaj lij"?

Nws tsis zoo li - txwv tsis pub peb yuav tsis tumbling ib puag ncig nrog cov khoom lag luam nthuav dav thiab lom zem.

Ntau tus neeg uas tau koom nrog hauv kev ua haujlwm ntawm Ceph tau hla ib qho tsis tu ncua (los yog tsis tshua muaj heev) tab sis qee zaum hauv qhov xav tau - txuas Ceph ntawm iSCSI lossis FC. Rau dab tsi? Zoo, piv txwv li, xa ib daim duab los ntawm Ceph mus rau lub Windows lossis Solaris server uas tseem tsis tau virtualized rau qee yam. Los yog ib qho virtualized, tab sis siv lub hypervisor uas tsis tuaj yeem ua Ceph - thiab, raws li peb paub, muaj ntau ntawm lawv. Piv txwv li? Zoo, piv txwv li, HyperV los yog ESXi, uas yog nquag siv. Thiab yog tias txoj haujlwm tshwm sim ntawm kev ua haujlwm ntawm Ceph mus rau lub tshuab qhua, qhov no hloov mus ua haujlwm zoo siab heev.

Yog li, muab:

  1. ib tug twb khiav Ceph pawg
  2. ib daim duab uas twb muaj lawm uas yuav tsum tau txais kev pabcuam ntawm iSCSI
  3. Pas npe mypool, duab npe myimage

Pib?

Ua ntej tshaj plaws, thaum peb tham txog FC lossis iSCSI, peb muaj cov koom haum xws li pib thiab lub hom phiaj. Lub hom phiaj yog tiag tiag server, pib yog tus neeg siv khoom. Peb lub luag haujlwm yog xa daim duab Ceph mus rau tus pib nrog kev siv zog tsawg. Qhov no txhais tau tias peb yuav tsum nthuav lub hom phiaj. Tab sis qhov twg, ntawm lub computer dab tsi?

Hmoov zoo, hauv pawg Ceph peb muaj tsawg kawg ib feem uas nws qhov chaw nyob IP raug kho thiab qhov twg ib qho tseem ceeb tshaj plaws ntawm Ceph tau teeb tsa, thiab cov khoom ntawd yog tus saib xyuas. Raws li, peb nruab ib lub hom phiaj iSCSI rau ntawm lub monitor (thiab ib qho initator tib lub sijhawm, tsawg kawg rau kev sim). Kuv tau ua qhov no ntawm CentOS, tab sis cov kev daws teeb meem kuj tseem tsim nyog rau lwm qhov kev faib tawm - koj tsuas yog xav tau nruab cov pob hauv txoj kev uas tau txais hauv koj qhov kev faib tawm.

# yum -y install iscsi-initiator-utils targetcli

Lub hom phiaj ntawm cov pob teeb tsa yog dab tsi?

  • targetcli - kev siv hluav taws xob rau kev tswj hwm SCSI lub hom phiaj ua rau hauv Linux kernel
  • iscsi-initiator-utils - ib pob nrog cov khoom siv hluav taws xob siv los tswj cov iSCSI tus pib tsim rau hauv Linux kernel

Txhawm rau xa cov duab ntawm iSCSI rau tus pib, muaj ob txoj hauv kev rau kev txhim kho cov xwm txheej - siv cov neeg siv khoom siv rov qab ntawm lub hom phiaj lossis txuas cov duab ua cov cuab yeej thaiv pom rau lub operating system thiab xa tawm ntawm iSCSI. Peb yuav mus rau txoj kev thib ob - tus userspace backend tseem nyob rau hauv lub xeev "sim" thiab tsis tau npaj me ntsis rau kev siv tau. Tsis tas li ntawd, muaj qhov pitfalls nrog nws, uas koj tuaj yeem tham ntau thiab (oh horror!) sib cav.

Yog hais tias peb siv txawm tias ib tug me ntsis ruaj khov tis nrog ib tug ntev kev pab cuam lub voj voog, ces lub kernel peb muaj yog ib co ancient, ancient version. Piv txwv li, hauv CentOS7 nws yog 3.10.*, hauv CentOS8 nws yog 4.19. Thiab peb txaus siab rau lub kernel tsawg kawg yog 5.3 (los yog 5.4) thiab tshiab dua. Vim li cas? Vim hais tias los ntawm lub neej ntawd Ceph dluab muaj ib txheej ntawm kev xaiv enabled uas tsis tau tshaj cov laus kernels. Qhov no txhais tau hais tias peb txuas lub chaw cia khoom nrog cov ntsiav tshiab rau peb qhov kev faib tawm (piv txwv li, rau CentOS qhov no yog elrepo), nruab lub kernel tshiab thiab rov pib lub kaw lus los ua haujlwm nrog cov kernel tshiab:

  • Txuas mus rau lub monitor xaiv rau kev sim
  • Peb txuas elrepo repositories raws li cov lus qhia - ib elrepo.org/tiki/tiki-index.php
  • Nruab lub kernel: yum -y β€”enablerepo=elrepo-kernel nruab kernel-ml
  • Reboot lub server nrog lub monitor (peb muaj peb lub monitor, puas yog?)

Txuas cov duab ua ib lub cuab yeej thaiv

# rbd map mypool/myimage
/dev/rbd0

Txhua yam uas tseem tshuav yog los teeb tsa lub hom phiaj. Hauv qhov piv txwv no, kuv yuav teeb tsa lub hom phiaj hauv qhov hu ua. demo hom - tsis muaj authentication, pom thiab siv tau rau txhua tus. Nyob rau hauv ib puag ncig tsim khoom, koj yuav xav tau teeb tsa kev lees paub - tab sis qhov ntawd yog me ntsis tawm ntawm qhov kev ua haujlwm rau hnub no tsuas yog rau kev lom zem.

Tsim ib lub backend npe disk1 txuam nrog cov ntaub ntawv /dev/rbd/mypool/myimage. Cov ntaub ntawv teev tseg yog cov cim txuas tau tsim los ntawm udev daemon rau /dev/rbd0. Peb siv lub cim txuas vim tias lub npe ntawm lub cuab yeej rbd tuaj yeem hloov pauv nyob ntawm qhov kev txiav txim uas Ceph cov duab txuas nrog tus tswv tsev.

Tsim ib qho backend:

# targetcli /backstores/block create disk1 /dev/rbd/mypool/myimage

Tsim ib lub hom phiaj iSCSI:

# targetcli /iscsi create iqn.2020-01.demo.ceph:mypool

Peb txuas lub backend li LUN rau lub hom phiaj:

# targetcli /iscsi/iqn.2020-01.demo.ceph:mypool/tpg1/luns create /backstores/block/disk1

Cia peb teeb tsa lub hom phiaj rau hom demo:

# targetcli /iscsi/iqn.2020-01.demo.ceph:mypool/tpg1/ set
> attribute demo_mode_write_protect=0
# targetcli /iscsi/iqn.2020-01.demo.ceph:mypool/tpg1/ set
> attribute generate_node_acls=1
# targetcli /iscsi/iqn.2020-01.demo.ceph:mypool/tpg1/ set
> attribute cache_dynamic_acls=1

Txuag lub configuration:

# targetcli saveconfig

Tshawb xyuas qhov muaj ntawm lub hom phiaj:

# iscsiadm -m discovery -t st -p 127.0.0.1:3260
127.0.0.1:3260,1 iqn.2020-01.demo.ceph:mypool

Peb txuas lub hom phiaj:

# iscsiadm -m node --login
Logging in to [iface: default, target: iqn.2020-01.demo.ceph:mypool, portal: 127.0.0.1,3260] (multiple)
Login to [iface: default, target: iqn.2020-01.demo.ceph:mypool, portal: 127.0.0.1,3260] successful.

Yog tias koj ua txhua yam kom raug, lub disk tshiab yuav tshwm sim ntawm tus neeg rau zaub mov, uas zoo li SCSI ntaus ntawv, tab sis qhov tseeb yog cov duab los ntawm Ceph, nkag los ntawm lub hom phiaj iSCSI. Txhawm rau kom tsis txhob muaj teeb meem khau raj, nws yog qhov zoo dua los tshem tawm cov kev sib txuas nrog disk thiab pom lub hom phiaj los ntawm tus pib hauv zos:

# iscsiadm -m node --logout
# iscsiadm -m discoverydb -o delete -t st -p 127.0.0.1:3260

Txhua yam uas tseem tshuav yog ua kom tsis muaj teeb meem kom cov duab txuas nrog txiav thiab, tom qab kev sib txuas, lub hom phiaj yog stratified. Launching lub hom phiaj muaj ob kauj ruam - txuas RBD thiab ua tiav lub hom phiaj.

Ua ntej, cia peb teeb tsa qhov kev sib txuas tsis siv neeg ntawm RBD cov duab rau tus tswv tsev. Qhov no yog ua los ntawm kev ntxiv cov kab hauv qab no rau cov ntaub ntawv /etc/ceph/rbdmap:

# cat /etc/ceph/rbdmap
# RbdDevice Parameters
mypool/myimage id=admin
# systemctl enable rbdmap

Restoring lub hom phiaj configuration yog ib qho nyuaj me ntsis - peb yuav tsum tau sau ib chav tsev rau systemd uas yuav restore lub configuration:

# cat /usr/lib/systemd/system/scsi-target.service
[Unit] Description=Start iSCSI target

After=network-online.target rbdmap.service
Before=remote-fs-pre.target
Wants=network-online.target remote-fs-pre.target

[Service] Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/targetcli restoreconfig

[Install] WantedBy=multi-user.target

# systemctl daemon-reload
# systemctl enable scsi-target

Qhov kev sim zaum kawg yog reboot peb lub monitor dua (tam sim no nws yog lub hom phiaj iSCSI). Nws yuav tsum raug sau tseg tias yog tias peb tsis tau tshem tawm cov neeg pib lub database nrog cov lus txib iscsiadm -n discoverydb -o rho tawm ... koj tuaj yeem xaus nrog lub server uas tsis thauj khoom lossis siv sijhawm ntev los thauj khoom.

tshuav dab tsi?

Configure tus pib ntawm lub server qhov twg peb xav xa lub hom phiaj.

Yuav ua li cas kom ntseeg tau qhov kev zam txim ntawm peb lub hom phiaj?

Koj tuaj yeem teeb tsa lub hom phiaj ntawm lwm tus saib thiab teeb tsa multipath (vmware yuav nkag siab qhov no thiab txawm tias ua haujlwm, Hyper-V yuav tsis nkag siab - nws yuav tsum tau SCSI xauv). Txij li thaum tus neeg siv Ceph los ntawm cov ntsiav tsis siv caching, qhov no yog qhov ua tau zoo heev. Lossis lwm qhov kev xaiv yog los tsim cov peev txheej ntawm peb yam khoom - lub hom phiaj IP chaw nyob thiab rbdmap thiab scsi-target cov kev pabcuam, thiab tswj cov peev txheej no los ntawm cov cuab yeej sib txuas (leej twg hais tias pacemaker?)

Es tsis txhob tom qab lo lus

Raws li qhov tseeb, tsab xov xwm no yog ib qho kev tso dag me ntsis - tab sis hauv nws kuv sim "ceev thiab piv txwv" xav txog ntau lub ntsiab lus nrov nyob rau tib lub sijhawm - iSCSI lub hom phiaj, uas tej zaum yuav tsis tas xa cov duab Ceph - tab sis piv txwv li, xa tawm LVM ntim, lub hauv paus ntawm kev ua haujlwm nrog iSCSI tus pib (yuav ua li cas luam theej duab lub hom phiaj, yuav ua li cas txuas mus rau lub hom phiaj, txiav tawm, tshem tawm lub hom phiaj nkag los ntawm cov ntaub ntawv), sau koj tus kheej chav rau systemd thiab lwm yam.

Kuv vam tias txawm tias koj tsis rov ua qhov kev sim no tag nrho, tsawg kawg ib yam dab tsi los ntawm kab lus no yuav muaj txiaj ntsig rau koj.

Tau qhov twg los: www.hab.com

Ntxiv ib saib