前提:服务器已经安装好了Hadoop_client端即hadoop的环境hbase,hive等相关组件
1.环境和变量配置 ①拷贝hive的配置文件hive-site.xml到zeppelin-0.7.2-bin-all/conf下
# cp /root/hadoop-2.6.0/conf/hive-site.xml /data/hadoop/zeppelin/zeppelin-0.7.2-bin-all/conf
②进入conf下进行环境变量的配置
# cd /data/hadoop/zeppelin/zeppelin-0.7.2-bin-all/conf vim zeppelin-env.sh
export JAVA_HOME=/usr/java/jdk1.8.0_111 export HADOOP_CONF_DIR=/root/hadoop-2.6.0/conf
2.在web界面配置集成hive 访问zeppelin的web界面(http://ip:8080)
右上角anonymous --> interpreter --> Create新建一个叫做hive的集成环境(也可以在jdbc的基础上修改,不用新建)
编辑hive的相关属性,hive相关的配置可以到hive-site.xml中查看
Properties value common.max_count 1000 hive.driver org.apache.hive.jdbc.HiveDriver hive.password hive hive.url jdbc:hive2://uhadoop-bwgkeu-master2:10000 # 注意是hive2不是hive hive.user hive zeppelin.interpreter.localRepo /data/hadoop/zeppelin/zeppelin-0.7.2-bin-all/local-repo/2CNPYUV7Z zeppelin.interpreter.output.limit 102400 zeppelin.jdbc.auth.type zeppelin.jdbc.concurrent.max_connection 10 zeppelin.jdbc.concurrent.use true zeppelin.jdbc.keytab.location zeppelin.jdbc.principal
填写Dependencies相关属性 2个hive依赖包,一个mysql依赖包,不用mysql可以不用写mysql jdbc包 填好后点保存,这个时候zeppelin会出现卡顿,这是因为上面填的2个Dependencies,zeppelin去指定maven库下载相关依赖包去了,等待时间可能需几分钟。
下载完成可在local-repo目录下查看,依赖包放在local-repo/2CNPYUV7Z/(可能不同)目录下,等完全下载完成,就可查询。
Dependencies
artifact exclude org.apache.hive:hive-jdbc:0.14.0 org.apache.hadoop:hadoop-common:2.6.0 mysql:mysql-connector-java:5.1.38
# ls local-repo/2CNPYUV7Z/ activation-1.1.jar commons-lang-2.6.jar hive-shims-common-0.14.0.jar jta-1.1.jar ant-1.9.1.jar commons-logging-1.1.3.jar hive-shims-common-secure-0.14.0.jar junit-4.11.jar ant-launcher-1.9.1.jar commons-math3-3.1.1.jar htrace-core-3.0.4.jar libfb303-0.9.0.jar antlr-2.7.7.jar commons-net-3.1.jar httpclient-4.2.5.jar libthrift-0.9.0.jar antlr-runtime-3.4.jar commons-pool-1.5.4.jar httpcore-4.2.5.jar log4j-1.2.16.jar apacheds-i18n-2.0.0-M15.jar curator-client-2.6.0.jar jackson-core-asl-1.9.13.jar log4j-1.2.17.jar apacheds-kerberos-codec-2.0.0-M15.jar curator-framework-2.6.0.jar jackson-core-asl-1.9.2.jar mail-1.4.1.jar api-asn1-api-1.0.0-M20.jar curator-recipes-2.6.0.jar jackson-jaxrs-1.9.13.jar mysql-connector-java-5.1.38.jar api-util-1.0.0-M20.jar datanucleus-api-jdo-3.2.6.jar jackson-mapper-asl-1.9.13.jar netty-3.6.2.Final.jar asm-3.1.jar datanucleus-core-3.2.10.jar jackson-mapper-asl-1.9.2.jar opencsv-2.3.jar asm-3.2.jar datanucleus-rdbms-3.2.9.jar jackson-xc-1.9.13.jar paranamer-2.3.jar asm-commons-3.1.jar derby-10.10.1.1.jar java-xmlbuilder-0.4.jar protobuf-java-2.5.0.jar asm-tree-3.1.jar geronimo-annotation_1.0_spec-1.1.1.jar jaxb-api-2.2.2.jar servlet-api-2.5.jar avro-1.7.4.jar geronimo-jaspic_1.0_spec-1.0.jar jaxb-impl-2.2.3-1.jar slf4j-api-1.7.5.jar avro-1.7.5.jar geronimo-jta_1.1_spec-1.1.1.jar jdo-api-3.0.1.jar slf4j-log4j12-1.7.5.jar bonecp-0.8.0.RELEASE.jar gson-2.2.4.jar jersey-core-1.9.jar snappy-java-1.0.4.1.jar commons-beanutils-1.7.0.jar guava-11.0.2.jar jersey-json-1.9.jar snappy-java-1.0.5.jar commons-beanutils-core-1.8.0.jar hadoop-annotations-2.6.0.jar jersey-server-1.9.jar stax-api-1.0-2.jar commons-cli-1.2.jar hadoop-auth-2.6.0.jar jets3t-0.9.0.jar stringtemplate-3.2.1.jar commons-codec-1.4.jar hadoop-common-2.6.0.jar jettison-1.1.jar tools.jar commons-collections-3.2.1.jar hamcrest-core-1.3.jar jetty-6.1.26.jar xmlenc-0.52.jar commons-compress-1.4.1.jar hive-common-0.14.0.jar jetty-all-7.6.0.v20120127.jar xz-1.0.jar commons-configuration-1.6.jar hive-jdbc-0.14.0.jar jetty-util-6.1.26.jar zookeeper-3.4.5.jar commons-dbcp-1.4.jar hive-metastore-0.14.0.jar jline-0.9.94.jar zookeeper-3.4.6.jar commons-digester-1.8.jar hive-serde-0.14.0.jar jpam-1.1.jar commons-httpclient-3.1.jar hive-service-0.14.0.jar jsch-0.1.42.jar commons-io-2.4.jar hive-shims-0.14.0.jar jsr305-1.3.9.jar
如果有问题,可以查看日志查找原因,日志路径:/data/hadoop/zeppelin/zeppelin-0.7.2-bin-all/logs/zeppelin-interpreter-jdbc-root-u04rdp01.yaya.corp.log
3.新建一个作业进行测试
notebook --> Create new node填写名称,选择hive即可
输入查询语句,注意查询语句前需要有前缀(hive):
(hive) select * from tbl_push_user_req limit 3;
柱状图展示
饼状图形展示