MyException - 我的异常网
当前位置:我的异常网» Linux/Unix » Linux筹建Hive开发环境

香港六合彩手机网:Linux筹建Hive开发环境

香港六合彩现场直播 www.hppyv.com  网友分享于:2018-05-07  浏览:1次
Linux搭建Hive开发环境
Linux搭建Hive开发环境
1.Hive
The Apache Hive ? data warehouse software facilitates reading, writing, and managing large datasets residing in distributed storage using SQL. Structure can be projected onto data already in storage. A command line tool and JDBC driver are provided to connect users to Hive.
?
2.Hive安装
【1】官网下载Hive【https://hive.apache.org/】安装包:apache-hive-2.3.3-bin.tar.gz
?
【2】利用Sftp5工具把Hive安装包上传到:/usr/local/hive
?
【3】利用Xshell工具登录到Linux服务器,解压hive安装包:apache-hive-2.3.3-bin.tar.gz
[[email protected] ~]# cd /usr/local/hive
total 226788
-rw-r--r--.??1 root root 232229830 Apr??5 21:42 apache-hive-2.3.3-bin.tar.gz
drwxr-xr-x. 10 root root???????184 Apr??5 12:40 hive-2.3.3
total 0
drwxr-xr-x. 10 root root 184 Apr??5 12:40 hive-2.3.3
?
【4】配置环境变量,输入:vim? /etc/profile?
#Setting HIVE_HOME PATH
export HIVE_HOME=/usr/local/hive/hive-2.3.3
export PATH=${PATH}:${HIVE_HOME}/bin
保存退出后,运行[source /etc/profile]使配置立即生效。
【5】进入到:cd? /usr/local/hive/hive-2.3.3/conf,修改配置文件hive-env.sh:
[[email protected] ~]# cd /usr/local/hive/hive-2.3.3/conf
total 288
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
生成hive-env.sh文件,输入:cp??hive-env.sh.template hive-env.sh
[[email protected] conf]# cp??hive-env.sh.template hive-env.sh
total 292
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rw-r--r--. 1 root root???2365 Apr??5 22:18 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
授权hive-env.sh脚本文件,输入:chmod +x hive-env.sh:
[[email protected] conf]# chmod +x hive-env.sh
total 292
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2365 Apr??5 22:18 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
?
修改配置,输入:vim hive-env.sh
[[email protected] conf]# vim hive-env.sh
?
?
export JAVA_HOME=/usr/local/java/jdk1.8.0_162
export HADOOP_HOME=/usr/local/hadoop/hadoop-2.7.5
export HIVE_HOME=/usr/local/hive/hive-2.3.3
export HIVE_AUX_JARS_PATH=${HIVE_HOME}/lib/*
export HIVE_CONF_DIR=${HIVE_HOME}/conf
export HADOOP_HEAPSIZE=1024
?
【6】将hive-default.xml.template文件复制一份,并且改名为hive-site.xml,输入:cp???hive-default.xml.template???hive-site.xml
[[email protected] conf]# cp???hive-default.xml.template???hive-site.xml
[[email protected] conf]# chmod +x hive-site.xml
total 544
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2590 Apr??5 22:41 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:46 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
修改hive-site.xml,并添加:
??<configuration>
????<property>
????????<name>javax.jdo.option.ConnectionURL</name>
????????<value>jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf8</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>123456Abc</value>
????</property>
????<property>
????????<name>hive.metastore.warehouse.dir</name>
????????<value>/tmp/hive/repository</value>
????</property>
????<property>??
????????<name>hive.exec.scratchdir</name>??
????????<value>/tmp/hive</value>??????
????</property>
????<property>??????
????????<name>hive.metastore.local</name>??
????????<value>true</value>?????
????</property>??????
????<property>??
????????<name>hive.metastore.uris</name>??
????????<value>thrift://marklin.com:9083</value>??
????</property>
</configuration>
?
Hive的配置需要Hadoop和Mysql的支持,本教程已经默认安装Hadoop和Mysql的支持。
?
【6】将hive-exec-log4j2.properties.template文件复制一份,并且改名为 hive-exec-log4j2.properties,输入:cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties
[[email protected] conf]# cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties
total 548
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rw-r--r--. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
[[email protected] conf]# chmod +x hive-exec-log4j2.properties
total 548
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
?
【7】将hive-log4j2.properties.template文件复制一份,并且改名为 hive-log4j2.properties.,输入:cp hive-log4j2.properties.template hive-log4j2.properties
?
[[email protected] conf]# cp hive-log4j2.properties.template hive-log4j2.properties
total 552
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
[[email protected] conf]# chmod +x hive-log4j2.properties
total 552
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rwxr-xr-x. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
?
【7】将beeline-log4j2.properties.template文件复制一份,并且改名为 beeline-log4j2.properties.,输入:cp beeline-log4j2.properties.template beeline-log4j2.properties
?
[[email protected] conf]# cp beeline-log4j2.properties.template beeline-log4j2.properties
total 556
-rw-r--r--. 1 root root???1596 Apr??6 01:19 beeline-log4j2.properties
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rwxr-xr-x. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
[[email protected] conf]# chmod +x beeline-log4j2.properties
total 556
-rwxr-xr-x. 1 root root???1596 Apr??6 01:19 beeline-log4j2.properties
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rwxr-xr-x. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
?
?
【8】配置llap-x文件:
[[email protected] conf]# cp llap-cli-log4j2.properties.template llap-cli-log4j2.properties
total 560
-rwxr-xr-x. 1 root root???1596 Apr??6 01:19 beeline-log4j2.properties
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rwxr-xr-x. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rw-r--r--. 1 root root???2719 Apr??6 01:22 llap-cli-log4j2.properties
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
[[email protected] conf]# chmod +x llap-cli-log4j2.properties
total 560
-rwxr-xr-x. 1 root root???1596 Apr??6 01:19 beeline-log4j2.properties
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rwxr-xr-x. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rwxr-xr-x. 1 root root???2719 Apr??6 01:22 llap-cli-log4j2.properties
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
[[email protected] conf]# cp llap-daemon-log4j2.properties.template llap-daemon-log4j2.properties
[[email protected] conf]# chmod +x llap-daemon-log4j2.properties
total 568
-rwxr-xr-x. 1 root root???1596 Apr??6 01:19 beeline-log4j2.properties
-rw-r--r--. 1 root root???1596 Feb 17??2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 19:58 hive-default.xml.template
-rwxr-xr-x. 1 root root???2618 Apr??6 00:23 hive-env.sh
-rw-r--r--. 1 root root???2365 Feb 17??2017 hive-env.sh.template
-rwxr-xr-x. 1 root root???2274 Apr??6 01:12 hive-exec-log4j2.properties
-rw-r--r--. 1 root root???2274 Feb 17??2017 hive-exec-log4j2.properties.template
-rwxr-xr-x. 1 root root???2925 Apr??6 01:16 hive-log4j2.properties
-rw-r--r--. 1 root root???2925 Mar??7 16:37 hive-log4j2.properties.template
-rwxr-xr-x. 1 root root 257573 Apr??5 22:50 hive-site.xml
-rw-r--r--. 1 root root???2060 Feb 17??2017 ivysettings.xml
-rwxr-xr-x. 1 root root???2719 Apr??6 01:22 llap-cli-log4j2.properties
-rw-r--r--. 1 root root???2719 Mar??7 16:38 llap-cli-log4j2.properties.template
-rwxr-xr-x. 1 root root???7041 Apr??6 01:23 llap-daemon-log4j2.properties
-rw-r--r--. 1 root root???7041 Mar??7 16:38 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root???2662 Jul 20??2016 parquet-logging.properties
?
?
【9】对数据进行初始化,输入:schematool -dbType mysql??-initSchema
[[email protected] ~]# schematool -dbType mysql??-initSchema
Metastore connection URL:???? jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf8
Metastore Connection Driver :???? com.mysql.jdbc.Driver
Metastore connection User:???? root
Starting metastore schema initialization to 2.3.0
Initialization script hive-schema-2.3.0.mysql.sql
Initialization script completed
schemaTool completed
?
?
【10】输入hive执行:
[[email protected] ~]# hive
Logging initialized using configuration in file:/usr/local/hive/hive-2.3.3/conf/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive> show databases; --显示数据库
OK
default
Time taken: 2.962 seconds, Fetched: 1 row(s)
hive> show tables;? --显示数据库表
OK?
Time taken: 0.46 seconds
hive>
?
【11】浏览器输入://192.168.3.4:50070/explorer.html#/
?

文章评论

软件开发程序错误异常香港六合彩现场直播Copyright © 2009-2015 MyException 版权所有
479| 99| 472| 27| 526| 369| 14| 783| 211| 515|