一臉懵逼學習Hive的元數據庫Mysql方式安裝配置


1:要想學習Hive必須將Hadoop啟動起來,因為Hive本身沒有自己的數據管理功能,全是依賴外部系統,包括分析也是依賴MapReduce;

2:七個節點跑HA集群模式的:

第一步:必須先將Zookeeper啟動起來(HA里面好多組件都依賴Zookeeper):

  切換目錄,啟動Zookeeper(master節點,slaver1節點,slaver2節點):./zkServer.sh start

第二步:啟動HDFS(千萬不要格式化了,不然肯定報錯給你):

  直接在slaver3節點啟動:start-dfs.sh

第三步:啟動yarn:

  直接在slaver4節點,slaver5節點啟動:start-yarn.sh

第四步:使用hive:

  切換目錄使用(slaver3節點):./hive

這啟動過程和上篇博客啟動集群的模式完全吻合,所以一定注意啟動節點,以及啟動節點的進程的步驟和過程哦;

 3:Hive配置Mysql方便對數據的管理(切換到hive目錄下面的conf目錄):

  注意:發現內置默認的metastore存在問題

    (1)換執行路徑后,原來的表不存在了。

    (2)只能有一個用戶訪問同一個表。

    (3)配置mysql的metastore,上傳兩個mysql的rpm包

1)rpm -qa | grep mysql
  rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps
  rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
  rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm

2)配置mysql
  /usr/bin/mysql_secure_installation
3)授權
  GRANT ALL PRIVILEGES ON test.* TO 'root'@'%' IDENTIFIED BY '密碼' WITH GRANT OPTION;
  //刷新授權命令

  FLUSH PRIVILEGES;

4)安裝hive和mysql完成后,將mysql的連接jar包拷貝到$HIVE_HOME/lib目錄下
      如果出現沒有權限的問題,在mysql授權(在安裝mysql的機器上執行)
      mysql -uroot -p密碼

  注意:(執行下面的語句  *.*代表所有庫下的所有表   %:任何IP地址或主機都可以連接)
      GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密碼' WITH GRANT OPTION;
      FLUSH PRIVILEGES;

 然后將hive-default.xml.template復制一份為hive-site.xml

[root@slaver3 conf]# cp hive-default.xml.template hive-site.xml

 要想使用Mysql對Hive的元數據進行管理,需要在hive-site.xml配置一下(由於要修改hive-site.xml,里面內容比較多,可以將復制的刪除了,新建一個空白的文件):

[root@slaver3 conf]# vim hive-site.xml

然后對內容進行編輯,編輯內容就是Mysql的驅動,賬號,密碼,路徑,如下所示:

如果數據庫不存在自動創建:?createDatabaseIfNotExist=true

如果hive數據庫不存在就創建一個:hive?createDatabaseIfNotExist=true

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://slaver3:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>

 4:Centos安裝mysql:

  如果安裝好了,直接登陸mysql -u賬號 -p密碼;

  如果沒安裝先安裝;

  如果不知道是否安裝可以whereis mysql查看一下mysql是否安裝(查看路徑的);

  如果查找mysql路徑登陸不了就先將mysql刪除了,然后安裝mysql;思路就是這個,百度方法也很多,我也是邊學習邊百度,大家都互相腦補吧。

 rpm方式安裝mysql(包括安裝mysql的客戶端和服務器端),如下所示,首先將mysql的下載好客戶端和服務器端上傳到虛擬機上面:

使用rpm命令安裝:
  rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
注意:命令解釋:i:install v:顯示詳情 h:顯示進度條

下面分別安裝服務器端和客戶端:

如果遇到如下所示的錯誤:

解決方法如下所示,把之前的Mysql版本刪除了:

1 [root@slaver1 package]# yum -y remove mysql-libs-5.1.66*

錯誤如下所示:

 1 [root@slaver1 package]# rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm 
 2 Preparing...                ########################################### [100%]
 3     file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
 4     file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
 5     file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
 6     file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
 7     file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
 8     file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
 9     file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
10     file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
11     file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
12     file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
13     file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
14     file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
15     file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
16     file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
17     file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
18     file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
19     file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
20     file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
21     file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
22     file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
23     file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
24     file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
25     file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
26     file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
27     file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
28     file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
29     file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
30     file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
31     file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
32     file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
33     file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
34     file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
35     file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
36     file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
37     file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
38     file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
39     file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
40     file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
41     file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
42     file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
43     file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
44     file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
45     file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
46     file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
47     file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
48     file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
49     file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
50     file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
51     file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686

然后操作如下所示:

使用命令初始化mysql數據庫(用戶名和密碼設置):

查看安裝過程中提醒的信息,主要告訴我們如何初始化數據庫:

[root@slaver3 hadoop]# rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h slaver3 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

Starting MySQL. SUCCESS! 
[root@slaver3 hadoop]# rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@slaver3 hadoop]# 

 輸入如下命令初始化mysql:

Alternatively you can run:(翻譯:或者你可以跑)
/usr/bin/mysql_secure_installation

按照提示安裝:
Enter current password for root (enter for none):回車
Set root password? [Y/n]輸入 Y
New password:輸入新的密碼
Re-enter new password:再輸一遍密碼
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

 我的操作如下所示:

[root@slaver3 hadoop]# /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


[root@slaver3 hadoop]# 

 下面使用客戶端登錄:

 

5:mysql安裝成功以后就可以繼續學習Hive了,是不是很開心,反正我挺開心的:

在hive.site.xml里面寫如下內容:

<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://slaver3:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<!--自己mysql的密碼哦--> <value>123456</value> </property> </configuration>

 然后運行一下hive,如下所示:

 

啟動的時候如果出現下面的這個錯誤,都真是太不小心了:

 1 [root@slaver1 bin]# ./hive
 2 [Fatal Error] hive-site.xml:5:2: The markup in the document following the root element must be well-formed.
 3 18/01/20 05:52:01 FATAL conf.Configuration: error parsing conf file:/home/hadoop/soft/hive-0.13.1-cdh5.3.6/conf/hive-site.xml
 4 org.xml.sax.SAXParseException; systemId: file:/home/hadoop/soft/hive-0.13.1-cdh5.3.6/conf/hive-site.xml; lineNumber: 5; columnNumber: 2; The markup in the document following the root element must be well-formed.
 5     at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
 6     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
 7     at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
 8     at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2432)
 9     at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2420)
10     at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2488)
11     at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2454)
12     at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2361)
13     at org.apache.hadoop.conf.Configuration.get(Configuration.java:1188)
14     at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1526)
15     at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1471)
16     at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:74)
17     at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:58)
18     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:649)
19     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
20     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
21     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
22     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
23     at java.lang.reflect.Method.invoke(Method.java:606)
24     at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
25     at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
26 Exception in thread "main" java.lang.RuntimeException: org.xml.sax.SAXParseException; systemId: file:/home/hadoop/soft/hive-0.13.1-cdh5.3.6/conf/hive-site.xml; lineNumber: 5; columnNumber: 2; The markup in the document following the root element must be well-formed.
27     at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2597)
28     at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2454)
29     at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2361)
30     at org.apache.hadoop.conf.Configuration.get(Configuration.java:1188)
31     at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1526)
32     at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1471)
33     at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:74)
34     at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:58)
35     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:649)
36     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
37     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
38     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
39     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
40     at java.lang.reflect.Method.invoke(Method.java:606)
41     at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
42     at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
43 Caused by: org.xml.sax.SAXParseException; systemId: file:/home/hadoop/soft/hive-0.13.1-cdh5.3.6/conf/hive-site.xml; lineNumber: 5; columnNumber: 2; The markup in the document following the root element must be well-formed.
44     at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
45     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
46     at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
47     at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2432)
48     at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2420)
49     at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2488)
50     ... 15 more
51 [root@slaver1 bin]# 

記得加上第一行和最后一行哦:

將mysql的驅動包加到hive的lib里面:

 

然后再試hive查看數據表是否成功:

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

然后還報這個錯誤,可是我明明將mysql驅動包上傳到hive的lib目錄下面了:

 百度一下唄,瞄到可能是hive-site.xml的配置出錯,想想自己剛才安裝的mysql,看了一下,是自己講密碼123456寫成了root了,修改即可:

 

 然后創建數據表,自己明明知道一些節點的進程沒有啟動,還去創建數據表,然后就卡着不動了,然后ctrl+c結束,然后啟動節點的進程,然后再創建數據表:

 

啟動節點的進程,根據自己那個節點沒啟動,來啟動你節點的進程,注意啟動順序,如果你的nodeManager沒有啟動,先將yarn關閉,stop-yarn-sh,如果你的slaver3的namenode沒有啟動,先將dfs關閉了,stop-dfs.sh,然后再啟動dfs進程,start-dfs.sh,然后啟動yarn,start-yarn.sh,總之根據你的節點進程的啟動情況來決定你如何啟動你的節點的進程:

hive> create table tb_user(id int,name string);
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Got exception: org.apache.hadoop.ipc.RemoteException org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /user/hive/warehouse/tb_user. Name node is in safe mode.
The reported blocks 0 needs additional 27 blocks to reach the threshold 0.9990 of total blocks 27.
The number of live datanodes 0 has reached the minimum number 0. Safe mode will be turned off automatically once the thresholds have been reached.
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkNameNodeSafeMode(FSNamesystem.java:1211)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirsInt(FSNamesystem.java:3590)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirs(FSNamesystem.java:3566)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.mkdirs(NameNodeRpcServer.java:754)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.mkdirs(ClientNamenodeProtocolServerSideTranslatorPB.java:558)
    at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2013)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2009)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1556)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2007)
Caused by: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /user/hive/warehouse/tb_user. Name node is in safe mode.
The reported blocks 0 needs additional 27 blocks to reach the threshold 0.9990 of total blocks 27.
The number of live datanodes 0 has reached the minimum number 0. Safe mode will be turned off automatically once the thresholds have been reached.
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkNameNodeSafeMode(FSNamesystem.java:1207)
    ... 13 more
)
hive> 

然后一想,上篇博客自己記錄過,哈哈哈哈,防火牆的原因,先關防火牆,先從這種解決問題的方向為入口,不然都是大問題了,然后七台機器的防火牆都關了:

 

防火牆一關閉,執行創建數據表命令一點也不卡了,哈哈哈哈,然后驗證自己的mysql是否安裝成功,退出hive,去其他目錄運行hive,驗證自己創建的數據表永久存在了:

 

OK,大功告成了;開森不開森,加油吧,騷年,努力的人還在努力。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM