Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604comdb2"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604comdb2"
vbox.cpus = 4
vbox.memory = 8192
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
# private network
config.vm.network "private_network", ip: "192.168.55.114", :netmask => "255.255.255.0"
# bridge netwrok
config.vm.network "public_network", ip: "192.168.1.114", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get -y install unzip
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
# install comdb2
wget https://github.com/bloomberg/comdb2/archive/master.zip
unzip master.zip
apt-get -y install build-essential bison flex libprotobuf-c-dev libreadline-dev libsqlite3-dev libssl-dev libunwind-dev libz1 libz-dev make gawk protobuf-c-compiler uuid-dev liblz4-tool liblz4-dev libprotobuf-c1 libsqlite3-0 libuuid1 libz1 tzdata ncurses-dev tcl bc cmake
cd comdb2-master
make
make install
useradd comdb2
mkdir -p /opt/bb/data
chown -R comdb2:comdb2 /opt/bb
/opt/bb/bin/pmux -n
sudo -u comdb2 /opt/bb/bin/comdb2 --create --dir /opt/bb/data testdb
echo 'cluster nodes ub1604comdb2' >> /opt/bb/data/testdb.lrl
sudo -u comdb2 /opt/bb/bin/comdb2 --lrl /opt/bb/data/testdb.lrl testdb &
sleep 30
# サンプル実行
echo "create table test1 (message_id integer, message varchar(100));" | /opt/bb/bin/cdb2sql testdb -n ub1604comdb2 -
echo "insert into test1 values (100, 'hello world!');" | /opt/bb/bin/cdb2sql testdb -n ub1604comdb2 -
echo "insert into test1 values (200, 'test.');" | /opt/bb/bin/cdb2sql testdb -n ub1604comdb2 -
echo "select * from test1;" | /opt/bb/bin/cdb2sql testdb -n ub1604comdb2 -
SHELL
end
0 件のコメント:
コメントを投稿