〇構築方法
以下のVagrantfileを使用して、sysbenchとMariaDBがインストールされた仮想マシン(Debian Stretch/9.5)を構築します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.5"
config.vm.hostname = "db95sysbenchmariadb"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db95sysbenchmariadb"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.107", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.11.107", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
locale-gen ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
timedatectl set-timezone Asia/Tokyo
# install mariadb
echo "mariadb-server-10.1 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mariadb-server-10.1 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mariadb-server
mysql -uroot -proot -e "CREATE DATABASE sysbench DEFAULT CHARACTER SET utf8mb4;"
mysql -uroot -proot -e "CREATE USER sysbench@localhost IDENTIFIED BY 'sysbench';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON sysbench.* TO 'sysbench'@'localhost';"
mysql -uroot -proot -e "FLUSH PRIVILEGES;"
# install and execute sysbench.
apt-get -y install sysbench
sysbench --test=cpu run --num-threads=2
sysbench --test=memory run --num-threads=2
sysbench --test=fileio run --file-test-mode=seqwr --num-threads=2
sysbench --test=fileio run --file-test-mode=rndwr --num-threads=2
sysbench --test=oltp prepare --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=sysbench --mysql-password=sysbench --mysql-db=sysbench
sysbench --test=oltp run --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=sysbench --mysql-password=sysbench --mysql-db=sysbench --num-threads=2
SHELL
end
○関連情報
・sysbenchに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿