以下のVagrantfileを使用して、Apache Ignite2.4.0をインストールした仮想マシン(CentOS7.4)を構築する事が出来ます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.4"
config.vm.hostname = "co74ignite240"
config.vm.network :public_network, ip:"192.168.1.117"
config.vm.network "private_network", ip: "192.168.55.117", :netmask => "255.255.255.0"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co74ignite240"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.provision "shell", inline: <<-SHELL
# install OpenJDK8
yum -y install java-1.8.0-openjdk
# install ignite
yum -y install unzip
wget https://dist.apache.org/repos/dist/release/ignite/2.4.0/apache-ignite-fabric-2.4.0-bin.zip
unzip apache-ignite-fabric-2.4.0-bin.zip
mv apache-ignite-fabric-2.4.0-bin /opt/ignite
cat << EOF > /etc/systemd/system/ignite.service
[Unit]
Description=Apache Ignite
[Service]
ExecStart=/opt/ignite/bin/ignite.sh
WorkingDirectory=/opt/ignite
KillMode=process
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
systemctl enable ignite.service
systemctl start ignite.service
# 11211ポートでlistenするまで待つ.
while netstat -lnt | awk '$4 ~ /:11211$/ {exit 1}'; do sleep 10; done
sleep 10
# サンプルSQLの実行
wget http://wiki.metawerx.net/attach/SJSQL/sjsql.java
wget http://wiki.metawerx.net/attach/SJSQL/sjsql.class
cat << EOF >> /home/vagrant/test.sql
create table test1 (test_id integer primary key, test_desc varchar(100));
insert into test1 (test_id, test_desc) values (1, 'test_id_001');
select * from test1;
EOF
java -cp .:/opt/ignite/libs/ignite-core-2.4.0.jar sjsql org.apache.ignite.IgniteJdbcThinDriver jdbc:ignite:thin://127.0.0.1/ test test /home/vagrant/test.sql
SHELL
end
○関連情報
・Apache Igniteに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿