Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.6"
config.vm.hostname = "db96clickhouse"
config.vm.network "public_network", ip:"192.168.1.103", :netmask => "255.255.255.0"
config.vm.network "private_network", ip: "192.168.55.103", :netmask => "255.255.255.0"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db96clickhouse"
vbox.gui = true
vbox.cpus = 2
vbox.memory = 2048
end
config.vm.provision "shell", inline: <<-SHELL
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get -y install task-japanese gawk
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
timedatectl set-timezone Asia/Tokyo
# install ClickHouse
apt-get -y install dirmngr
apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4
echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" >> /etc/apt/sources.list.d/clickhouse.list
apt-get update
apt-get -y install clickhouse-server clickhouse-client
systemctl start clickhouse-server
systemctl enable clickhouse-server
clickhouse-client --query="CREATE TABLE test (test_date Date, test_id UInt16, test_message String) ENGINE = MergeTree(test_date, (test_id), 8192);"
cat << EOF > /tmp/test.csv
2019-03-01,100,hello world!
2019-03-02,200,test data
EOF
cat /tmp/test.csv | clickhouse-client --query="INSERT INTO test FORMAT CSV"
clickhouse-client --query="SELECT * FROM test"
SHELL
end
〇関連情報
・ClickHouseに関する他の情報はこちらを参照してください。
0 件のコメント:
コメントを投稿