centos8 安装 spdk

新机器环境配置

环境:

centos 8

环境问题解决

问题

现象: centos 8 yum无法下载lib

centos 8 已经EOL了,需要更换源

解决:

# 备份现有的repo配置文件
rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo

# 上面的命令会吧 epel 这个也给改了,这个就不用改了啦,还是需要的,
mv epel.repo.bak epel.repo

不推荐 阿里源,很多包都没有,
推荐华为源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo

# 执行yum源更新命令
yum clean all
yum makecache

问题

现象:

CentOS 8 下载东西Error: yum Failed to download metadata for repo ‘CentOS-Ceph-Nautilus.repo‘错误

解决:

直接删除他,或者

mv CentOS-Ceph-Nautilus.repo CentOS-Ceph-Nautilus.repo.backup

把他名字改了, 再次执行,没问题.

可能缺失的依赖包:

在make的时候,仔细查看输出的打印,会看到很多no

[root@localhost spdk]# make 
......
...
...
Program pkg-config found: YES (/usr/bin/pkg-config)
Program check-symbols.sh found: YES (/root/Desktop/yyr/spdk/spdk/spdk/dpdk/buildtools/check-symbols.sh)
Program options-ibverbs-static.sh found: YES (/root/Desktop/yyr/spdk/spdk/spdk/dpdk/buildtools/options-ibverbs-static.sh)
Program objdump found: YES (/usr/bin/objdump)
Program python3 found: YES (/usr/bin/python3.6)
Program cat found: YES (/usr/bin/cat)
Checking for size of "void *" : 8
Checking for size of "void *" : 8
Library m found: YES
Library numa found: YES
Has header "numaif.h" : YES 
Library fdt found: NO
Library execinfo found: NO
Has header "execinfo.h" : YES 
Found pkg-config: /usr/bin/pkg-config (1.4.2)
Run-time dependency libarchive found: NO (tried pkgconfig)
Run-time dependency libbsd found: NO (tried pkgconfig)
Run-time dependency jansson found: NO (tried pkgconfig)
Run-time dependency openssl found: YES 1.1.1k
Run-time dependency libpcap found: NO (tried pkgconfig)
Library pcap found: NO
.......
...
...

这些no 最好都安装上,除非你知道你需要哪些,不需要哪些

可以安装以下包:

yum install openssl-devel

yum install libuuid-devel

pip3 install pyelftools --upgrade

 yum install CUnit-devel

yum install meson

yum install make

yum install libfdt libfdt-devel

 yum install numactl-devel.x86_64

 yum install gcc-c++.x86_64

yum install ncurses-devel

yum install doxygen

yum install jansson-devel

yum install libarchive-devel

sudo yum install libpcap-devel

具体情况具体分析,仅供参考吧

问题

现象:

spdk/scripts/pkgdep/centos.sh: line 85: yum-config-manager: command not found

查看是不是没有这个文件:
[root@localhost spdk]# which yum-config-manager
/usr/bin/which: no yum-config-manager in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

解决:

[root@localhost spdk]# yum install yum-utils

问题

现象

Error: No matching repo to modify: epel.
Error!

解决:

[root@localhost spdk]# yum install epel-release
CentOS-8 - Ceph Pacific                                                                                        240 kB/s | 594 kB     00:02    
ELRepo.org Community Enterprise Linux Repository - el8                                                         123 kB/s | 213 kB     00:01    
Package epel-release-8-19.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

问题

root@localhost spdk]# ./configure --with-fio=/usr/share/fio
Using default SPDK env in /root/Desktop/yyr/spdk/spdk/spdk/lib/env_dpdk
Using default DPDK in /root/Desktop/yyr/spdk/spdk/spdk/dpdk/build
WARNING: ISA-L & DPDK crypto cannot be used as nasm ver must be 2.14 or newer.
Without ISA-L, there is no software support for crypto or compression,
so these features will be disabled.
Creating mk/config.mk...done.
Creating mk/cc.flags.mk...done.
Type 'make' to build


上面的waring,可以看出来,nasm 版本不对,但是dpdk 和isa-l 是必须的,所以需要解决这个问题。

参考 :nasm安装-CSDN博客

步骤:

安装 nasm
第一步:
进入Nasm下载中心
地址:https://www.nasm.us/pub/nasm/releasebuilds/
没有其他后缀的为正式版。例如:2.15为正式版

第二步:
下载
Linux下载命令
wget https://www.nasm.us/pub/nasm/releasebuilds/2.15/nasm-2.15.tar.gz

第三步:
解压nasm
tar -vxf nasm-2.15-xdoc.tar.gz

第四步:
进入nasm 目录中执行configure文件
./configure

注意看打出的 waring
configure: WARNING: No xmlto package found, cannot build man pages
这个是缺少包,
sudo yum install xmlto, 
安装后,重新 ./configure
无waring

第五步:
执行完成第四步后 进行编译
make install 
执行完毕后。就以及将nasm安装成功了。

可以查看nasm
[root@localhost fio]# nasm -v
NASM version 2.15 compiled on Jan 16 2024



问题

make 的时候报错

config/meson.build:388:4: ERROR: Problem encountered: 
No NUMA library (development package) found, yet DPDK configured for multiple NUMA nodes.
Please install libnuma, or set 'max_numa_nodes' option to '1' to build without NUMA support.

是缺少numa 环境,

尝试
yum install numactl-devel

问题


[root@localhost spdk]# make clean 
make[2]: Nothing to be done for 'clean'.
<stdin>:1:10: fatal error: CUnit/CUnit.h: No such file or directory
compilation terminated.
Makefile:22: "blob_ut.c compilation skipped, only CUnit version 2.1-3 is supported"
make[1]: Nothing to be done for 'clean'.




缺少CUnit 2.1-3 ,需要安装

尝试
yum install CUnit-devel,
失败

参考,https://blog.csdn.net/zxhjlt/article/details/119451061
下载 CUnit2.1.3 
解压,
编译,
mv configure.in configure.ac
aclocal
autoconf
automake
autoheader
automake --add-missing
libtoolize --automake --copy --debug --force
./configure --prefix =(安装路径), 自己指定一个不会改变的路径就行或者不指定路径,由系统自己安装路径

make
make install



make 的时候报错

configure.ac:4: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:4: https://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:158: error: required file './compile' not found
configure.ac:158:   'automake --add-missing' can install 'compile'
configure.ac:4: error: required file './missing' not found
configure.ac:4:   'automake --add-missing' can install 'missing'
CUnit/Sources/Automated/Makefile.am: error: required file './depcomp' not found
CUnit/Sources/Automated/Makefile.am:   'automake --add-missing' can install 'depcomp'


可以看到其实需要 ./compile 文件

automake --add-missing,就可以创建这些文件,

再 ./configure 
make
make install
只要c成功创建和编译,就不用管中间的报错。

cunit 问题搞定。



问题:

ERROR: Could not detect Ninja v1.8.2 or newer

Ninja 需要安装,

参考:ninja简介及安装_ninja安装-CSDN博客

ninja 需要re2c 环境,

先安装re2c,


可以去github下载:https://github.com/skvadrik/re2c,
也可以在这里下载:https://sourceforge.net/projects/re2c/

官网教程:http://re2c.org/build/build.html

Build (Autotools)

If you are building from a release tarball, the configure script is already there. Otherwise it is necessary to generate it:

$ autoreconf -i -W all

An in-tree build (objects are generated side by side with sources):

$ ./configure && make && make install

An out-of-tree build (objects are generated in a separate directory):

$ mkdir .build && cd .build && ../configure && make && make install



再安装ninja

在github 下载
https://github.com/ninja-build/ninja

再编译,
./configure.py --bootstrap


编译完成
把 文件 copy 到系统路径下
sudo cp ninja /usr/bin


第二种更简单的方式,
直接去github的release 界面 下载 编译好的文件,直接copy到 /usr/bin 路径下



问题

继续make,还是报错

bdev_aio.c:27:10: fatal error: libaio.h: No such file or directory

还是缺少包,

安装上
sudo yum install libaio-devel


问题:

现象:

[root@localhost spdk]# make 
make[3]: help2man: Command not found
make[3]: [Makefile:4620: programs/igzip.1] Error 127 (ignored)

缺少help2man,

安装

sudo yum install help2man

问题

现象

Error: 
 Problem: cannot install the best candidate for the job
  - nothing provides libc.so.6(GLIBC_2.34)(64bit) needed by nasm-2.16.01-0.fc36.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

尝试了手动安装nasm,但是还是想自动化


编译spdk:

1. 下载工程

参考spdk/README.md

git clone https://github.com/spdk/spdk
cd spdk
git submodule update --init

spdk因为工程非常庞大,所以有很多的子工程,需要 update -- init,这样才是一个完整的工程。

2. 安装依赖

参考readme

The dependencies can be installed automatically by scripts/pkgdep.sh.
The scripts/pkgdep.sh script will automatically install the bare minimum
dependencies required to build SPDK.
Use --help to see information on installing dependencies for optional components

./scripts/pkgdep.sh

这样会自动安装所需要的依赖。

参考官网也可以:SPDK: Getting Started

这个脚本会下载非常多的包,如果出现中途失败,报错需要解决并重新执行。
不能忽视

3. 编译:

我们需要spdk配置fio 环境,所以需要加上,其他的情况,可以自行参考

./configure --with-fio=path/to/fio

接下来编辑 CONFIG 文件,在执行了上面的命令后,会自动生成 CONFIG 文件

编辑CONFIG 文件;在spdk 路径下
CONFIG_FIO_PLUGIN=y 
CONFIG_FIO_SOURCE_DIR=path/to/fio

编译:

make
如果支持多核,可以
make -j2
make -j4 等

执行改动的设置;

cd ./scripts
./setup.sh  # 将nvme 设备初始化成 uio_pci 设备,如果pc已经使能vfio,那么将默认转换成vfio设备

执行测试命令

nvme测试命令;【参考/spdk/examples/nvme/fio_plugin/README 文件】

LD_PRELOAD=/root/Documents/test_spdk/spdk/build/fio/spdk_nvme /root/Documents/test_spdk/fio/fio /root/Documents/test_spdk/spdk/examples/nvme/fio_plugin/example_config.fio '--filename=trtype=PCIe traddr=0000.01.00.0 ns=1'

bdev测试命令;【参考/spdk/example/bdev/fio_plugin/README 文件】

LD_PRELOAD=/root/Documents/test_spdk/spdk/build/fio/spdk_bdev fio /root/Documents/test_spdk/spdk/examples/bdev/fio_plugin/example_config.fio '--filename=trtype=PCIe traddr=0000.01.00.0 ns=1'

在配置的好机器上进行测试:

进入脚本目录:

cd ./spdk/scripts

初始化nvme 设备:

以下 2 选 1: vfio 和 uio_pci设备

# 第一种
# 将nvme 设备初始化成 uio_pci 设备,如果pc已经使能vfio,那么将默认转换成vfio设备
./setup.sh 

# 第二种
# 将设备初始化成 vfio-pci 设备
DRIVER_OVERRIDE=vfio-pci ./setup.sh

# 如果是测试sriov的,那么需要将pf设备除去,不进行spdk设置,参考以下命令,如果你只有一个设备,那肯定是pf,看上面的命令就行了,
# 将 pf 跳过,其他设备转换成vfio, PCI_BLOCKED 是给指定的设备,设定为白名单
PCI_BLOCKED="0000:01:00.0" ./setup.sh
./setup.sh --help 可以查看help信息

生成相应文件的json 配置文件:

./gen_nvme.sh --json-with-subsystems > /tmp/bdev

/tmp/bdev.json 文件 复制到 /spdk/examples/bdev/fio_plugin/

其中,bdev.json 文件,我也列出来,以供参考:

{
"subsystems": [
{
"subsystem": "bdev",
"config": [
{
"method": "bdev_nvme_attach_controller",
"params": {
"trtype": "PCIe",
"name":"Nvme0",
"traddr":"0000:01:00.0"
}
}
]
}
]
}

这个就可以通过这个bdev.json 指定spdk 去找到咱们想测的nvme 设备,即nvme0.

现在spdk的nvme配置文件已经完成了、

接下来需要配置 fio文件,告诉他 nvme设备和 ioengine ,

下面根据 nvme0 和 ioengine bdev 来进行操作:

编辑fio_test.conf 文件:

[global]
# 写自己的spdk 路径下的bdev 文件路径
ioengine=/root/Documents/test_spdk/spdk/build/fio/spdk_bdev
# 将刚刚生成的spdk json conf 文件路径 写在下面
spdk_json_conf=/root/Documents/test_spdk/spdk/examples/bdev/fio_plugin/bdev.json

thread=1
direct=1
group_reporting=1

bs=4k
rw=randread
rwmixread=70
time_based=1
runtime=30
norandommap=1

[filename0]
#filename=trtype=PCIe traddr=0000.01.00.0 ns=1
# 这个filename 需要和上面的文件 nvme字段 对上,所以N 需要大写
filename=Nvme0n1
iodepth=8

执行fio命令,

#下面的fio命令有3部分
#LD_PRELOAD 是指定你的fio engine,路径就是spdk bdev路径
#fio
#fio脚本的路径,就是上面的 fio_test.conf 文件的路径

LD_PRELOAD=/root/Documents/test_spdk/spdk/build/fio/spdk_bdev fio /root/Documents/test_spdk/spdk/examples/bdev/fio_plugin/fio_test.conf

如果 fio中会出现报错提醒,仔细分析一下,原因,如果是因为HUGEMEM 不足,可以尝试以下命令.

# 申请大内存
sudo HUGEMEM=8192 ./setup.sh

# 再执行一次 fio
LD_PRELOAD=/root/Documents/test_spdk/spdk/build/fio/spdk_bdev fio /root/Documents/test_spdk/spdk/examples/bdev/fio_plugin/fio_test.conf


目前还有待解决的问题:

问题1,EAL: No available 1048576 kB hugepages reported

现象:

[root@localhost scripts]# LD_PRELOAD=/root/Documents/test_spdk/spdk/build/fio/spdk_bdev fio /root/Documents/test_spdk/spdk/examples/bdev/fio_plugin/fio.conf 
filename0: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=spdk_bdev, iodepth=8
fio-3.3
Starting 1 thread
EAL: No available 1048576 kB hugepages reported
TELEMETRY: No legacy callbacks, legacy socket not created
[2022-03-28 15:01:59.349480] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request
handling.  Do not repost this AER.
[2022-03-28 15:01:59.349504] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request
handling.  Do not repost this AER.
[2022-03-28 15:01:59.349509] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request
handling.  Do not repost this AER.
[2022-03-28 15:01:59.349513] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request
handling.  Do not repost this AER.
[2022-03-28 15:01:59.349517] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request
handling.  Do not repost this AER.
[2022-03-28 15:01:59.349521] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request
handling.  Do not repost this AER.
Jobs: 1 (f=1): [r(1)][9.7%][r=3309MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00m:Jobs: 1 (f=1): [r(1)][12.9%][r=3308MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][16.1%][r=3308MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][19.4%][r=3309MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][22.6%][r=3309MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][25.8%][r=3309MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][29.0%][r=3307MiB/s,w=0KiB/s][r=847k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][32.3%][r=3292MiB/s,w=0KiB/s][r=843k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][35.5%][r=3296MiB/s,w=0KiB/s][r=844k,w=0 IOPS][eta 00mJobs: 1 (f=1): [r(1)][38.7%][r=3281MiB/s,w=0KJobs: 1 (f=1): [r(1)][41.9%][r=3264MiB/s,w=0KiB/s][r=836k,w=0 IOPSJobs: 1 (f=1): [r(1)][100.0%][r=3313MiB/s,w=0KiB/s][r=848k,w=0 IOPS][eta 00m:00s]
filename0: (groupid=0, jobs=1): err= 0: pid=133822: Mon Mar 28 15:02:29 2022
   read: IOPS=846k, BW=3303MiB/s (3463MB/s)(96.8GiB/30001msec)
    slat (nsec): min=77, max=17590, avg=103.79, stdev=21.33
    clat (nsec): min=5636, max=38383, avg=9177.65, stdev=1082.21
     lat (nsec): min=5734, max=38481, avg=9281.45, stdev=1081.90
    clat percentiles (nsec):
     |  1.00th=[ 6944],  5.00th=[ 7520], 10.00th=[ 7840], 20.00th=[ 8256],
     | 30.00th=[ 8512], 40.00th=[ 8768], 50.00th=[ 9152], 60.00th=[ 9536],
     | 70.00th=[ 9792], 80.00th=[10176], 90.00th=[10560], 95.00th=[10816],
     | 99.00th=[11584], 99.50th=[11840], 99.90th=[14400], 99.95th=[16768],
     | 99.99th=[20352]
   bw (  MiB/s): min= 3259, max= 3312, per=99.99%, avg=3302.65, stdev=11.58, samples=59
   iops        : min=834436, max=848030, avg=845477.22, stdev=2964.22, samples=59
  lat (usec)   : 10=76.17%, 20=23.82%, 50=0.01%
  cpu          : usr=99.94%, sys=0.00%, ctx=248, majf=0, minf=0
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=99.8%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.1%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwt: total=25367307,0,0, short=0,0,0, dropped=0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=8

Run status group 0 (all jobs):
   READ: bw=3303MiB/s (3463MB/s), 3303MiB/s-3303MiB/s (3463MB/s-3463MB/s), io=96.8GiB (104GB), run=30001-30001msec
[root@localhost scripts]# 

已知这2个不是问题,就是会这么显示:

EAL: No available 1048576 kB hugepages reported
TELEMETRY: No legacy callbacks, legacy socket not created

问题2,ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request

现象:

[2022-03-28 15:01:59.349521] nvme_ctrlr.c:3166:nvme_ctrlr_async_event_cb: *ERROR*: [0000:01:00.0] Controller appears out-of-spec for asynchronous event request

todo


end


posted @   年华似水゛  阅读(861)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示