hive安装常见错误
hive编译出错
mvn clean package -DskipTests -Phadoop-2 -Pdist
失败日志1
Failed to execute goal on project hive-service: Could not resolve dependencies for project org.apache.hive:hive-service:jar:1.1.0-cdh5.7.0: Failed to collect dependencies at org.apache.directory.server:apacheds-server-integ:jar:1.5.6 -> org.apache.directory.client.ldap:ldap-client-api:jar:0.1-SNAPSHOT: Failed to read artifact descriptor for org.apache.directory.client.ldap:ldap-client-api:jar:0.1-SNAPSHOT: Could not transfer artifact org.apache.directory.client.ldap:ldap-client-api:pom:0.1-SNAPSHOT from/to apache.snapshots (http://repository.apache.org/snapshots): Connect to repository.apache.org:80 [repository.apache.org/207.244.88.140] failed: Connection refused (Connection refused) -> [Help 1]
失败日志2
[ERROR] Failed to execute goal on project hive-service:
Could not resolve dependencies for project org.apache.hive:hive-service:jar:1.1.0-cdh5.7.0:
Failed to collect dependencies at org.apache.directory.server:apacheds-server-integ:jar:1.5.6 -> org.apache.directory.client.ldap:ldap-client-api:jar:0.1-SNAPSHOT:
Failed to read artifact descriptor for org.apache.directory.client.ldap:ldap-client-api:jar:0.1-SNAPSHOT:
Could not transfer artifact org.apache.directory.client.ldap:ldap-client-api:pom:0.1-SNAPSHOT from/to apache.snapshots (http://repository.apache.org/snapshots):
Network is unreachable (connect failed) -> [Help 1]
暂未解决。。。
有可能时网络的原因。
安装后启动不起来
日志:
Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://hadoop000:3306/metastore?createDatabaseIfNotExist=true, username = root. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Access denied for user 'root'@'hadoop000' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
网上查看后,总结了解决方法
1.查看hive-site.xml是否配置正确,mysql的账号密码不能写错。
2.hive没有初始化,进行初始化
schematool -dbType mysql -initSchema
3.hive版本过高。
4.HIVE_HOME/lib 下的derby-10.11.1.1.jar问题,,把derby-10.11.1.1.jar 换成derby-10.10.2.0.jar问题成功解决
综上,我的问题是hive-site.xml配置文件中mysql的密码写错了。
配置hive前必不可少的一项,给mysql赋予权限
mysql -uroot -p
>grant all privileges on *.* to root@"%" identified by "123456" with grant option; >grant all privileges on *.* to root@"hadoop000" identified by "123456" with grant option; >grant all privileges on *.* to root@"localhost" identified by "123456" with grant option;
>quit;
解释:
grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;)
* mysql数据库默认只允许root用户通过localhost/127.0.0.1来登录使用
* 上面带有grant的那条语句中:
all:表示所有权限;
*.*:表示数据库.数据表;
root:表示授权给哪个用户,用户名可以任意指定,如果没有会自动创建;
'hadoop000' :授权给哪台主机
'123456':授权给用户来登录的密码
如果不确定有没有成功,可以查看 mysql.user
mysql >select host,user,password from mysql.user;