Lesson -Hive large data connection Mysql database

1, view comes with some Mysql database (mysql performed inside)

show databases;

 

2, download, extract the installation package hive

 

 

3, configure the environment variables

vim /etc/profile

Add the following

#hive
export HIVE_HOME=/home/hadoop/software/apache-hive-1.2.1-bin
export PATH=$PATH:$HIVE_HOME/bin

refresh

source /etc/profile

 

 4, configure the hive-site.xml In the absence of this file in the conf inside, so to modify the hive-default.xml.template

cp hive-default.xml.template  hive-site.xml

 

 5, the configuration hive-site.xml

vim hive-site.xml

Remove content not -: (1d, $.) By

Add the following

< Configuration > < ! - Hive inside the uploaded data to a directory on the HDFS -> < Property > < name > hive.metastore.warehouse.dir </ name > < value > / Home / Hadoop / hive_remote / Warehouse </ value > </ Property > < ! - single users do not connect remotely to delete this new version ->    < ! - the database is installed master001 above ->   < Property > < name >Jvkshkjdo.  

  
    
    
  


  
  option.ConnectionURL</name>  
  <value>jdbc:mysql://master001/hive_remote?createDatabaseIfNotExist=true</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionDriverName</name>  
  <value>com.mysql.jdbc.Driver</value>  
</property>  

<!--mysql里面设置的用户名root-->   
<property>  
  <name>javax.jdo.option.ConnectionUserName</name>  
  <value>hadoop</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionPassword</name>  
  <value>ty</value>  
</property>  
</configuration>  

6, copy mysql jar package to the hive's lib directory (this package must be downloaded good)

 

7, can be seen in hive-site.xml configuration, database users Hadoop, password ty. So to create the user and password in the local database

create user 'hadoop' identified by 'ty';

 

 8. After you create the hadoop user, I can look at the hadoop user login

 

9, hadoop user to add permissions (execute in mysql root in), then refresh permission

GRANT ALL PRIVILEGES ON *.* TO 'hadoop'@'%' IDENTIFIED BY 'ty';
flush privileges;

 

 Then you can see the change in the database more user hadoop

 

10, start hadoop cluster, and then start the hive,

 

 

 

11, go see the hadoop user in the database. It found more than hive_remote, remote explained better.

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/tyh666/p/11945304.html