○構築方法
以下のVagrantfileを使用して、Apache Ignite2.7.0をインストールした仮想マシン(Debian Stretch/9.6)を構築する事が出来ます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.6"
config.vm.hostname = "db96ignite270"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db96ignite270"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.106", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.106", :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 OpenJDK11
cat <<EOF | sudo tee /etc/apt/sources.list.d/stretch-backports.list
deb http://http.debian.net/debian stretch-backports main contrib non-free
EOF
apt-get update
apt-get -y install openjdk-11-jdk
apt-get -y install unzip
wget https://www-eu.apache.org/dist//ignite/2.7.0/apache-ignite-2.7.0-bin.zip
unzip apache-ignite-2.7.0-bin.zip
mv apache-ignite-2.7.0-bin /opt/ignite
sed -i -e 's#JVM_OPTS="-Xms1g -Xmx1g -server -XX:MaxMetaspaceSize=256m"#JVM_OPTS="-Xms1g -Xmx1g -server -XX:MaxMetaspaceSize=256m --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED"#' /opt/ignite/bin/ignite.sh
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
# wait unitl 11211 port is opened.
while netstat -lnt | awk '$4 ~ /:11211$/ {exit 1}'; do sleep 10; done
sleep 10
# execute a sample 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 --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED -cp .:/opt/ignite/libs/ignite-core-2.7.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 件のコメント:
コメントを投稿