Facing issue while configuring MySql with apache airflow in Hadoop

柔情痞子 提交于 2020-04-07 05:33:23

问题


I was trying to install and configure apache airflow on dev Hadoop cluster of a three nodes with below configurations/version:

Operating System: Red Hat Enterprise Linux Server 7.7
python 3.7.3
anaconda 2
spark 2.45

a)sudo yum install gcc gcc-c++ -y
b)sudo yum install libffi-devel mariadb-devel cyrus-sasl-devel -y
c)pip install 'apache-airflow[all]'
d)airflow initdb  -- airflow.cfgfile was created with SQLlite

Then I followed below set of commands to configure it with mysql

a) rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm 
b) sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo 
c) yum --enablerepo=mysql80-community install mysql-community-server 
d) systemctl start mysqld.service

Done below things at mysql

a) CREATE DATABASE airflow CHARACTER SET utf8 COLLATE utf8_unicode_ci; 
b) create user 'airflow'@'localhost' identified by 'Airflow123'; 
c) grant all privileges on * . * to 'airflow'@'localhost'; 

here are some details from my airflow.cfg file

broker_url = sqla+mysql://airflow:airflow@localhost:3306/airflow
result_backend = db+mysql://airflow:airflow@localhost:3306/airflow
sql_alchemy_conn = mysql://airflow:Airflow123@localhost:3306/airflow
executor = CeleryExecutor

I am getting below error while running airflow initdb commands

ImportError: /home/xyz/anaconda2/envs/python3.7.2/lib/python3.7/site-packages/_mysql.cpython-37m-x86_64-linux-gnu.so: symbol mysql_real_escape_string_quote, 
version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference

have set up the .bashrc file as:

export AIRFLOW_HOME=~/airflow

here's my directory created:

[xyz@innolx5984 airflow]$ pwd
/home/xyz/airflow

When I look for this file "libmysqlclient" I have found these many instances.

[xyz@innolx5984 airflow]$ find /home/xyz/ -name "*libmysqlclient*"
/home/xyz/anaconda2/pkgs/mysql-connector-c-6.1.11-h597af5e_1/lib/libmysqlclient.so
/home/xyz/anaconda2/pkgs/mysql-connector-c-6.1.11-h597af5e_1/lib/libmysqlclient.a
/home/xyz/anaconda2/pkgs/mysql-connector-c-6.1.11-h597af5e_1/lib/libmysqlclient.so.18
/home/xyz/anaconda2/pkgs/mysql-connector-c-6.1.11-h597af5e_1/lib/libmysqlclient.so.18.4.0
/home/xyz/anaconda2/lib/libmysqlclient.a
/home/xyz/anaconda2/lib/libmysqlclient.so
/home/xyz/anaconda2/lib/libmysqlclient.so.18
/home/xyz/anaconda2/lib/libmysqlclient.so.18.4.0

Just adding few more details in case it helps.

[xyz@innolx5984 airflow]$ mysql_config
Usage: /home/xyz/an
aconda2/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/home/xyz/anaconda2/include ]
        --cxxflags       [-I/home/xyz/anaconda2/include ]
        --include        [-I/home/xyz/anaconda2/include]
        --libs           [-L/home/xyz/anaconda2/lib -lmysqlclient ]
        --libs_r         [-L/home/xyz/anaconda2/lib -lmysqlclient ]
        --plugindir      [/home/xyz`/anaconda2/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [6.1.11]
        --variable=VAR   VAR is one of:
                pkgincludedir [/home/xyz/anaconda2/include]
                pkglibdir     [/home/xyz/anaconda2/lib]
                plugindir     [/home/xyz/anaconda2/lib/plugin]

    Looking for some help and suggestion to resolve this

issue. I am not too sure whether heading into right direction.

来源:https://stackoverflow.com/questions/60987782/facing-issue-while-configuring-mysql-with-apache-airflow-in-hadoop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!