Big data IV: Hive installation
Hive
Installation steps:
JAVA realizes reading files
But using hive is easier.
Hive can turn files into tables, saving only the table structure in the database mysql, but the data is still in the file
File---->database--->table
---->deby---->mysql(save table structure information)
installation
1. Unzip it first and then put the database connection driver into hive110/lib
tar zxvf hive-1.1.0-cdh6.14.2.tar.gzmv hive-1.1.0-cdh6.14.2 /opt/bigdata/hive110
2. Configuration env file
cd /opt/bigdata/hive110/confcp hive-env.sh.template hive-env.shvi hive-env.sh
3. Configure site.xml
Put it under hive10/conf
javax.jdo.option.ConnectionURL jdbc:mysql://169.254.211.100:3306/hive? createDatabaseIfNotExist=true javax.jdo.option.ConnectionDriverName com.mysql.jdbc.Driver javax.jdo.option.ConnectionUserName root javax.jdo.option.ConnectionPassword root
4. Configure environment variables
vi /etc/profliesource /etc/profile
5. Enter bin to run hive
schematool -initSchema -dbType mysqlhivecreate table userinfos(userid int);
6. Use Hive to insert data
insert into userinfos values(1);
7. Using hadoop to view data
hdfs dfs -text /user/hive/warehouse/userinfos/000000_0