# KpExp **Repository Path**: yaozc701/KpExp ## Basic Information - **Project Name**: KpExp - **Description**: KunpengExperiment - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-04 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README * 资源 ** 安装 git (可选) 部分 OS 未安装 git,可使用相应的包管理器安装(如 CentOS): yum install -y git ** 下载本仓库 git clone https://gitee.com/oceanman/KpExp.git ** 工具下载 1. SSH 客户端: [[https://hcia-kp-v1.0.obs.cn-south-1.myhuaweicloud.com/putty.exe][putty]]、[[https://gitee.com/oceanman/gitbash][git bash]] 2. windows->Linux 传输文件:[[https://hcia-kp-v1.0.obs.cn-south-1.myhuaweicloud.com/WinSCP.zip][winscp]] * 实验 ** 源码迁移 *** 流程 #+BEGIN_SRC plantuml :file ./img/KpExp01.jpg :cmdline -charset utf-8 title 源码迁移实验 start :创建 VPC; :创建安全组; :配置安全组; :购买 ECS; :配置网络; :连接 SSH; :下载软件包; :安装 PA 工具; :导入源代码文件; :访问页面,下载报告; :根据移植建议修改代码; :重新检查; stop #+END_SRC #+RESULTS: [[file:./img/KpExp01.jpg]] *** Tips 1. 安装过程中 IP,Port 默认 2. 访问页面使用 https 3. 安全组放通 8084 端口 ** 容器迁移 *** 流程 #+BEGIN_SRC plantuml :file ./img/KpExp02.jpg :cmdline -charset utf-8 title 容器迁移实验 start :购买鲲鹏 ECS; :安装 Docker; :拉取镜像; :提交镜像; :根据 Dockerfile 构建镜像; :运行容器; :验证; stop #+END_SRC #+RESULTS: [[file:./img/KpExp02.jpg]] *** Dockerfile #+BEGIN_SRC # Dockerfile FROM arm64v8/centos WORKDIR /home RUN wget http://download.redis.io/releases/redis-5.0.5.tar.gz && \ tar -xvzf redis-5.0.5.tar.gz && \ mv redis-5.0.5/ redis && \ rm -f redis-5.0.5.tar.gz WORKDIR /home/redis RUN make && make install EXPOSE 6379 CMD ["redis-server"] #+END_SRC ** 开发环境搭建(交叉编译) *** 搭建 #+BEGIN_SRC bash git clone https://gitee.com/oceanman/KpExp.git tar -Jxvf gcc-linaro yum -y groupinstall Development Tools mkdir /usr/local/ARM-toolchain mv gcc-linaro /user/local/ARM-toolchain/ echo "export PATH=$PATH:/user/local/ARM-toolchain/linaro/bin/" >> /etc/profile source /etc/profile aarch64-linux-gnu-gcc -v vim hello.c arrch64-linux-gnu-gcc -o kp-hello hello.c #+END_SRC *** 源代码 #+BEGIN_SRC c //filename:hello.c #include int main(void) { printf("hello linux\n"); return 0; } #+END_SRC ** 构建 rpm 包 *** 构建过程 #+BEGIN_SRC yum insatll -y rpm-build rpmbuild -ba test mv redis- rpmbuild/SOURCES/ mv redis.spec rpmbuild/SPECS/ cd rpmbuild/SPECS rpmbuild -bb redis.spec ll $HOME/rpmbuild/RPMS/aarch64 cd $_ rpm -ivh redis-4 redis-cli -v #+END_SRC ** 移植 PostgreSQL *** 升级编译器 先在高配机器中编译完成,打包镜像,使用 IMS 在同一 Region 中传递共享镜像 *** 安装 PostgreSQL #+BEGIN_SRC bash git clone https://gitee.com/oceanman/KpExp.git cd KpExp/ mkdir /home/pgsql-11.3 ./configure -prefix=/home/pgsql-11.3 make -j $(proc) make install #+END_SRC *** 配置并启动 PostgreSQL **** 初始化 #+BEGIN_SRC bash /usr/sbin/groupadd -g 1001 postgres /usr/sbin/useradd -u 1012 -m -g postgres postgres passwd postgres su - postgres /home/pgsql-11.3/bin/initdb -D pgsql-11.3/ /home/pgsql-11.3/bin/pg_ctl -D pgsql-11.3/ -l logfile start ps -ef | grep postgres /home/psql-11.3/bin/psql -U postgres #+END_SRC **** 配置(进入 PostgreSQL) #+BEGIN_SRC sql ALTER USER postgres WITH PASSWORD 'password' \q #+END_SRC **** TODO 修改配置 #+BEGIN_SRC bash # 用户为 postgres cd /home/postgres/pgsql-11.3 vi pg_hba.conf ############## pg_hba.conf ############## # ‘local’ is for ... 行修改为: local all all md5 # IPv4 local connections 行增加: host all all 0.0.0.0/0 md5 ######################################### vi postgresql.conf ############ postgresql.conf ############ listen_adresses = '*' port = 5432 ######################################### cd /home/pgsql-11.3/bin/pg_ctl -D pgsql-11.3/ stop /home/pgsql-11.3/bin/pg_ctl -D pgsql-11.3/ start # 登录数据库 su - postgres /home/pgsql-11.3/bin/psql -U postgres #+END_SRC **** 创建数据库 #+BEGIN_SRC sql \l create database tpcc; \l #+END_SRC ** BenchmarkSQL 测试 **** 安装 Java #+BEGIN_SRC bash git clone https://gitee.com/oceanman/KpExp.git yum install -y java-1.8.0-openjdk vi /etc/profile ############## profile ############## JAVA_HOME=/usr/local/java/jdk1.8.0_181 JRE_HOME=/usr/local/java/jdk1.8.0_181/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH ##################################### source /etc/profile java -version #+END_SRC **** TODO 使用 BenchmarkSQL #+BEGIN_SRC bash cd KpExp/ chmod -R u+x BenchmarkSQL cd BenchmarkSQL/run cp props.pg arm_postgres.properties vim arm_postgres.properties ########## arm_postgres.properties ########## conn=jdbc:postgresql://192.168.--.--:5432/tpcc user=postgres password=-------- warehouses=10 loadWorkers=100 runTxnsPerTerminal=100 ############################################# #+END_SRC