一、前提准备
- 两台 Linux 服务器(主机名分别为ceph-iscsi-node1、ceph-iscsi-node2),作为iscsi网关,可以是集群中的主机。
- 一台 Linux 主机,作为 Linux 系统下的客户端。
- 一台 Windows 主机,作为 Windows 系统下的客户端。
二、配置ceph-iscsi网关
- 修改osd配置
shell> cat /etc/ceph/ceph.conf [osd] osd heartbeat grace = 20 osd heartbeat interval = 5
- 新建repo文件(已有ceph iscsi rpm包可跳过该步)
cat /etc/yum.repo.d/iscsi.repo [ceph-iscsi] name=Ceph-iscsi baseurl=https://4.chacra.ceph.com/r/ceph-iscsi/master/88f3f67981c7da15448f140f711a1a8413d450b0/centos/7/flavors/default/noarch/ priority=1 gpgcheck=0 [tcmu-runner] name=tcmu-runner baseurl=https://3.chacra.ceph.com/r/tcmu-runner/master/eef511565078fb4e2ed52caaff16e6c7e75ed6c3/centos/7/flavors/default/x86_64/ priority=1 gpgcheck=0 [python-rtslib] name=python-rtslib baseurl=https://2.chacra.ceph.com/r/python-rtslib/master/67eb1605c697b6307d8083b2962f5170db13d306/centos/7/flavors/default/noarch/ priority=1 gpgcheck=0
- 将yum源的rpm包下载到本地源(已有ceph iscsi rpm包可跳过该步)
shell> cd /usr/local/src/ shell> yum install --downloadonly --downloaddir=yum/ceph-iscsi/ targetcli python-rtslib tcmu-runner ceph-iscsi shell> createrepo -p -d -o yum/ yum/
- ceph-iscsi网关初始配置
如果使用的不是集群内的节点作为ceph-iscsi网关,那么就需要进行一些初始的配置。
# 安装ceph shell> yum install -y ceph-common librados2 librados2-devel librbd1 python-rados python-rbd shell> yum install -y cmake make gcc \ libnl3 libnl3-devel glib2 glib2-devel zlib zlib-devel kmod kmod-devel \ glusterfs-api glusterfs-api-devel python-setuptools python2-cryptography shell> yum install -y libkmod pyparsing python-kmod python-pyudev python-gobject \ python-urwid python-pyparsing python-netaddr python-netifaces \ python-crypto python-requests python-flask pyOpenSSL # 从集群中的一台机器上拷贝 ceph.conf 到本机的 /etc/ceph/ceph.conf # 从集群中的一台机器上拷贝 ceph.client.admin.keyring 到本机的 /etc/ceph/ceph.client.admin.keyring # 在两台机器上分别绑定host shell> cat /etc/hosts 10.20.63.241 ceph-iscsi-node1 10.20.63.245 ceph-iscsi-node2
三、安装配置iscsi
- 安装rpm包
shell> cd /usr/local/src shell> wget http://dlsw.91donkey.com/software/source/ceph/ceph-iscsi/ceph-iscsi-3.2-8.g88f3f67.el7.noarch.rpm shell> wget http://dlsw.91donkey.com/software/source/ceph/ceph-iscsi/python-rtslib-2.1.fb68-1.noarch.rpm shell> wget http://dlsw.91donkey.com/software/source/ceph/ceph-iscsi/python-configshell-1.1.fb23-5.el7.noarch.rpm shell> wget http://dlsw.91donkey.com/software/source/ceph/ceph-iscsi/tcmu-runner-1.4.1-0.el7.centos.x86_64.rpm shell> rpm -ivh *.rpm
- 新建iscsi-gateway配置文件
# 两台ceph-iscsi节点的配置要保持一致 shell> cat >> /etc/ceph/iscsi-gateway.cfg << EOF [config] cluster_name = ceph pool = iscsi_pools cluster_client_name = client.admin api_secure = false trusted_ip_list = 10.20.72.191,10.20.72.192,10.20.72.193 EOF
- 创建rbd pool
shell> ceph osd pool create iscsi_pools 128 128 shell> ceph osd pool application enable iscsi_pools rbd
- 启动ceph iscsi服务
shell> systemctl daemon-reload shell> systemctl enable rbd-target-api shell> systemctl start rbd-target-api && systemctl status rbd-target-api shell> systemctl start rbd-target-gw && systemctl status rbd-target-gw
- 配置ceph-iscsi(在其中一台网关配置即可)
shell> gwcli gwcli /> cd /iscsi-targets gwcli /> create iqn.2019-06.com.91donkey.iscsi-gw:iscsi-gw gwcli /> cd /iscsi-targets/iqn.2019-06.com.91donkey.iscsi-gw:iscsi-gw/gateways gwcli /> create skipchecks=true ceph-iscsi-node1 10.20.63.241 gwcli /> create skipchecks=true ceph-iscsi-node2 10.20.63.245 gwcli /> cd /disks gwcli /> create pool=iscsi_pools image=disk01 size=100G gwcli /> cd /iscsi-targets/iqn.2019-06.com.91donkey.iscsi-gw:iscsi-gw/hosts gwcli /> create iqn.2019-06.com.91donkey:iscsi-client gwcli /> auth username=myiscsiusername password=myiscsipassword gwcli /> disk action=add disk=iscsi_pools/disk01
四、Linux客户端配置
暂无
五、Windows客户端配置
以win2008r2为例,在 控制面板 -> 管理工具 -> iSCSI发起程序
修改发起程序名称
添加发现目标门户
可以看到出现目标
连接到该目标
修改高级设置
可以看到已连接
在磁盘管理中看到磁盘已连接