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上安裝GitCentOSGit
- 在centos上安裝molochCentOS
- 在CentOS上安裝dockerCentOSDocker
- 在CentOS上安裝PowerShellCentOS
- 在Centos上安裝wordpressCentOS
- 在CentOS 8.1上安裝 DockerCentOSDocker
- SonarQube在CentOS上的安裝CentOS
- 在CentOS上安裝GITLABCentOSGitlab
- 在Centos7上安裝DockerCentOSDocker
- 在CentOS 7上安裝TensorflowCentOS
- 在Centos6.5上安裝ossfsCentOS
- Centos7安裝配置Hive教程。CentOSHive
- 在CentOS 7.5上安裝和配置ProFTPDCentOSFTP
- 在Red Hat和Centos上安裝MongoDBCentOSMongoDB
- 2、在VM上的 CentOS 6.5 上安裝mysqlCentOSMySql
- 在Centos8上安裝和使用curlCentOS
- 在 Centos/RHEL 6.X 上安裝 WettyCentOS
- 截圖利器:shutter在centos上的安裝CentOS
- 在Centos7上安裝Redis6CentOSRedis
- 在CentOS7上安裝Zabbix3.0CentOS
- 在CentOS 6.5上安裝python2.7CentOSPython
- 在centos7上安裝mysql5.7CentOSMySql
- CentOS 上安裝 NginxCentOSNginx
- centos上安裝grafanaCentOSGrafana
- centos上安裝redmineCentOS
- 在rhel和CentOS上安裝SQL Server的方法CentOSSQLServer
- PostgreSQL tar.gz在centos7上安裝SQLCentOS
- 在Linux CentOS 6.6上安裝Python 2.7.9LinuxCentOSPython
- 在 CentOS6 上安裝 Zabbix2.4 ServerCentOSServer
- 遊俠原創:在CentOS上安裝Nessus薦CentOS
- centos上nginx的安裝CentOSNginx
- 在Centos7上安裝圖形化桌面工具CentOS
- Docker架構及在Centos7上安裝dockerDocker架構CentOS
- 在Centos 7上使用Devstack快速安裝Openstack薦CentOSdev
- 在 CentOS7 上安裝 zookeeper-3.4.9 服務CentOS
- 在CentOS上使用yum安裝MySQL+安全優化CentOSMySql優化
- Hive安裝Hive
- 在VMware已安裝的CentOS7.9上編譯安裝mysql5.6CentOS編譯MySql