〇Apache Nifiの画面
〇構築方法
1.以下のVagrantfileを使用して、Apache Nifi 1.7.1とMariaDBがインストールされた仮想マシン(Ubuntu16.04)を構築します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604nifi171mariadb"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604nifi171mariadb"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.114", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.114", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
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
timedatectl set-timezone Asia/Tokyo
# install mariadb
echo "mariadb-server-10.0 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mariadb-server-10.0 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mariadb-server
mysql -uroot -proot -e "CREATE DATABASE test DEFAULT CHARACTER SET utf8;"
mysql -uroot -proot -e "CREATE USER test@localhost IDENTIFIED BY 'test';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost';"
mysql -uroot -proot -e "FLUSH PRIVILEGES;"
# install jdbc driver for mysql
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java_8.0.12-1ubuntu16.04_all.deb
dpkg -i mysql-connector-java_8.0.12-1ubuntu16.04_all.deb
# maximum file handles & maximum forked processes
echo '* hard nofile 50000' >> /etc/security/limits.conf
echo '* soft nofile 50000' >> /etc/security/limits.conf
echo '* hard nproc 10000' >> /etc/security/limits.conf
echo '* soft nproc 10000' >> /etc/security/limits.conf
echo '* soft nproc 10000' >> /etc/security/limits.d/90-nproc
# install java
apt-get -y install openjdk-8-jdk
# download and install Apache Nifi
wget http://ftp.riken.jp/net/apache/nifi/1.7.1/nifi-1.7.1-bin.tar.gz
tar xvfz nifi-1.7.1-bin.tar.gz
mv nifi-1.7.1 /opt
cat << EOF > /etc/systemd/system/nifi.service
[Unit]
Description=Apache Nifi
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/opt/nifi-1.7.1/bin/nifi.sh start
ExecStop=/opt/nifi-1.7.1/bin/nifi.sh stop
KillMode=none
[Install]
WantedBy=multi-user.target
EOF
systemctl enable nifi.service
systemctl start nifi.service
echo 'access url -> http://192.168.1.114:8080/nifi/'
SHELL
end
2.DBCPConnectionPoolで、以下のようにパラメータを設定してローカルのMariaDBにアクセスします。
Database Connection -> URL jdbc:mysql://localhost/test
Database Driver Class Name -> com.mysql.jdbc.Driver
Database Driver Location(s) -> /usr/share/java/mysql-connector-java-8.0.12.jar
Database Userr -> test
Password -> test
○関連情報
・Apache NiFiに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿