Hive安裝
軟件需求與環境說明
假設已經搭建好 Hadoop-2.6.0 環境,并能正常運行
mysql 安裝軟件
服務端:MySQL-server-5.5.16-1.rhel5.x86_64.rpm
客戶端:MySQL-client-5.5.16-1.rhel5.x86_64.rpm
hive安裝軟件:apache-hive-1.2.1-bin.tar.gz
Java 連接 MySQL 驅動軟件: mysql-connector-java-5.1.17-bin.jar
安裝mysql
使用 rpm -ivh MySQL-server-5.5.16-1.rhel5.x86_64.rpm 安裝服務端
使用 rpm -ivh MySQL-client-5.5.16-1.rhel5.x86_64.rpm 安裝客戶端
在命令行界面輸入 mysql 命令,進入 MySQL 界面,新增 hive 用戶,并賦予權限,以后 Hive 就使用該用戶登錄 MySQL
create database hive;
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' IDENTIFIED BY 'hadoop01' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost' IDENTIFIED BY 'hadoop01' WITH GRANT OPTION;
flush privileges;
alter database hive character set latin1;
使用 hive 登錄 MySQL: mysql -u hive -p;
注意:如果已經安裝mysql需要先卸載,需要修改root密碼再進行操作,具體見mysql安裝筆記
安裝Hive
把 apache-hive-1.2.1-bin.tar 解壓至 /home/cluster 目錄下,并重命名為 hive
把 mysql-connector-java-5.1.17-bin.jar 拷貝到 /home/cluster/hive/lib 目錄下
配置環境變量或者hive-env.sh
export HIVE_HOME=/home/cluster/hive
export PATH=$HIVE_HOME/bin:$PATH
hive-site.xml
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
javax.jdo.option.ConnectionURL
jdbc:mysql://192.168.56.13/hive?createDatabaseIfNotExist=true
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
hive
javax.jdo.option.ConnectionPassword
hadoop01
datanucleus.autoCreateSchema
false
datanucleus.autoCreateTables
true
hive.metastore.schema.verification
false
hive命令行下,set javax.jdo.option.ConnectionURL 檢查是否是連接到 mysql
hive客戶端安裝
hive服務端安裝好之后,服務端如何連接使用?
* 服務端需要啟動hive metastore服務,客戶端才能遠程使用hive元信息
hive --service metastore -p
如果不加端口默認啟動:hive –service metastore,則默認監聽端口是:9083
客戶端hive-site.xml配置
hive.metastore.uris
thrift://192.168.56.10:9083
Thrift uri for the remote metastore. Used by metastore client to connect to remote metastore.
hive.metastore.client.socket.timeout
3600
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
喜歡 (1)or分享 (0)