○Apache Supersetの画面
○構築方法
以下のVagrantfileを使用して、Apache SupersetとMariaDBをインストールした仮想マシン(Debian Stretch/9.4)を構築する事ができます。
仮想マシンが構築された後、ブラウザからhttp://192.168.55.107:8088/にアクセスします。
デフォルトユーザ名はadmin、パスワードもadminです。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.4"
config.vm.hostname = "db94supersetmariadb"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db94supersetmariadb"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.107", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.107", :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 mariadb
echo "mariadb-server-10.3 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mariadb-server-10.3 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mariadb-server
apt-get -y install mysql-server
mysql -uroot -e "CREATE DATABASE test DEFAULT CHARACTER SET utf8;"
mysql -uroot -e "CREATE USER test@localhost IDENTIFIED BY 'test';"
mysql -uroot -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost';"
mysql -uroot -e "FLUSH PRIVILEGES;"
mysql -utest -ptest test -e "create table messages (message_id integer not null, message varchar(100));"
mysql -utest -ptest test -e "insert into messages value (1, 'hello world.');"
mysql -utest -ptest test -e "insert into messages value (2, 'test message.');"
# install anaconda
wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
chmod +x Anaconda3-5.1.0-Linux-x86_64.sh
./Anaconda3-5.1.0-Linux-x86_64.sh -b -p /opt/anaconda
source /opt/anaconda/bin/activate
pip install --upgrade pip
# install dependencies
apt-get -y install build-essential libssl-dev libffi-dev python-dev python-pip libsasl2-dev libldap2-dev
# install mysqlclient
apt-get -y install libmariadbclient-dev
pip install mysqlclient
pip install --upgrade setuptools
pip install superset
pip install cryptography --upgrade
mkdir -p /opt/superset
cd /opt/superset
fabmanager create-admin --app superset --username admin --firstname admin --lastname user --email admin@localhost.localdomain --password admin
superset db upgrade
superset load_examples
superset init
superset runserver -a 0.0.0.0 &
echo 'access http://192.168.55.107:8088/'
echo 'user:admin, password: admin'
SHELL
end
○データソースの追加
同じ仮想マシンにインストールされたMariaDBに接続するには、以下の画面のようにSQLAlchemy URIにmysql://test:test@localhost/testを指定します。
0 件のコメント:
コメントを投稿