〇構築方法
以下のVagrantfileを使用して、sysbenchとMariaDBがインストールされた仮想マシン(CentOS 8.1)を構築します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-8.1"
config.vm.hostname = "co81sysbenchmariadb"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co81sysbenchmariadb"
vbox.gui = true
vbox.cpus = 2
vbox.memory = 4096
end
config.vm.network "private_network", ip: "192.168.55.101", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
dnf -y install langpacks-ja
localectl set-locale LANG=ja_JP.UTF-8
dnf install -y epel-release
dnf check-update
dnf -y update
timedatectl set-timezone Asia/Tokyo
# install mariadb
dnf -y install mariadb mariadb-server
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
mysql -uroot -e "SET PASSWORD = PASSWORD('root'); FLUSH PRIVILEGES;"
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.
dnf --enablerepo=epel -y install sysbench
sysbench cpu run --threads=2
sysbench memory run --threads=2
sysbench fileio run --file-test-mode=seqwr --threads=2
sysbench fileio run --file-test-mode=rndwr --threads=2
sysbench /usr/share/sysbench/oltp_read_write.lua prepare --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=sysbench --mysql-password=sysbench --mysql-db=sysbench
sysbench /usr/share/sysbench/oltp_read_write.lua run --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=sysbench --mysql-password=sysbench --mysql-db=sysbench --threads=2
SHELL
end
0 件のコメント:
コメントを投稿