MySQL 启动 hive-metastore
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24605245/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Start hive-metastore
提问by Baeumla
We are trying to start the hive-metastore on our Linux Server but we are facing an issue. If we try to start the hive-metastore service with this command:
我们正在尝试在我们的 Linux 服务器上启动 hive-metastore,但我们遇到了一个问题。如果我们尝试使用以下命令启动 hive-metastore 服务:
sudo hive --service metastore
sudo hive --service 元存储
we get tons of errors like this:
我们会收到大量这样的错误:
Caused by: java.sql.SQLException: Access denied for user 'hive'@'sandbox.hortonworks.com' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:792) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:49) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154) at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:254) at com.jolbox.bonecp.BoneCP.(BoneCP.java:305) ... 48 more
引起:java.sql.SQLException:com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) 处的用户“hive”@'sandbox.hortonworks.com'(使用密码:YES)拒绝访问。 mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935) com .mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101) 在 com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300) 在 com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337) 在com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154) at com.mysql.jdbc.ConnectionImpl。(ConnectionImpl.java:792) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:49) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 在 java.lang.reflect.Constructor.newInstance(Constructor.java:513) 在 com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 在com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381) 在 com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) 在 java.sql.DriverManager.getConnection(DriverManager.java:582) 在 java .sql.DriverManager.getConnection(DriverManager.java:154) 在 com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:254) 在 com.jolbox.bonecp.BoneCP.(BoneCP.java:305) ... 48 更多
We also tried to reset the Password for the user hive but it doesn't help.
我们还尝试为用户配置单元重置密码,但没有帮助。
The reason why we want to start the hive-metastore is, that the port 9083 is not listening on our Server. We also have no idea why the metastore-service is not running anymore after the restart of the Server.
我们要启动 hive-metastore 的原因是端口 9083 没有在我们的服务器上侦听。我们也不知道为什么 Metastore-service 在服务器重启后不再运行。
If you know any other commands to restart the hive metastore or any other possible solutions for this problem please let me know.
如果您知道任何其他命令来重新启动 hive Metastore 或此问题的任何其他可能的解决方案,请告诉我。
Thanks in advance
提前致谢
Edit: I displayed the grants for the user hive:
编辑:我显示了用户配置单元的授权:
mysql> show grants for 'hive'@'sandbox.hortonworks.com';
+--------------------------------------------------------------------------------+
| Grants for [email protected] |
+--------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'hive'@'sandbox.hortonworks.com' |
| GRANT ALL PRIVILEGES ON `metastore`.* TO 'hive'@'sandbox.hortonworks.com' |
| GRANT ALL PRIVILEGES ON `hive`.`metastore` TO 'hive'@'sandbox.hortonworks.com' |
+--------------------------------------------------------------------------------+
3 rows in set (0.01 sec)
And here i selected host user and Password of the mysql.user table. There is no Password for the user hive!
在这里我选择了 mysql.user 表的主机用户和密码。用户 hive 没有密码!
mysql> select host, user, password from mysql.user;
+-------------------------+------+----------+
| host | user | password |
+-------------------------+------+----------+
| localhost | root | |
| sandbox.hortonworks.com | root | |
| 127.0.0.1 | root | |
| localhost | | |
| sandbox.hortonworks.com | | |
| sandbox.hortonworks.com | hive | |
| localhost | hive | |
+-------------------------+------+----------+
7 rows in set (0.01 sec)
Edit: I found an other error-message:
编辑:我发现了另一个错误消息:
I connected to Ambari with serverip:8080 and checked the status of some services. I get following error-message if i try to start the hive-metastore manually:
我使用 serverip:8080 连接到 Ambari 并检查了一些服务的状态。如果我尝试手动启动 hive-metastore,我会收到以下错误消息:
Hive Metastore status
CRITICAL: Error accessing Hive Metastore status [14/08/25 04:41:55 INFO Configuration.deprecation: mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive
The error occurs at the last of 4 steps of starting the Hive-services. The steps "Hive Metastore start" and "Hiveserver 2 start" already completed without errors. The step named "Hive Check execute" failed. Here is the error-message at the stdout:
该错误发生在启动 Hive 服务的 4 个步骤的最后一步。步骤“Hive Metastore 启动”和“Hiveserver 2 启动”已经完成,没有错误。名为“Hive Check execute”的步骤失败。这是标准输出中的错误消息:
notice: /Stage[2]/Hdp-hcat::Hcat::Service_check/Exec[hcatSmoke.sh prepare]/returns: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
err: /Stage[2]/Hdp-hcat::Hcat::Service_check/Exec[hcatSmoke.sh prepare]/returns: change from notrun to 0 failed: su - ambari-qa -c 'sh /tmp/hcatSmoke.sh hcatsmokeidd4b2a272_date472514 prepare' returned 1 instead of one of [0] at /var/lib/ambari-agent/puppet/modules/hdp-hcat/manifests/hcat/service_check.pp:54
notice: /Stage[2]/Hdp-hcat::Hcat::Service_check/Hdp-hadoop::Exec-hadoop[hcat::service_check::test]/Hdp::Exec[hadoop --config /etc/hadoop/conf fs -test -e /apps/hive/warehouse/hcatsmokeidd4b2a272_date472514]/Anchor[hdp::exec::hadoop --config /etc/hadoop/conf fs -test -e /apps/hive/warehouse/hcatsmokeidd4b2a272_date472514::begin]: Dependency Exec[hcatSmoke.sh prepare] has failures: true
notice: /Stage[2]/Hdp-hcat::Hcat::Service_check/Hdp-hadoop::Exec-hadoop[hcat::service_check::test]/Hdp::Exec[hadoop --config /etc/hadoop/conf fs -test -e /apps/hive/warehouse/hcatsmokeidd4b2a272_date472514]/Exec[hadoop --config /etc/hadoop/conf fs -test -e /apps/hive/warehouse/hcatsmokeidd4b2a272_date472514]: Dependency Exec[hcatSmoke.sh prepare] has failures: true
Is it possible that the smoke-test is flawed?
冒烟测试是否有可能存在缺陷?
回答by Ramanan R
Grant permissions to hive user in mysql
在mysql中授予hive用户权限
GRANT ALL ON metastore.* TO 'hive'@'sandbox.hortonworks.com';
GRANT ALL ON metastore TO 'hive'@'sandbox.hortonworks.com';
FLUSH PRIVILEGES;
回答by Roberto Tardio
I don't why, but the stored password is not correct. I did the following changes and hive metastore and hive works:
我不知道为什么,但存储的密码不正确。我做了以下更改,并且 hive Metastore 和 hive 工作:
- Connect to mysql and execute the next command to change the hive user password (original password is encrypted and unknown) for "password":
- 连接mysql,执行下一条命令修改hive用户密码(原密码已加密,未知)为“password”:
SET PASSWORD FOR 'hive'@'sandbox.hortonworks.com' = PASSWORD('password');
设置密码为'hive'@'sandbox.hortonworks.com' = PASSWORD('password');
- Add the following to hive-site.xml
- 将以下内容添加到 hive-site.xml
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
</property>
- Start Hive Metastore
- 启动 Hive Metastore
hive --service metastore
hive --service 元存储
However, Hive Metastore does not start atomatically anymore when I reboot HDP virtual machine.
但是,当我重新启动 HDP 虚拟机时,Hive Metastore 不再自动启动。