kudu集成impala
Kudu 与 Apache Impala (孵化)紧密集成,允许开发人员使用 Impala 使用 Impala 的 SQL 语法从 Kudu tablets 插入,查询,更新和删除数据;
安装impala
安装规划
1:Imppalla catalog服务将SQL语句做出的元数据变化通知给集群的各个节点 2:Impala Statestore检查集群各个节点上Impala daemon的健康状态
主节点hadoop01执行以下命令进行安装
yum install impala -y yum install impala-server -y yum install impala-state-store -y yum install impala-catalog -y yum install impala-shell -y
从节点hadoop02与hadoop03安装以下服务
yum install impala-server -y
yum install impala -y
修改hive-site.xml
impala依赖于hive,所以首先需要进行hive的配置修改;
Hadoop01机器修改hive-site.xml内容如下
vim /opt/cdh/hive-1.1.0-cdh5.14.0/conf/hive-site.xml
<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://hadoop01:3306/hive?createDatabaseIfNotExist=true</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>root</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>root</value> </property> <property> <name>hive.cli.print.current.db</name> <value>true</value> </property> <property> <name>hive.cli.print.header</name> <value>true</value> </property> <property> <name>hive.server2.thrift.bind.host</name> <value>hadoop01</value> </property> <property> <name>hive.metastore.uris</name> <value>thrift://hadoop01:9083</value> </property> <property> <name>hive.metastore.client.socket.timeout</name> <value>3600</value> </property> </configuration>
添加mysql的jar包,放入hive的lib目录下
(cp mysql的connection包,复制在hive的lib下)
将hive的安装包发送到hadoop02与hadoop03机器上
在hadoop01机器上面执行
cd /opt/cdh/ scp -r hive-1.1.0-cdh5.14.0/ hadoop02:$PWD scp -r hive-1.1.0-cdh5.14.0/ hadoop03:$PWD
启动hive的metastore服务
启动hive的metastore服务(如果impala报错,则启动全部hive)
Hadoop01机器启动hive的metastore服务
cd /opt/cdh/hive-1.1.0-cdh5.14.0 nohup bin/hive --service metastore &
注意:一定要保证mysql的服务正常启动,否则metastore的服务不能够启动
所有节点创建文件夹
mkdir -p /var/run/hdfs-sockets
修改所有节点的hdfs-site.xml添加以下配置,修改完之后重启hdfs集群生效
vim /opt/cdh/hadoop-2.6.0-cdh5.14.0/etc/hadoop/hdfs-site.xml
<configuration> <!-- 设置hdfs副本数量 --> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.secondary.http.address</name> <value>hadoop01:50090</value> </property> <property> <name>dfs.client.read.shortcircuit</name> <value>true</value> </property> <property> <name>dfs.domain.socket.path</name> <value>/var/run/hdfs-sockets/dn</value> </property> <property> <name>dfs.client.file-block-storage-locations.timeout.millis</name> <value>10000</value> </property> <property> <name>dfs.datanode.hdfs-blocks-metadata.enabled</name> <value>true</value> </property> <property> <name>dfs.permissions.enabled</name> <value>false</value> </property> </configuration>
创建文件夹 /var/run/hadoop-sockets/
给这个文件夹赋予权限,例如如果我们用的是普通用户,那就直接赋予普通用户的权限
例如:
chown -R angel:angel /var/run/hadoop-sockets/
因为我这里直接用的root用户,所以不需要赋权限了
重启hdfs
重启hdfs文件系统
Hadoop01服务器上面执行以下命令
cd /opt/cdh/hadoop-2.6.0-cdh5.14.0/ sbin/stop-dfs.sh sbin/start-dfs.sh
impala的配置目录为 /etc/impala/conf
这个路径下面需要把core-site.xml,hdfs-site.xml以及hive-site.xml拷贝到这里来,但是我们这里使用软连接的方式会更好
所有节点执行以下命令创建链接到impala配置目录下来
ln -s /opt/cdh/hadoop-2.6.0-cdh5.14.0/etc/hadoop/core-site.xml /etc/impala/conf/core-site.xml ln -s /opt/cdh/hadoop-2.6.0-cdh5.14.0/etc/hadoop/hdfs-site.xml /etc/impala/conf/hdfs-site.xml ln -s /opt/cdh/hive-1.1.0-cdh5.14.0/conf/hive-site.xml /etc/impala/conf/hive-site.xml
所有节点更改impala默认配置文件以及添加mysql的连接驱动包
vim /etc/default/impala
IMPALA_CATALOG_SERVICE_HOST=hadoop01
IMPALA_STATE_STORE_HOST=hadoop01
ln -s /opt/cdh/hive-1.1.0-cdh5.14.0/lib/mysql-connector-java-5.1.25.jar /usr/share/java/mysql-connector-java.jar
修改bigtop的java_home路径
vim /etc/default/bigtop-utils
export JAVA_HOME=/opt/cdh/jdk1.8.0_181
service impala-state-store start service impala-catalog start service impala-server start service impala-state-store stop service impala-catalog stop service impala-server stop
从节点启动hadoop02与hadoop03s启动impala-server
service impala-server start|stop
查看impala进程是否存在
ps -ef | grep impala
注意:启动之后所有关于impala的日志默认都在/var/log/impala 这个路径下,hadoop01机器上面应该有三个进程,hadoop02与hadoop03机器上面只有一个进程,如果进程个数不对,去对应目录下查看报错日志
浏览器页面访问
访问impalad的管理界面http://hadoop01:25000/
访问statestored的管理界面http://hadoop01:25010/
将impala与kudu整合
在每一个服务器的impala的配置文件中添加如下配置:
vim /etc/default/impala 在IMPALA_SERVER_ARGS下添加:-kudu_master_hosts=hadoop01:7051,hadoop02:7051,hadoop03:7051