]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/doc/iscsi/getting_started.md
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / spdk / doc / iscsi / getting_started.md
CommitLineData
7c673cae
FG
1# Getting Started Guide {#iscsi_getting_started}
2
3The Intel(R) Storage Performance Development Kit iSCSI target application is named `iscsi_tgt`.
4This following section describes how to run iscsi from your cloned package.
5
6# Prerequisites {#iscsi_prereqs}
7
8This guide starts by assuming that you can already build the standard SPDK distribution on your
9platform. The SPDK iSCSI target has been known to work on several Linux distributions, namely
10Ubuntu 14.04, 15.04, and 15.10, Fedora 21, 22, and 23, and CentOS 7.
11
12Once built, the binary will be in `app/iscsi_tgt`.
13
14# Configuring iSCSI Target {#iscsi_config}
15
16A `iscsi_tgt` specific configuration file is used to configure the iSCSI target. A fully documented
17example configuration file is located at `etc/spdk/iscsi.conf.in`.
18
19The configuration file is used to configure the SPDK iSCSI target. This file defines the following:
20TCP ports to use as iSCSI portals; general iSCSI parameters; initiator names and addresses to allow
21access to iSCSI target nodes; number and types of storage backends to export over iSCSI LUNs; iSCSI
22target node mappings between portal groups, initiator groups, and LUNs.
23
24Each LUN in an iSCSI target node is associated with an SPDK block device. See @ref bdev_getting_started
25for details on configuring SPDK block devices. The block device to LUN mappings are specified in the
26configuration file as:
27
28~~~~
29[TargetNodeX]
30 LUN0 Malloc0
31 LUN1 Nvme0n1
32~~~~
33
34This exports a malloc'd target. The disk is a RAM disk that is a chunk of memory allocated by iscsi in
35user space. It will use offload engine to do the copy job instead of memcpy if the system has enough DMA
36channels.
37
38You should make a copy of the example configuration file, modify it to suit your environment, and
39then run the iscsi_tgt application and pass it the configuration file using the -c option. Right now,
40the target requires elevated privileges (root) to run.
41
42~~~
43app/iscsi_tgt/iscsi_tgt -c /path/to/iscsi.conf
44~~~
45
46# Configuring iSCSI Initiator {#iscsi_initiator}
47
48The Linux initiator is open-iscsi.
49
50Installing open-iscsi package
51Fedora:
52~~~
53yum install -y iscsi-initiator-utils
54~~~
55
56Ubuntu:
57~~~
58apt-get install -y open-iscsi
59~~~
60
61## Setup
62
63Edit /etc/iscsi/iscsid.conf
64~~~
65node.session.cmds_max = 4096
66node.session.queue_depth = 128
67~~~
68
69iscsid must be restarted or receive SIGHUP for changes to take effect. To send SIGHUP, run:
70~~~
71killall -HUP iscsid
72~~~
73
74Recommended changes to /etc/sysctl.conf
75~~~
76net.ipv4.tcp_timestamps = 1
77net.ipv4.tcp_sack = 0
78
79net.ipv4.tcp_rmem = 10000000 10000000 10000000
80net.ipv4.tcp_wmem = 10000000 10000000 10000000
81net.ipv4.tcp_mem = 10000000 10000000 10000000
82net.core.rmem_default = 524287
83net.core.wmem_default = 524287
84net.core.rmem_max = 524287
85net.core.wmem_max = 524287
86net.core.optmem_max = 524287
87net.core.netdev_max_backlog = 300000
88~~~
89
90### Discovery
91
92Assume target is at 192.168.1.5
93~~~
94iscsiadm -m discovery -t sendtargets -p 192.168.1.5
95~~~
96
97### Connect to target
98
99~~~
100iscsiadm -m node --login
101~~~
102
103At this point the iSCSI target should show up as SCSI disks. Check dmesg to see what
104they came up as.
105
106### Disconnect from target
107
108~~~
109iscsiadm -m node --logout
110~~~
111
112### Deleting target node cache
113
114~~~
115iscsiadm -m node -o delete
116~~~
117
118This will cause the initiator to forget all previously discovered iSCSI target nodes.
119
120### Finding /dev/sdX nodes for iSCSI LUNs
121
122~~~
123iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}'
124~~~
125
126This will show the /dev node name for each SCSI LUN in all logged in iSCSI sessions.
127
128### Tuning
129
130After the targets are connected, they can be tuned. For example if /dev/sdc is
131an iSCSI disk then the following can be done:
132Set noop to scheduler
133
134~~~
135echo noop > /sys/block/sdc/queue/scheduler
136~~~
137
138Disable merging/coalescing (can be useful for precise workload measurements)
139
140~~~
141echo "2" > /sys/block/sdc/queue/nomerges
142~~~
143
144Increase requests for block queue
145
146~~~
147echo "1024" > /sys/block/sdc/queue/nr_requests
148~~~