2018年3月19日月曜日

Vagrantでmonetdbをインストールした仮想マシン(Debian Stretch/9.3)を構築する

MonetDBはオープンソースのカラム指向のデータベースです。

仮想マシンの構築方法

以下のVagrantfileを使用して、monetdbがインストールされた仮想マシン(Debian Stretch/9.3)を構築する事ができます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/debian-9.3"
  config.vm.hostname = "db93monetdb"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "db93monetdb"
     vbox.cpus = 2
     vbox.memory = 2048
     vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
  end
config.vm.network "private_network", ip: "192.168.55.101", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.101", :netmask => "255.255.255.0"
  config.vm.provision "shell", inline: <<-SHELL
apt-get -y install task-japanese
sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
update-locale LANG=ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
localectl set-keymap jp106
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

# install monetdb
apt-get -y install apt-transport-https
cat << EOF >> /etc/apt/sources.list.d/monetdb.list
deb https://dev.monetdb.org/downloads/deb/ stretch monetdb
deb-src https://dev.monetdb.org/downloads/deb/ stretch monetdb
EOF
wget --output-document=- https://www.monetdb.org/downloads/MonetDB-GPG-KEY | apt-key add -
apt-get update
apt-get -y install monetdb5-sql monetdb-client

chown monetdb:monetdb /var/lib/monetdb

#cp  /opt/monetdb/lib/systemd/system/monetdbd.service /etc/systemd/system
systemctl enable monetdbd
systemctl start monetdbd

/usr/bin/monetdb create testdb
/usr/bin/monetdb start testdb
/usr/bin/monetdb release testdb
cat << EOF > /home/vagrant/.monetdb
user=monetdb
password=monetdb
language=sql
save_history=true
EOF
sudo -u vagrant /usr/bin/mclient -d testdb -s 'create table test1 (message_id integer, message varchar(100))'
sudo -u vagrant /usr/bin/mclient -d testdb -s "insert into test1 values (100, 'hello world\\!')"
sudo -u vagrant /usr/bin/mclient -d testdb -s "select * from test1"

SHELL
end

関連情報

・monetdbに関する他の記事はこちらを参照してください。

・プロジェクトgithubリポジトリ
https://github.com/MonetDB/MonetDB

0 件のコメント:

コメントを投稿