Hadoop之Hive 安装_(hadoop 集群)

网友投稿 260 2022-11-23

Hadoop之Hive 安装_(hadoop 集群)

Hive mysql的metastore安装准备(***掌握***) 在nameNode1机子上实践: 把hive-0.12.0.tar.gz解压到/itcast/ # tar -zxvf hive-0.12.0.tar.gz -C /itcast 修改/etc/profile文件,将hive加入环境变量 # vim /etc/profile export JAVA_HOME=/usr/java/jdk1.7.0_79 export HADOOP_HOME=/itcast/hadoop-2.4.1 export HIVE_HOME=/itcast/hive-0.12.0 export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin Source 一下,让配置生效 # source /etc/profile 安装完毕! 提示:metastore是hive元数据的集中存放地。metastore默认使用内嵌的derby数据库作为存储引擎。Derby引擎的缺点:一次只能打开一个会话,使用Mysql作为外置存储引擎,多用户同时访问。 Ø 安装mysql数据库(***掌握****) (注意:没网络,可以配置好本地yum源) # yum -y install mysql-server 启动mysql数据库 # service mysqld start 初始化mysql数据库(默认root的密码为空,按提示一步步完成) # /usr/bin/mysql_secure_installation 将mysql加入开机启动 # chkconfig mysqld on 允许远程登录mysql 首先登录mysql数据,然后执行下面两行语句: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'itcast' WITH GRANT OPTION;   (   grant all privileges on vtdc.* to joe@10.163.225.87 identified by ‘123′;  给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123   ) flush privileges; 修改$HIVE_HOME/bin的hive-config.sh,增加以下三行 export JAVA_HOME=/usr/java/jdk1.7.0_79 export HIVE_HOME=/itcast/hive-0.12.0 export HADOOP_HOME=/itcast/hadoop-2.4.1 Ø 配置MySQL的metastore(***掌握***) 上传数据库驱动mysql-connector-java-5.1.28.jar到/itcast/hive-0.12.0/lib cp hive-default.xml.template hive-site.xml  修改$HIVE_HOME/conf/hive-site.xml # vim /itcast/hive-0.12.0/conf/hive-site.xml javax.jdo.option.ConnectionURL jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true javax.jdo.option.ConnectionDriverName com.mysql.jdbc.Driver javax.jdo.option.ConnectionUserName root javax.jdo.option.ConnectionPassword itcast 配置完毕! Ø 测试配置是否正确(***掌握***) 启动hive # hive 创建数据库 hive> create database test_db; 显示所有数据库 show databases; 使用数据库test_db hive> use test_db; 创建学生表 hive> create table student(id int,name string); 查看是否在HDFS中存有下面文件夹       -------------bug-------------------------------------- 1. Logging initialized using configuration in file:/usr/local/apache-hive-1.1.0-bin/conf/hive-log4j.properties [ERROR] Terminal initialization failed; falling back to unsupported java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected at jline.TerminalFactory.create(TerminalFactory.java:101) at jline.TerminalFactory.get(TerminalFactory.java:158) at jline.console.ConsoleReader.(ConsoleReader.java:229) at jline.console.ConsoleReader.(ConsoleReader.java:221) at jline.console.ConsoleReader.(ConsoleReader.java:209) at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136) Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected at jline.console.ConsoleReader.(ConsoleReader.java:230) at jline.console.ConsoleReader.(ConsoleReader.java:221) at jline.console.ConsoleReader.(ConsoleReader.java:209) at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136)   错误原因   Hive has upgraded to Jline2 but jline 0.94 exists in the Hadoop lib. 1解决方案(Hive on Spark Getting Started): 1.Delete jline from the Hadoop lib directory (it's only pulled in transitively from ZooKeeper). 2.export HADOOP_USER_CLASSPATH_FIRST=true

岁月里,寒暑交替。人世间,北来南往。铭心的,云烟的。都付往事,不念,不问。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Java 实战项目锤炼之在线购书商城系统的实现流程
下一篇:详细剖析OPC和即插即用技术
相关文章

 发表评论

暂时没有评论,来抢沙发吧~