部分报错信息原因
目录:
1.命令: bin/hive
2.命令:schematool-initSchema-dbType mysql -verbose
3. Linux上的MySQL无法实现与外部连接
4.命令:insert into test values(111,jkjkj);
5.命令:bin/beeline -u jdbc:hive2://master:10000 -n root
6.命令:bin/schematool -dbType derby -initSchema
7.命令:mysqld –initialize –user=mysql
8.命令:schematool -initSchema -dbType mysql -verbose
1.命令: bin/hive
错误信息:
Caused by: java.net.ConnectException: Call From hadoop102/192.168.1.102 to hadoop102:9000 failed on connection exception:
java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
原因:未启动hadoop
解决:
启动集群:
start-dfs.sh
start-yarn.sh
-----------------------------------------------------------------------------------------------------------------------
报错信息:Caused by: java.net.NoRouteToHostException: No route to host
Logging initialized using configuration in jar:file:/usr/local/src/hive/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true
Exception in thread "main" java.lang.RuntimeException: java.net.NoRouteToHostException: No Route to Host from plan2/192.168.100.134 to plan1:9000 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see: NoRouteToHost - HADOOP2 - Apache Software Foundation
原因:hive-site.xml配置文件
出现错误,需要手动解决
解决:检查是否多打了空格 、冒号: 、…
解决上述问题后出现新的报错信息:
Caused by: java.net.NoRouteToHostException: No Route to Host from plan2/192.168.100.134 to plan1:9000 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see: NoRouteToHost - HADOOP2 - Apache Software Foundation
原因:
防火墙未关闭,plan2节点无法穿透plan2节点的防火墙,从而导致plan2节点上的hive无法连接到yarn,以至于无法正常启动。
2.命令:schematool-initSchema-dbType mysql -verbose
报错信息:
rImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
原因:没有将MySQL的jar包拷贝到hive目录下的lib目录下
解决:
拷贝jar包到hive安装目录下
3. Linux上的MySQL无法实现与外部连接
报错信息:
The last packet sent successfully to the server was 0 milliseconds ago.
原因:MySQL安装步骤出错/防火墙没有关闭
解决:
systemctl status firewalld
systemctl stop firewalld
4.命令:insert into test values(111,jkjkj);
报错信息:
FAILED: SemanticException [Error 10004]: Line 1:28 Invalid table alias or column reference 'jkjkj': (possible column names are: )
原因:需要在Hadoop配置文件中添加新的东西,使其能够与外部连接,并在hive-site.xml配置文件中修改我们配置的主机名为该机器的IP地址
解决:
先放着,等我有空了再写
5.命令:bin/beeline -u jdbc:hive2://master:10000 -n root
报错信息:
Error: Could not open client transport with JDBC Uri: jdbc:hive2://master:10000: Failed to opennewsession:java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate root (state=08S01,code=0)
原因:
有空就写
6.命令:bin/schematool -dbType derby -initSchema
报错信息:org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
原因:
重点观察到‘Failed to load driver’。
初步判断是没有com.mysql.jdbc.Driver mysql驱动,顺着报错找到hive的lib地址
检查是否导入MySQL依赖包
报错信息:
Error: FUNCTION 'NUCLEUS_ASCII' already exists
报错原因:查看hive默认数据库没有数据库存在,执行语句
解决办法:
hive目录下:metastore_db改为metastore_db.tmp
再次执行成功
7.命令:mysqld –initialize –user=mysql
报错信息:
2022-04-28T01:10:16.408327Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-04-28T01:10:16.413445Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2022-04-28T01:10:16.413513Z 0 [ERROR] Aborting
原因:MySQL的datadir指向的目录下有文件存在,需要将/var/lib/mysql目录下的所有东西删除之后才能进行操作
解决方法:
进入MySQL目录,命令:cd /var/lib/mysql
删除该目录下的所有东西,命令:rm -fr ./*
8.命令:systemctl start mysqld /systemctl status mysqld
报错信息:使用上述命令启动MySQL服务后,状态显示服务开启,但是无法进入MySQL
解决:
使用原来的方法关闭MySQL服务:systemctl stop mysqld
再使用新的命令启动MySQL服务: service mysqld start
这样就可以顺利进入MySQL了
8.命令:schematool -initSchema -dbType mysql -verbose
报错信息:
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version
报错原因:
jdbc后面要加一个mysql,这里由于本人过于粗心忽略漏写了mysql
解决:
将jdbc://plan2:3306……修改为jdbc:mysql://plan2:3306即可
看到 schemaTool completed 即为初始化操作成功
HDFS的快照: