hive在centos上安裝
1,解壓
tar -zxvf apache-hive-1.1.0-bin.tar.gz
mv apache-hive-1.1.0-bin /usr/local/hive1.1
chown -R hadoop:hadoop hive1.1/
2,匯入環境變數
export HIVE_HOME=/usr/local/hive1.1
export PATH=$HIVE_HOME/bin:$PATH
3,建立目錄
必須建立 /tmp 和 /user/hive/warehouse,而且相對於HDFS,賦予g+w許可權
$HADOOP_HOME/bin/hadoop fs -mkdir /tmp
$HADOOP_HOME/bin/hadoop fs -mkdir /user/hive/warehouse
$HADOOP_HOME/bin/hadoop fs -chmod g+w /tmp
$HADOOP_HOME/bin/hadoop fs -chmod g+w /user/hive/warehouse
[hadoop@dbsrv1 ~]$ hive
Logging initialized using configuration in jar:file:/usr/local/hive1.1/lib/hive-common-1.1.0.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwx--x--x
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:472)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:671)
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.main(RunJar.java:160)
Caused by: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwx--x--x
at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:557)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:506)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:458)
... 7 more
解決辦法:
[hadoop@dbsrv1 tmp]$ hadoop fs -chmod -R 777 /tmp
--hive配置mysql資料庫儲存資料來源
cp hive-default.xml.template hive-site.xml
cp hive-log4j.properties.template hive-log4j.properties
--登入mysql新建使用者,建立資料庫
mysql> create database hive default character set gbk;
grant all privileges on hive.* to 'zhong'@'%' identified by 'zhong#123' with grant option;
修改hive-default.xml檔案
javax.jdo.option.ConnectionURL
jdbc:mysql://192.168.1.151:3306/hive?createDatabaseIfNotExist=true
JDBC connect string for a JDBC metastore
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name for a JDBC metastore
javax.jdo.option.ConnectionUserName
zhong
username to use against metastore database
javax.jdo.option.ConnectionPassword
zhong#123
password to use against metastore database
hive.metastore.local
true
controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM
--上傳mysql的jdbc庫到hive/lib
啟動hive
#啟動metastore服務
~ bin/hive --service metastore &
Starting Hive Metastore Server
#啟動hiveserver服務
~ bin/hive --service hiveserver &
Starting Hive Thrift Server
#啟動hive客戶端
~ bin/hive shell
hive> show tables
tar -zxvf apache-hive-1.1.0-bin.tar.gz
mv apache-hive-1.1.0-bin /usr/local/hive1.1
chown -R hadoop:hadoop hive1.1/
2,匯入環境變數
export HIVE_HOME=/usr/local/hive1.1
export PATH=$HIVE_HOME/bin:$PATH
3,建立目錄
必須建立 /tmp 和 /user/hive/warehouse,而且相對於HDFS,賦予g+w許可權
$HADOOP_HOME/bin/hadoop fs -mkdir /tmp
$HADOOP_HOME/bin/hadoop fs -mkdir /user/hive/warehouse
$HADOOP_HOME/bin/hadoop fs -chmod g+w /tmp
$HADOOP_HOME/bin/hadoop fs -chmod g+w /user/hive/warehouse
[hadoop@dbsrv1 ~]$ hive
Logging initialized using configuration in jar:file:/usr/local/hive1.1/lib/hive-common-1.1.0.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwx--x--x
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:472)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:671)
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.main(RunJar.java:160)
Caused by: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwx--x--x
at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:557)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:506)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:458)
... 7 more
解決辦法:
[hadoop@dbsrv1 tmp]$ hadoop fs -chmod -R 777 /tmp
--hive配置mysql資料庫儲存資料來源
cp hive-default.xml.template hive-site.xml
cp hive-log4j.properties.template hive-log4j.properties
--登入mysql新建使用者,建立資料庫
mysql> create database hive default character set gbk;
grant all privileges on hive.* to 'zhong'@'%' identified by 'zhong#123' with grant option;
修改hive-default.xml檔案
--上傳mysql的jdbc庫到hive/lib
啟動hive
#啟動metastore服務
~ bin/hive --service metastore &
Starting Hive Metastore Server
#啟動hiveserver服務
~ bin/hive --service hiveserver &
Starting Hive Thrift Server
#啟動hive客戶端
~ bin/hive shell
hive> show tables
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23073818/viewspace-1580604/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在CentOS上安裝dockerCentOSDocker
- 在centos上安裝molochCentOS
- 在CentOS上安裝GitCentOSGit
- 在CentOS 8.1上安裝 DockerCentOSDocker
- 在Centos7上安裝DockerCentOSDocker
- Centos7安裝配置Hive教程。CentOSHive
- 在CentOS 7.5上安裝和配置ProFTPDCentOSFTP
- 在Red Hat和Centos上安裝MongoDBCentOSMongoDB
- 截圖利器:shutter在centos上的安裝CentOS
- 在 Centos/RHEL 6.X 上安裝 WettyCentOS
- 在Centos8上安裝和使用curlCentOS
- 在centos7上安裝mysql5.7CentOSMySql
- 在Centos7上安裝Redis6CentOSRedis
- CentOS 上安裝 NginxCentOSNginx
- centos上安裝grafanaCentOSGrafana
- 在linux centos伺服器上安裝telnet命令LinuxCentOS伺服器
- 在rhel和CentOS上安裝SQL Server的方法CentOSSQLServer
- PostgreSQL tar.gz在centos7上安裝SQLCentOS
- 在Linux(Redhat/CentOS)下安裝MySQL之yum(rpm)線上安裝方式LinuxRedhatCentOSMySql
- centos 線上安裝 dockerCentOSDocker
- 在 CentOS 中安裝 nodejsCentOSNodeJS
- 在 CentOS7 上安裝 zookeeper-3.4.9 服務CentOS
- 在Centos7上安裝圖形化桌面工具CentOS
- openGauss資料庫在CentOS上的安裝實踐資料庫CentOS
- 記一次在CentOS上安裝GitLab的流程CentOSGitlab
- Docker架構及在Centos7上安裝dockerDocker架構CentOS
- Hive安裝Hive
- 在VMware已安裝的CentOS7.9上編譯安裝mysql5.6CentOS編譯MySql
- Centos7上安裝dockerCentOSDocker
- Linux Centos上安裝 MySQL 8.0.16LinuxCentOSMySql
- Centos上安裝Node環境CentOS
- 在VMware上安裝CentOS版本的Linux虛擬機器CentOSLinux虛擬機
- 在CentOS 8上安裝與配置Apache虛擬主機CentOSApache
- 在CentOS7上安裝MySQL5.7-YUM源方式CentOSMySql
- 【Hive一】Hive安裝及配置Hive
- Hive的安裝Hive
- Hive安裝配置Hive
- 在linux(Centos 7以上版本親測)上安裝mysql5.6LinuxCentOSMySql
- VIM在CentOS7上的無root許可權安裝CentOS