2017-07-06 17:32:53 +00:00
|
|
|
=============================================================
|
|
|
|
Configuring the iSCSI Target using the Command Line Interface
|
|
|
|
=============================================================
|
|
|
|
|
|
|
|
The Ceph iSCSI gateway is the iSCSI target node and also a Ceph client
|
|
|
|
node. The Ceph iSCSI gateway can be a standalone node or be colocated on
|
|
|
|
a Ceph Object Store Disk (OSD) node. Completing the following steps will
|
|
|
|
install, and configure the Ceph iSCSI gateway for basic operation.
|
|
|
|
|
|
|
|
**Requirements:**
|
|
|
|
|
2017-07-06 22:22:02 +00:00
|
|
|
- A running Ceph Luminous or later storage cluster
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2018-01-10 22:38:13 +00:00
|
|
|
- RHEL/CentOS 7.5; Linux kernel v4.17 or newer; or the `Ceph iSCSI client kernel <https://shaman.ceph.com/repos/kernel/ceph-iscsi-stable>`_
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2017-07-06 22:22:02 +00:00
|
|
|
- The following packages must be installed from your Linux distribution's software repository:
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2017-07-06 22:22:02 +00:00
|
|
|
- ``targetcli-2.1.fb47`` or newer package
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2017-07-06 22:22:02 +00:00
|
|
|
- ``python-rtslib-2.1.fb64`` or newer package
|
|
|
|
|
2017-08-08 23:14:57 +00:00
|
|
|
- ``tcmu-runner-1.3.0`` or newer package
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2017-08-08 23:14:57 +00:00
|
|
|
- ``ceph-iscsi-config-2.3`` or newer package
|
|
|
|
|
|
|
|
- ``ceph-iscsi-cli-2.5`` or newer package
|
|
|
|
|
|
|
|
.. important::
|
2017-07-06 17:32:53 +00:00
|
|
|
If previous versions of these packages exist, then they must
|
2017-07-06 22:22:02 +00:00
|
|
|
be removed first before installing the newer versions.
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
Do the following steps on the Ceph iSCSI gateway node before proceeding
|
|
|
|
to the *Installing* section:
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. If the Ceph iSCSI gateway is not colocated on an OSD node, then copy
|
2017-07-06 17:32:53 +00:00
|
|
|
the Ceph configuration files, located in ``/etc/ceph/``, from a
|
|
|
|
running Ceph node in the storage cluster to the iSCSI Gateway node.
|
|
|
|
The Ceph configuration files must exist on the iSCSI gateway node
|
|
|
|
under ``/etc/ceph/``.
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. Install and configure the `Ceph Command-line
|
2017-07-06 17:32:53 +00:00
|
|
|
Interface <http://docs.ceph.com/docs/master/start/quick-rbd/#install-ceph>`_
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. If needed, open TCP ports 3260 and 5000 on the firewall.
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. Create a new or use an existing RADOS Block Device (RBD).
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
**Installing:**
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. As ``root``, on all iSCSI gateway nodes, install the
|
2017-07-06 17:32:53 +00:00
|
|
|
``ceph-iscsi-cli`` package:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# yum install ceph-iscsi-cli
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. As ``root``, on all iSCSI gateway nodes, install the ``tcmu-runner``
|
2017-07-06 17:32:53 +00:00
|
|
|
package:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# yum install tcmu-runner
|
|
|
|
|
2018-01-11 20:54:06 +00:00
|
|
|
**Setup:**
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. As ``root``, on a iSCSI gateway node, create a file named
|
2017-07-06 17:32:53 +00:00
|
|
|
``iscsi-gateway.cfg`` in the ``/etc/ceph/`` directory:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# touch /etc/ceph/iscsi-gateway.cfg
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. Edit the ``iscsi-gateway.cfg`` file and add the following lines:
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
[config]
|
|
|
|
# Name of the Ceph storage cluster. A suitable Ceph configuration file allowing
|
|
|
|
# access to the Ceph storage cluster from the gateway node is required, if not
|
|
|
|
# colocated on an OSD node.
|
|
|
|
cluster_name = ceph
|
|
|
|
|
|
|
|
# Place a copy of the ceph cluster's admin keyring in the gateway's /etc/ceph
|
|
|
|
# drectory and reference the filename here
|
|
|
|
gateway_keyring = ceph.client.admin.keyring
|
|
|
|
|
|
|
|
|
|
|
|
# API settings.
|
|
|
|
# The API supports a number of options that allow you to tailor it to your
|
|
|
|
# local environment. If you want to run the API under https, you will need to
|
|
|
|
# create cert/key files that are compatible for each iSCSI gateway node, that is
|
|
|
|
# not locked to a specific node. SSL cert and key files *must* be called
|
|
|
|
# 'iscsi-gateway.crt' and 'iscsi-gateway.key' and placed in the '/etc/ceph/' directory
|
|
|
|
# on *each* gateway node. With the SSL files in place, you can use 'api_secure = true'
|
|
|
|
# to switch to https mode.
|
|
|
|
|
|
|
|
# To support the API, the bear minimum settings are:
|
|
|
|
api_secure = false
|
|
|
|
|
|
|
|
# Additional API configuration options are as follows, defaults shown.
|
|
|
|
# api_user = admin
|
|
|
|
# api_password = admin
|
|
|
|
# api_port = 5001
|
|
|
|
# trusted_ip_list = 192.168.0.10,192.168.0.11
|
|
|
|
|
2018-01-11 20:53:16 +00:00
|
|
|
..note::
|
|
|
|
trusted_ip_list is a list of IP addresses on each iscsi gateway that
|
|
|
|
will be used for management operations like target creation, lun
|
|
|
|
exporting, etc. The IP can be the same that will be used for iSCSI
|
|
|
|
data, like READ/WRITE commands to/from the RBD image, but using
|
|
|
|
separate IPs is recommended.
|
|
|
|
|
2017-08-08 23:14:57 +00:00
|
|
|
.. important::
|
2017-07-06 17:32:53 +00:00
|
|
|
The ``iscsi-gateway.cfg`` file must be identical on all iSCSI gateway nodes.
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. As ``root``, copy the ``iscsi-gateway.cfg`` file to all iSCSI
|
2017-07-06 17:32:53 +00:00
|
|
|
gateway nodes.
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. As ``root``, on all iSCSI gateway nodes, enable and start the API
|
2017-07-06 17:32:53 +00:00
|
|
|
service:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# systemctl enable rbd-target-api
|
|
|
|
# systemctl start rbd-target-api
|
|
|
|
|
|
|
|
**Configuring:**
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
gwcli will create and configure the iSCSI target and RBD images and copy the
|
|
|
|
configuration across the gateways setup in the last section. Lower level
|
|
|
|
tools, like targetcli and rbd, can be used to query the local configuration,
|
|
|
|
but should not be used to modify it. This next section will demonstrate how
|
|
|
|
to create a iSCSI target and export a RBD image as LUN 0.
|
|
|
|
|
2017-07-12 22:11:25 +00:00
|
|
|
#. As ``root``, on a iSCSI gateway node, start the iSCSI gateway
|
2017-07-06 17:32:53 +00:00
|
|
|
command-line interface:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# gwcli
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
#. Go to iscsi-targets and create a target with the name
|
|
|
|
iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw:
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
> /> cd /iscsi-target
|
|
|
|
> /iscsi-target> create iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
#. Create the iSCSI gateways. The IPs used below are the ones that will be
|
|
|
|
used for iSCSI data like READ and WRITE commands. They can be the
|
|
|
|
same IPs used for management operations listed in trusted_ip_list,
|
|
|
|
but it is recommended that different IPs are used.
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
> /iscsi-target> cd iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/gateways
|
|
|
|
> /iscsi-target...-igw/gateways> create ceph-gw-1 10.172.19.21
|
|
|
|
> /iscsi-target...-igw/gateways> create ceph-gw-2 10.172.19.22
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
If not using RHEL/CentOS or using an upstream or ceph-iscsi-stable kernel,
|
|
|
|
the skipchecks=true argument must be used. This will avoid the Red Hat kernel
|
|
|
|
and rpm checks:
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
> /iscsi-target> cd iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/gateways
|
|
|
|
> /iscsi-target...-igw/gateways> create ceph-gw-1 10.172.19.21 skipchecks=true
|
|
|
|
> /iscsi-target...-igw/gateways> create ceph-gw-2 10.172.19.22 skipchecks=true
|
|
|
|
|
|
|
|
#. Add a RBD image with the name disk_1 in the pool rbd:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
> /iscsi-target...-igw/gateways> cd /disks
|
|
|
|
> /disks> create pool=rbd image=disk_1 size=90G
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
There can not be any periods (.) in the pool name or in the image name.
|
|
|
|
|
|
|
|
#. Create a client with the initiator name iqn.1994-05.com.redhat:rh7-client:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
> /disks> cd /iscsi-target/iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/hosts
|
|
|
|
> /iscsi-target...eph-igw/hosts> create iqn.1994-05.com.redhat:rh7-client
|
|
|
|
|
|
|
|
#. Set the client's CHAP username to myiscsiusername and password to
|
|
|
|
myiscsipassword:
|
|
|
|
|
|
|
|
::
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
> /iscsi-target...at:rh7-client> auth chap=myiscsiusername/myiscsipassword
|
2017-07-06 17:32:53 +00:00
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
.. warning::
|
2017-07-06 17:32:53 +00:00
|
|
|
CHAP must always be configured. Without CHAP, the target will
|
|
|
|
reject any login requests.
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
#. Add the disk to the client:
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2018-01-12 01:35:22 +00:00
|
|
|
> /iscsi-target...at:rh7-client> disk add rbd.disk_1
|
2017-07-06 17:32:53 +00:00
|
|
|
|
|
|
|
The next step is to configure the iSCSI initiators.
|