鲲鹏社区首页
中文
注册
开发者
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

安装和使能特性

在Redis上使能网络异步优化特性需要先安装相关依赖库再执行so库文件编译与patch包合入。本节以Redis 7.0.15使能特性为例进行说明。

  1. 下载所需依赖。
    1
    yum -y install wget git vim tar make gcc gcc-c++ libatomic texinfo libtool
    
  2. 安装liburing.a依赖库。
    1
    2
    3
    4
    5
    6
    git clone https://gitee.com/src-openeuler/liburing.git
    cd liburing
    tar -zxvf liburing-2.4.tar.gz
    cd liburing-2.4
    make -j
    make install
    
  3. 安装libconfig依赖库。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    git clone https://gitee.com/src-openeuler/libconfig.git
    cd libconfig
    tar -zxvf v1.8.1.tar.gz
    cd libconfig-1.8.1
    autoreconf --install --force
    ./configure --prefix=/usr/local
    make -j
    make install
    cp /usr/local/lib/libconfig.so.15 /usr/lib64
    
  4. 请参见表2下载Redis 7.0.15配套网络异步优化特性patch包。
    1
    git clone https://gitcode.com/BoostKit/kraio.git
    
  5. 新建“/etc/kraio”文件夹,将kraio中的iouring.conf文件复制到“/etc/kraio”中。
    1
    2
    3
    cd kraio
    mkdir /etc/kraio 
    cp conf/iouring.conf /etc/kraio
    
  6. 编译出libkraio.so文件。
    1
    2
    make clean 
    make
    
  7. 将编译出的so文件和kraio.h文件放到对应路径,并配置环境变量。
    1
    2
    3
    4
    cp ./libkraio.so /usr/lib64 
    cp ./include/kraio.h /usr/include
    export PATH=/usr/local/include:$PATH 
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64:/usr/lib
    
  8. 将Redis中的redis-7.0.15-adapt-iouring.patch移到Redis源码目录下,执行合入patch的命令。

    此处以Redis 7.0.15为例。对于Redis 6.0.20,请将redis-6.0.20-adapt-iouring.patch移到Redis源码目录下,再执行合入patch的命令。后续操作中,请注意替换命令中的版本号。

    1
    2
    3
    4
    5
    git clone https://gitcode.com/BoostKit/Redis.git
    cd Redis
    cp redis-7.0.15-adapt-iouring.patch path/redis-7.0.15/
    cd path/redis-7.0.15
    patch -p1 < redis-7.0.15-adapt-iouring.patch
    
  9. 重新编译Redis。
    1
    2
    3
    cd path/redis-7.0.15
    make distclean
    make -j
    
  10. 修改“/etc/kraio/iouring.conf”文件。
    1. 进入/etc/kraio。
      cd /etc/kraio
    2. 打开iouring.conf。
      vim iouring.conf
    3. “i”进入编辑模式,修改send_callback=1, zero_copy=1和log_level=3。

    4. “Esc”键,输入:wq!,按“Enter”保存并退出编辑。
  11. 在测试过程中,在服务器端输入如下命令查看,如出现iou-sqp-*相关线程说明特性使能成功。
    1
    top -Hp <redis-server实例pid>