适配环境 操作系统版本:Red Hat Enterprise Linux Server release 7.9 (Maipo) 数据库版本:MogDB 5.0.3
$ curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh
$ ptk template --local > config.yaml
$ ptk install -f config.yaml
su - omm
gsql -r
create user sysbench identified by 'PWbmsql0' profile default;
alter user sysbench sysadmin;
create database sysbench encoding 'UTF8'template=template0 owner sysbench;
yum -y install make automake libtool pkgconfig libaio-devel
yum -y install mariadb-devel openssl-devel
yum -y install postgresql-devel
如果yum存在问题 •例如报错
[root@mogdb-dev-011 sysbench-1.0]# yum
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
原因在于python版本,环境版本是3.8, 而yum要求的版本是2.x 因此需要更改yum的版本信息
vim /usr/bin/yum
将文件头 #!/usr/bin/python 修改为 #!/usr/bin/python2
同时还有/usr/libexec/urlgrabber-ext-down 也需要修改文件头
++由于使用不同的密码安全策略,我们无法使用默认的postgresql库对mogdb进行基准测试,所以需要下载特定的libpq++ sysbench手工下载: https://github.com/akopytov/sysbench
cd /home/omm
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/x86/openGauss-5.0.0-CentOS-64bit-Libpq.tar.gz --下载opengauss的libpq
cd /root
wget https://github.com/akopytov/sysbench/archive/refs/heads/master.zip --下载sysbench源码
cd /home/omm
tar -xf openGauss-5.0.0-CentOS-64bit-Libpq.tar.gz
cd /root
unzip master.zip
mv sysbench-master sysbench
cd sysbench
./autogen.sh
export LD_LIBRARY_PATH=/home/omm/lib:$LD_LIBRARY_PATH
指定opengauss的/home/omm/include和/home/omm/lib
./configure --prefix=/home/omm/sysbench --without-mysql \
--with-pgsql \
--with-pgsql-includes=/home/omm/include \
--with-pgsql-libs=/home/omm/lib
make -j
make install
2个表一千万条记录
./bin/sysbench oltp_read_only \
--db-driver=pgsql \
--pgsql-host=127.0.0.1 \
--pgsql-port=26000 \
--pgsql-user=sysbench \
--pgsql-password=PWbmsql0 \
--pgsql-db=sysbench \
--threads=8 \
--table_size=10000000 \
prepare
./bin/sysbench oltp_read_only \
--db-driver=pgsql \
--pgsql-host=127.0.0.1 \
--pgsql-port=26000 \
--pgsql-user=sysbench \
--pgsql-password=PWbmsql0 \
--pgsql-db=sysbench \
--threads=128 \
--time=30 \
--tables=2 \
--threads=10 \
--table_size=10000000 \
--report-interval=2 \
run
./bin/sysbench oltp_write_only \
--db-driver=pgsql \
--pgsql-host=127.0.0.1 \
--pgsql-port=26000 \
--pgsql-user=sysbench \
--pgsql-password=PWbmsql0 \
--pgsql-db=sysbench \
--threads=128 \
--time=30 \
--tables=2 \
--threads=10 \
--table_size=10000000 \
--report-interval=2 \
run
./bin/sysbench oltp_read_write \
--db-driver=pgsql \
--pgsql-host=127.0.0.1 \
--pgsql-port=26000 \
--pgsql-user=sysbench \
--pgsql-password=PWbmsql0 \
--pgsql-db=sysbench \
--threads=128 \
--time=30 \
--tables=2 \
--threads=10 \
--table_size=10000000 \
--report-interval=2 \
run
本文由 mdnice 多平台发布