当前位置:   article > 正文

bash: schematool: 未找到命令的解决办法_-bash: schematool: command not found

-bash: schematool: command not found

初始化hive百度了一下是,输入后报错,如下:

  1. [root@cluster-1 conf]# schematool -dbType mysql -initSchema
  2. bash: schematool: 未找到命令...

于是我就通过yum命令安装嘛,出错,报错如下:

  1. [root@cluster-1 conf]# yum -y install schematool
  2. 已加载插件:fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.tuna.tsinghua.edu.cn
  7. base | 3.6 kB 00:00:00
  8. extras | 3.4 kB 00:00:00
  9. mysql-connectors-community | 2.5 kB 00:00:00
  10. mysql-tools-community | 2.5 kB 00:00:00
  11. mysql57-community | 2.5 kB 00:00:00
  12. updates | 3.4 kB 00:00:00
  13. 没有可用软件包 schematool。
  14. 错误:无须任何处理

后来百度发现是不该进入conf目录下进行,必须转到bin目录下执行hive初始化命令,但还是出错,错误如下:

  1. [root@cluster-1 bin]# schematool -dbType mysql -initSchema
  2. bash: schematool: 未找到命令...

思来想去,不对啊,怎么还是出错,于是我就加个./试试,好像报其它错误了,如下所示:

  1. [root@cluster-1 bin]# ./schematool -dbType mysql -initSchema
  2. SLF4J: Class path contains multiple SLF4J bindings.
  3. SLF4J: Found binding in [jar:file:/usr/local/apache-hive-2.3.4/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  4. SLF4J: Found binding in [jar:file:/usr/local/hadoop-2.8.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  5. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  6. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  7. Metastore connection URL: jdbc:mysql://cluster-1:3306/hive?createDatabaseIfNotExist=true
  8. Metastore Connection Driver : com.mysql.jdbc.Driver
  9. Metastore connection User: root
  10. org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
  11. Underlying cause: java.lang.ClassNotFoundException : com.mysql.jdbc.Driver
  12. Use --verbose for detailed stacktrace.
  13. *** schemaTool failed ***

查看错误发现,是不能载入mysql驱动,需要下载一个mysql的驱动jar包,上传到hive的lib目录下

这里驱动下载可以从此网站https://dev.mysql.com/downloads/connector/j/5.1.html下载,下载完成后,进行解压缩,再上传到hive/lib目录下,再执行以上命令就可以了,如下所示:

  1. [root@cluster-1 bin]# ./schematool -dbType mysql -initSchema
  2. SLF4J: Class path contains multiple SLF4J bindings.
  3. SLF4J: Found binding in [jar:file:/usr/local/apache-hive-2.3.4/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  4. SLF4J: Found binding in [jar:file:/usr/local/hadoop-2.8.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  5. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  6. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  7. Metastore connection URL: jdbc:mysql://cluster-1:3306/hive?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&iuseSSL=false
  8. Metastore Connection Driver : com.mysql.jdbc.Driver
  9. Metastore connection User: root
  10. Sat Jan 26 16:31:14 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  11. Starting metastore schema initialization to 2.3.0
  12. Initialization script hive-schema-2.3.0.mysql.sql
  13. Sat Jan 26 16:31:15 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  14. Initialization script completed
  15. Sat Jan 26 16:31:22 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  16. schemaTool completed

附上我的hive/conf/hive-site.xml文件内容,没有这个文件就新建一个嘛:

  1. <configuration>
  2. <property>
  3. <name>hive.metastore.local</name>
  4. <value>false</value>
  5. <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description>
  6. </property>
  7. <property>
  8. <name>javax.jdo.option.ConnectionURL</name>
  9. <value>jdbc:mysql://cluster-1:3306/hive?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf8&amp;iuseSSL=false</value>
  10. <description>JDBC connect string for a JDBC metastore</description>
  11. </property>
  12. <property>
  13. <name>javax.jdo.option.ConnectionDriverName</name>
  14. <value>com.mysql.jdbc.Driver</value>
  15. <description>Driver class name for a JDBC metastore</description>
  16. </property>
  17. <property>
  18. <name>javax.jdo.option.ConnectionUserName</name>
  19. <value>root</value>
  20. <description>username to use against metastore database</description>
  21. </property>
  22. <property>
  23. <name>javax.jdo.option.ConnectionPassword</name>
  24. <value>root</value>
  25. <description>password to use against metastore database</description>
  26. </property>
  27. <property>
  28. <name>datanucleus.schema.autoCreateAll</name>
  29. <value>true</value>
  30. </property>
  31. </configuration>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/838320
推荐阅读
相关标签
  

闽ICP备14008679号