timelog=`date +%Y-%m-%d-%H:%M` logname="run_sb"_$timelog.log while true; do cur_time=`date +%Y-%m-%d-%H:%M:%S` echo "$cur_time --------------start new test-------------" >> ./log/$logname port=`/home/hzwenzhh/innosqltest1/mysql/bin/mysql -uroot -S /home/hzwenzhh/innosqltest1/node3/mysql.sock -Bse "select MEMBER_PORT from performance_schema.replication_group_members where MEMBER_ID = (select VARIABLE_VALUE from performance_schema.global_status where VARIABLE_NAME = 'group_replication_primary_member')"` cur_time=`date +%Y-%m-%d-%H:%M:%S` echo "$cur_time the primary port is $port" >> ./log/$logname ./sysbench/bin/sysbench --mysql-host=127.0.0.1 --mysql-port=$port --mysql-user=rpl_user --mysql-password=rpl_pass --test=./sysbench/db/oltp.lua --oltp_tables_count=10 --oltp-table-size=10000000 --rand-init=on --num-threads=128 --report-interval=2 --max-requests=0 --max-time=0 run >> ./log/$logname cur_time=`date +%Y-%m-%d-%H:%M:%S` echo "$cur_time sleep 10s to wait new primary" >> ./log/$logname sleep 10 done