参考文档
鲲鹏DevKit开发套件下载-鲲鹏社区鲲鹏社区是面向鲲鹏合作伙伴、开发者的全产业社区,集学习、实验、认证等功能为一体,是鲲鹏计算产业的官方社区。https://www.hikunpeng.com/developer/devkit/download
鲲鹏社区-官网丨凝心聚力 共创行业新价值鲲鹏社区是面向鲲鹏合作伙伴、开发者的全产业社区,集学习、实验、认证等功能为一体,是鲲鹏计算产业的官方社区。https://www.hikunpeng.com/document/detail/zh/kunpengdevps/handon_tutorials/bestpractice/kunpengdeppractice_21_0011.html
[root@openeuler40 ~]# setenforce 0
[root@openeuler40 ~]# ls /resourses/
[root@openeuler40 ~]#
[root@openeuler40 ~]# mkdir /devkit/
[root@openeuler40 ~]# tar -xf /resourses/DevKit-All-24.0.RC1-Linux-Kunpeng.tar.gz /devkit/
[root@openeuler40 ~]# ls /devkit/
DevKit-All-24.0.RC1-Linux-Kunpeng
[root@openeuler40 ~]# cd /devkit/DevKit-All-24.0.RC1-Linux-Kunpeng/
[root@openeuler40 DevKit-All-24.0.RC1-Linux-Kunpeng]#
[root@openeuler40 DevKit-All-24.0.RC1-Linux-Kunpeng]# ./install.sh(参考社区文档安装)
安装后验证:
[root@openeuler40 ~]# cd /opt/DevKit/tools/
[root@openeuler40 tools]# ./devkit -v
24.0.RC1
[root@openeuler40 tools]#
[root@vm1 ~]# firefox https://10.2.35.40:8086
[root@vm1 ~]# mkdir /testdir/
[root@vm1 testdir]# wget https://repo1.maven.org/maven2/io/netty/netty-all/4.1.34.Final/netty-all-4.1.34.Final.jar
[root@vm1 testdir]# ls
netty-all-4.1.34.Final.jar
[root@vm1 testdir]#
在浏览器上传软件包,进行应用迁移评估(参考社区文档)
Oplocal:在x86_64平台上安装devkit
[root@oplocal ~]# setenforce 0
[root@oplocal ~]# vim /etc/selinux/config
[root@oplocal ~]# cat /etc/selinux/config | grep ^SELINUX=
SELINUX=permissive
[root@oplocal ~]#
[root@oplocal ~]# ls DevKit-All-24.0.RC1-Linux-x86-64.tar.gz 文件自行下载上传
DevKit-All-24.0.RC1-Linux-x86-64.tar.gz
[root@oplocal ~]#
[root@oplocal ~]# mkdir /devkit/
[root@oplocal ~]# tar -xf DevKit-All-24.0.RC1-Linux-x86-64.tar.gz -C /devkit/
[root@oplocal ~]# ls /devkit/
DevKit-All-24.0.RC1-Linux-x86-64
[root@oplocal ~]# cd /devkit/DevKit-All-24.0.RC1-Linux-x86-64/
[root@oplocal DevKit-All-24.0.RC1-Linux-x86-64]#
[root@oplocal DevKit-All-24.0.RC1-Linux-x86-64]# cat /etc/yum.repos.d/openeuler.repo
[openEuler]
name=openEuler
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/everything/x86_64/
enabled=1
gpgcheck=0
注:自行配置yum源,默认没有
[root@oplocal DevKit-All-24.0.RC1-Linux-x86-64]#
[root@oplocal DevKit-All-24.0.RC1-Linux-x86-64]# ./install.sh(参考社区文档安装)
在oplocal下载nginx的rpm包:
[root@oplocal ~]# mkdir /pkg_download
[root@oplocal ~]# yum -y install --downloadonly --destdir=/pkg_download nginx
[root@oplocal ~]# ls /pkg_download/
gd-2.2.5-6.oe1.x86_64.rpm
gperftools-libs-2.7-7.oe1.x86_64.rpm
libunwind-1.3.1-3.oe1.x86_64.rpm
libwebp-1.0.0-5.oe1.x86_64.rpm
nginx-1.16.1-2.oe1.x86_64.rpm
nginx-all-modules-1.16.1-2.oe1.noarch.rpm
nginx-filesystem-1.16.1-2.oe1.noarch.rpm
nginx-mod-http-image-filter-1.16.1-2.oe1.x86_64.rpm
nginx-mod-http-perl-1.16.1-2.oe1.x86_64.rpm
nginx-mod-http-xslt-filter-1.16.1-2.oe1.x86_64.rpm
nginx-mod-mail-1.16.1-2.oe1.x86_64.rpm
nginx-mod-stream-1.16.1-2.oe1.x86_64.rpm
[root@oplocal ~]#
[root@vm1 ~]# mkdir /oplocal_download
[root@vm1 ~]# scp -r 192.168.99.100:/pkg_download/* /oplocal_download
[root@vm1 ~]# ls /oplocal_download/
gd-2.2.5-6.oe1.x86_64.rpm
gperftools-libs-2.7-7.oe1.x86_64.rpm
libunwind-1.3.1-3.oe1.x86_64.rpm
libwebp-1.0.0-5.oe1.x86_64.rpm
nginx-1.16.1-2.oe1.x86_64.rpm
nginx-all-modules-1.16.1-2.oe1.noarch.rpm
nginx-filesystem-1.16.1-2.oe1.noarch.rpm
nginx-mod-http-image-filter-1.16.1-2.oe1.x86_64.rpm
nginx-mod-http-perl-1.16.1-2.oe1.x86_64.rpm
nginx-mod-http-xslt-filter-1.16.1-2.oe1.x86_64.rpm
nginx-mod-mail-1.16.1-2.oe1.x86_64.rpm
nginx-mod-stream-1.16.1-2.oe1.x86_64.rpm
[root@vm1 ~]#
自行上传nginx的rpm包,查看迁移报告
在oplocal上源码安装nginx:
下载源码包:
[root@oplocal ~]# wget https://nginx.org/download/nginx-1.26.0.tar.gz
[root@oplocal ~]# ls nginx-1.26.0.tar.gz
nginx-1.26.0.tar.gz
[root@oplocal ~]# tar -xf nginx-1.26.0.tar.gz -C /usr/src/ 解压
[root@oplocal ~]# ls /usr/src/nginx-1.26.0/
auto CHANGES.ru configure html man src
CHANGES conf contrib LICENSE README
[root@oplocal ~]#
[root@oplocal ~]# cd /usr/src/nginx-1.26.0/
配置:
[root@oplocal nginx-1.26.0]# useradd -s /sbin/nologin nginx
[root@oplocal nginx-1.26.0]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx
输出略
[root@oplocal nginx-1.26.0]# ls /usr/src/nginx-1.26.0/objs/
autoconf.err ngx_auto_config.h ngx_modules.c
Makefile ngx_auto_headers.h src
[root@oplocal nginx-1.26.0]#
编译:(注:gcc 、gcc-c++、make等包在安装devkit时已经安装了)
[root@oplocal nginx-1.26.0]# make 输出略
[root@oplocal nginx-1.26.0]# ls /usr/src/nginx-1.26.0/objs/
autoconf.err nginx ngx_auto_config.h ngx_modules.c src
Makefile nginx.8 ngx_auto_headers.h ngx_modules.o
[root@oplocal nginx-1.26.0]# /usr/src/nginx-1.26.0/objs/nginx -V(已编译出二进制文件)
nginx version: nginx/1.26.0
built by gcc 7.3.0 (GCC)
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx
[root@oplocal nginx-1.26.0]#
安装:
[root@oplocal nginx-1.26.0]# ls /usr/local/nginx
ls: cannot access '/usr/local/nginx': No such file or directory
[root@oplocal nginx-1.26.0]#
[root@oplocal nginx-1.26.0]# make install 输出略
[root@oplocal nginx-1.26.0]# ls /usr/local/nginx/
conf html logs sbin
[root@oplocal nginx-1.26.0]# ls /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx
[root@oplocal nginx-1.26.0]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.26.0
built by gcc 7.3.0 (GCC)
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx
[root@oplocal nginx-1.26.0]#
注:不想使用绝对路径,可使用软连接或配置环境变量
在arm平台源码安装nginx:
[root@openeuler40 ~]# mkdir /pkg_download
[root@openeuler40 ~]# cd /pkg_download
[root@openeuler40 pkg_download]# wget https://nginx.org/download/nginx-1.26.0.tar.gz
[root@openeuler40 pkg_download]# tar -xf nginx-1.26.0.tar.gz -C /usr/src/
[root@openeuler40 pkg_download]# cd /usr/src/nginx-1.26.0/
[root@openeuler40 nginx-1.26.0]#
[root@openeuler40 nginx-1.26.0]# useradd -s /sbin/nologin nginx
[root@openeuler40 nginx-1.26.0]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx
[root@openeuler40 nginx-1.26.0]# make && make install
[root@openeuler40 nginx-1.26.0]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.26.0
built by gcc 7.3.0 (GCC)
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx
[root@openeuler40 nginx-1.26.0]#
清理环境:源码安装的软件可以直接删除安装目录卸载
[root@openeuler40 ~]# rm -rf /usr/local/nginx/
[root@openeuler40 ~]# rm -rf /usr/src/nginx-1.26.0/
[root@openeuler40 ~]# userdel -r nginx
Cmake迁移评估:
下载x86的软件包,在x86平台测试:
[root@oplocal pkg_download]# ls cmake-3.19.8-Linux-x86_64.tar.gz
cmake-3.19.8-Linux-x86_64.tar.gz
[root@oplocal pkg_download]# 自行下载上传到指定目录
[root@oplocal pkg_download]# mkdir /cmake
[root@oplocal pkg_download]# tar -xf cmake-3.19.8-Linux-x86_64.tar.gz -C /cmake/
[root@oplocal pkg_download]# ls /cmake/
cmake-3.19.8-Linux-x86_64
[root@oplocal pkg_download]# ls /cmake/cmake-3.19.8-Linux-x86_64/
bin doc man share
[root@oplocal pkg_download]# ls /cmake/cmake-3.19.8-Linux-x86_64/bin/
ccmake cmake cmake-gui cpack ctest
[root@oplocal pkg_download]#
[root@oplocal pkg_download]# /cmake/cmake-3.19.8-Linux-x86_64/bin/cmake --help
输出略,能正常输出帮助信息
[root@oplocal pkg_download]# rm -rf /cmake/ 清理环境
在arm平台测试:
[root@openeuler40 ~]# ls /pkg_download/cmake-3.19.8-Linux-x86_64.tar.gz
/pkg_download/cmake-3.19.8-Linux-x86_64.tar.gz
[root@openeuler40 ~]#
[root@openeuler40 ~]# mkdir /cmake
[root@openeuler40 ~]# tar -xf /pkg_download/cmake-3.19.8-Linux-x86_64.tar.gz -C /cmake
[root@openeuler40 ~]# /cmake/cmake-3.19.8-Linux-x86_64/bin/cmake --help
-bash: /cmake/cmake-3.19.8-Linux-x86_64/bin/cmake: cannot execute binary file: Exec format error
[root@openeuler40 ~]#无法执行,此时是arm架构
[root@openeuler40 ~]# uname -r
4.19.90-2003.4.0.0036.oe1.aarch64
[root@openeuler40 ~]#
在arm平台和x86平台的devkit都可执行迁移评估:
评估迁移到arm的CentOS7.6:有可以替换的包下载
[root@centos7 ~]# mkdir /cmake
[root@centos7 ~]# cd /cmake
[root@centos7 cmake]# wget https://archive.kernel.org/centos-vault/altarch/7.6.1810/os/aarch64/Packages/cmake-2.8.12.2-2.el7.aarch64.rpm
[root@centos7 cmake]# wget https://archive.kernel.org/centos-vault/altarch/7.6.1810/os/aarch64/Packages/cmake-gui-2.8.12.2-2.el7.aarch64.rpm
[root@centos7 cmake]# ls
cmake-2.8.12.2-2.el7.aarch64.rpm cmake-gui-2.8.12.2-2.el7.aarch64.rpm
[root@centos7 cmake]#
注:rpm包可以直接安装,也可以提取出其中的二进制文件进行替换
[root@centos7 cmake]# rpm2cpio cmake-2.8.12.2-2.el7.aarch64.rpm | cpio -div 输出略
[root@centos7 cmake]# rpm2cpio cmake-gui-2.8.12.2-2.el7.aarch64.rpm | cpio -div 输出略
[root@centos7 cmake]# ls usr/bin/
ccmake cmake cmake-gui cpack ctest
[root@centos7 cmake]# ./usr/bin/cmake --help
./usr/bin/cmake: error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such file or directory
[root@centos7 cmake]# 此时缺少共享库
使用ldd命令查询所需的共享库:
[root@centos7 cmake]# ldd ./usr/bin/cmake 输出略
[root@centos7 cmake]# ldd ./usr/bin/cmake | grep 'not found'
libarchive.so.13 => not found
[root@centos7 cmake]#
查看什么软件包提供了对应的文件:
[root@centos7 cmake]# yum provides "*/libarchive.so.13"
[root@centos7 cmake]# yum -y install libarchive-3.1.2-14.el7_7.aarch64
[root@centos7 cmake]# ls /usr/lib64/libarchive.so.13
/usr/lib64/libarchive.so.13
[root@centos7 cmake]# ll /usr/lib64/libarchive.so.13
lrwxrwxrwx. 1 root root 20 May 15 09:18 /usr/lib64/libarchive.so.13 -> libarchive.so.13.1.2
[root@centos7 cmake]# ./usr/bin/cmake –help
[root@centos7 cmake]# uname -r
4.18.0-193.28.1.el7.aarch64
[root@centos7 cmake]#
尝试迁移cmake到arm的openeuler20.03:
此时SP3有可以替换的包,但是20.03没有:
方法一:
[root@openeuler40 ~]# cd /cmake/
[root@openeuler40 cmake]# wget https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8-Linux-aarch64.tar.gz
[root@openeuler40 cmake]# ls
cmake-3.19.8-Linux-aarch64.tar.gz cmake-3.19.8-Linux-x86_64
[root@openeuler40 cmake]# tar -xf cmake-3.19.8-Linux-aarch64.tar.gz
[root@openeuler40 cmake]#
[root@openeuler40 cmake]# ls cmake-3.19.8-Linux-aarch64/bin/cmake
[root@openeuler40 cmake]# cmake-3.19.8-Linux-aarch64/bin/cmake --help 可以使用
方法二:
下载cmake的源码包,在arm的openeuler 20.03上完成编译,并验证(+5/-0)
[root@openeuler40 ~]# cd /cmake/
[root@openeuler40 cmake]# wget https://github.com/Kitware/CMake/archive/refs/tags/v3.19.8.tar.gz
[root@openeuler40 cmake]# tar -xf v3.19.8.tar.gz
[root@openeuler40 cmake]# cd CMake-3.19.8/
[root@openeuler40 CMake-3.19.8]# ls 输出略
[root@openeuler40 CMake-3.19.8]# yum -y install openssl-devel
[root@openeuler40 CMake-3.19.8]# ./bootstrap --prefix=/cmake/cmakeinstall
[root@openeuler40 CMake-3.19.8]# make && make install
[root@openeuler40 CMake-3.19.8]# ls /cmake/cmakeinstall/bin/
cmake cpack ctest
[root@openeuler40 CMake-3.19.8]# /cmake/cmakeinstall/bin/cmake --help 可以使用
[root@openeuler40 CMake-3.19.8]# cd
[root@openeuler40 ~]# rm -rf /cmake/
[root@openeuler40 ~]#
源码迁移:
迁移smartdenovo到arm的openeuler 20.03:
[root@vm1 ~]# ls smartdenovo-master.zip 自行获取文件
smartdenovo-master.zip
[root@vm1 ~]#
按要求修改源代码即可(参考社区文档),修改后上传到arm平台主机:
[root@openeuler40 ~]# ls /pkg_download/smartdenovo-master.zip /pkg_download/BoostKit-ksl_2.2.0.zip
/pkg_download/BoostKit-ksl_2.2.0.zip
/pkg_download/smartdenovo-master.zip
[root@openeuler40 ~]#
[root@openeuler40 ~]# cd /pkg_download/
[root@openeuler40 pkg_download]# mkdir boostkit
[root@openeuler40 pkg_download]# unzip BoostKit-ksl_2.2.0.zip -d boostkit
Archive: BoostKit-ksl_2.2.0.zip
inflating: boostkit/boostkit-ksl-2.2.0-1.aarch64.rpm
inflating: boostkit/Kunpeng BoostKit User License Agreement 2.0.txt
inflating: boostkit/鲲鹏应用使能套件BoostKit用户许可协议 2.0.txt
[root@openeuler40 pkg_download]#
[root@openeuler40 boostkit]# rpm -ivh boostkit-ksl-2.2.0-1.aarch64.rpm
[root@openeuler40 boostkit]# env | grep LD_LIBRARY_PATH
[root@openeuler40 boostkit]# LD_LIBRARY_PATH=/usr/local/ksl/lib:
[root@openeuler40 boostkit]# env | grep LD_LIBRARY_PATH
[root@openeuler40 boostkit]# set | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/local/ksl/lib:
[root@openeuler40 boostkit]# export LD_LIBRARY_PATH
[root@openeuler40 boostkit]# env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/local/ksl/lib:
[root@openeuler40 boostkit]#
[root@openeuler40 pkg_download]# mkdir smart
[root@openeuler40 pkg_download]# unzip smartdenovo-master.zip -d smart
[root@openeuler40 pkg_download]# cd smart/smartdenovo-master/
[root@openeuler40 smartdenovo-master]#
[root@openeuler40 smartdenovo-master]# vim Makefile 查看文件是否修改 (参考社区修改)
https://www.hikunpeng.com/document/detail/zh/kunpengdevps/handon_tutorials/bestpractice/smartdenovopt_21_0012.html
[root@openeuler40 smartdenovo-master]# vim ksw.c 查看文件是否修改
[root@openeuler40 smartdenovo-master]# make clean
rm -f *.o *.gcda *.gcno *.gcov gmon.out pairaln wtpre wtcyc wtmer wtzmo wtobt wtclp wtext wtlay wtcns wtmsa wtdif wtcorr wtjnt wtgbo
[root@openeuler40 smartdenovo-master]#
[root@openeuler40 smartdenovo-master]# vim wtlay.h
[root@openeuler40 smartdenovo-master]# make install
cp pairaln wtpre wtcyc wtmer wtzmo wtobt wtclp wtext wtgbo wtlay wtcns wtmsa /usr/local/bin
[root@openeuler40 smartdenovo-master]#
[root@openeuler40 smartdenovo-master]# ls /usr/local/bin/
pairaln wtclp wtcns wtcyc wtext wtgbo wtlay wtmer wtmsa wtobt wtpre wtzmo
[root@openeuler40 smartdenovo-master]#
软件包重构:
[root@vm1 ~]# mkdir /vm1_download
[root@vm1 ~]# cd /vm1_download
[root@vm1 vm1_download]# wget https://ci.bigtop.apache.org/view/Releases/job/Bigtop-3.0.0/DISTRO=centos-7,PLATFORM=amd64-slave/lastSuccessfulBuild/artifact/output/kafka/noarch/kafka-2.4.1-1.el7.noarch.rpm
[root@vm1 vm1_download]# ls
kafka-2.4.1-1.el7.noarch.rpm
[root@vm1 vm1_download]#
[root@vm1 vm1_download]# wget https://mirror.iscas.ac.cn/kunpeng/maven/org/rocksdb/rocksdbjni/5.18.3/rocksdbjni-5.18.3.jar
[root@vm1 vm1_download]# ls
kafka-2.4.1-1.el7.noarch.rpm rocksdbjni-5.18.3.jar
[root@vm1 vm1_download]#
[root@openeuler40 ~]# yum -y install rpmrebuild rpm-build 装包,用于打包
重构完成后可以下载重构包安装测试:
[root@vm1 Downloads]# scp kafka-2.4.1-1.el7.aarch64.rpm root@10.2.35.40:/pkg_download
[root@openeuler40 ~]# ls /pkg_download/kafka-2.4.1-1.el7.aarch64.rpm
/pkg_download/kafka-2.4.1-1.el7.aarch64.rpm
[root@openeuler40 ~]#
[root@openeuler40 ~]# rpm -ivh /pkg_download/kafka-2.4.1-1.el7.aarch64.rpm
error: Failed dependencies:
bigtop-utils >= 0.7 is needed by kafka-2.4.1-1.el7.aarch64
zookeeper is needed by kafka-2.4.1-1.el7.aarch64
[root@openeuler40 ~]# 缺少两个依赖
[root@openeuler40 ~]# cd /pkg_download/
[root@openeuler40 pkg_download]# wget https://mirrors.aliyun.com/openeuler/openEuler-20.03-LTS-SP4/everything/aarch64/Packages/zookeeper-3.6.1-2.6.oe2003sp4.noarch.rpm
[root@openeuler40 pkg_download]# wget https://ci.bigtop.apache.org/view/Releases/job/Bigtop-3.2.1-aarch64/DISTRO=centos-7,PLATFORM=aarch64-slave,PRODUCT=bigtop-utils/lastSuccessfulBuild/artifact/output/bigtop-utils/noarch/bigtop-utils-3.2.1-1.el7.noarch.rpm
[root@openeuler40 pkg_download]# rpm -ivh /pkg_download/zookeeper-3.6.1-2.6.oe2003sp4.noarch.rpm /pkg_download/bigtop-utils-3.2.1-1.el7.noarch.rpm /pkg_download/kafka-2.4.1-1.el7.aarch64.rpm
warning: /pkg_download/zookeeper-3.6.1-2.6.oe2003sp4.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID fb37bc6f: NOKEY
error: Failed dependencies:
java-1.8.0-openjdk is needed by zookeeper-3.6.1-2.6.oe2003sp4.noarch
[root@openeuler40 pkg_download]#
[root@openeuler40 pkg_download]# yum list | grep java | grep 1.8.0
[root@openeuler40 pkg_download]# yum -y install java-1.8.0-openjdk.aarch64
[root@openeuler40 pkg_download]# rpm -ivh /pkg_download/zookeeper-3.6.1-2.6.oe2003sp4.noarch.rpm /pkg_download/bigtop-utils-3.2.1-1.el7.noarch.rpm /pkg_download/kafka-2.4.1-1.el7.aarch64.rpm
[root@openeuler40 bin]# cd /opt/zookeeper/bin/
[root@openeuler40 bin]# ./zkServer.sh start 启动zookeeper
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@openeuler40 bin]#
[root@openeuler40 bin]# ls /opt/zookeeper/lib/zookeeper-*
/opt/zookeeper/lib/zookeeper-3.6.1.jar
/opt/zookeeper/lib/zookeeper-jute-3.6.1.jar
/opt/zookeeper/lib/zookeeper-prometheus-metrics-3.6.1.jar
[root@openeuler40 bin]#
[root@openeuler40 bin]# cp /opt/zookeeper/lib/zookeeper-3.6.1.jar /opt/zookeeper/lib/zookeeper-jute-3.6.1.jar /usr/lib/kafka/libs/
[root@openeuler40 bin]# cd /usr/lib/kafka/bin
[root@openeuler40 bin]# ./kafka-server-start.sh ../config/server.properties
注:此窗口被占用,下面命令另开一个终端
功能验证:
[root@openeuler40 ~]# cd /usr/lib/kafka/bin
[root@openeuler40 bin]# kafka-topics.sh --zookeeper localhost:2181 --create --topic sandbox-experiment -partitions 2 --replication-factor 1
Created topic sandbox-experiment.
[root@openeuler40 bin]#创建主题
启动消费者服务:
[root@openeuler40 bin]# kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic sandbox-experiment
注:此终端被占用,下面命令另开一个终端
启动生产者服务:
[root@openeuler40 ~]# cd /usr/lib/kafka/bin
[root@openeuler40 bin]# kafka-console-producer.sh --broker-list localhost:9092 --topic sandbox-experiment
>
>hello 发送消息
消费者服务可以接收到消息:
[root@openeuler40 bin]# kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic sandbox-experiment
hello
自行关闭所有启动的服务:
Kafka的服务可以使用kill或ctrl+c结束
[root@openeuler40 bin]# cd /opt/zookeeper/bin/
[root@openeuler40 bin]# ./zkServer.sh stop
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@openeuler40 bin]#
源码迁移megahit:
[root@openeuler40 sourcecode]# ls /megahit-master.zip
/megahit-master.zip
[root@openeuler40 sourcecode]#
[root@openeuler40 sourcecode]# pwd
/opt/DevKit/workspace/devadmin/porting/sourcecode
[root@openeuler40 sourcecode]#
[root@openeuler40 sourcecode]# unzip /megahit-master.zip -d .
[root@openeuler40 sourcecode]# mv megahit-master/ megahit
[root@openeuler40 sourcecode]# yum -y install git cmake
[root@openeuler40 sourcecode]# cd megahit/
[root@openeuler40 megahit]# git init
Initialized empty Git repository in /opt/DevKit/workspace/devadmin/porting/sourcecode/megahit/.git/
[root@openeuler40 megahit]# git submodule update --init
[root@openeuler40 megahit]#
[root@openeuler40 megahit]# mkdir build && cd build
[root@openeuler40 build]# cmake .. -DCMAKE_BUILD_TYPE=Release
[root@openeuler40 build]# ls
CMakeCache.txt CMakeFiles cmake_install.cmake Makefile
[root@openeuler40 build]#
[root@openeuler40 build]# cp /opt/DevKit/devkitplugins/inline_asm/config/KunpengTrans.h /opt/DevKit/workspace/devadmin/porting/sourcecode/megahit/src/utils
[root@openeuler40 build]# (以上文件应该在迁移源码修改后复制,此处提前复制了)
[root@openeuler40 build]# chown -R devkit:devkit ../../megahit/
按要求修改源码,删除选项或应用自动修复:略
Kmrms.h中return语句修改如下:
修改后:
[root@openeuler40 build]# make 编译(有警告,但能正常编译完成)
[root@openeuler40 build]# make simple_test (正常运行无报错)
注:
如果编译时报错,有文档修改错误,可以重新修改文件,然后make clean清理编译环境再重新make
清理环境:
[root@openeuler40 sourcecode]# rm -rf megahit/
[root@openeuler40 sourcecode]# rm -rf /megahit-master.zip
Nginx专项软件迁移:
注:此时无法执行迁移,因为本机是openeuler 20.03的,只能在CentOS7.6或openeuler 20.03-SP1的arm架构主机上执行操作
实现使用Python进行字符串拼接性能增强:
[root@openeuler40 testpython]# time python test.py string_plus
['test.py', 'string_plus']
1100000000
real 0m8.678s
user 0m8.471s
sys 0m0.184s
[root@openeuler40 testpython]#
[root@openeuler40 testpython]# cat test.py
import sys
BASE_STRING = "Hello world"
LOOP_TIMES = 100000000
STRING_LIST = [BASE_STRING] * LOOP_TIMES
def string_plus():
new_string = ''
for string in STRING_LIST:
new_string += string
print(len(new_string))
def string_join():
new_string = ''.join(STRING_LIST)
print(len(new_string))
def main():
function_map = {
'string_plus': string_plus,
'string_join': string_join,
}
print(sys.argv)
_, function = sys.argv
if function in function_map:
function_map[function]()
else:
print('function {} not exist'.format(function))
if __name__ == "__main__":
main()
[root@openeuler40 testpython]#
[root@openeuler40 testpython]# time /opt/test.py string_plus
['/opt/test.py', 'string_plus']
1100000000
real 0m9.504s
user 0m8.486s
sys 0m0.218s
[root@openeuler40 testpython]#
[root@openeuler40 testpython]# time /opt/test.py string_join
['/opt/test.py', 'string_join']
1100000000
real 0m4.767s
user 0m4.583s
sys 0m0.176s
[root@openeuler40 testpython]#