Big data cluster construction-"hive" - rookie Xiaohui
- Create upload decompression
- After installing mysql, you need to create a data set hive in mysql
- vi /etc/profile
vi /etc/profile
//添加
export HIVE_HOME=/opt/hive/apache-hive-2.3.3-bin
export PATH=$PATH:$HIVE_HOME/bin
//刷新环境变量
source /etc/profile
4. Test environment variables: hive --version
5. Create and edit configuration hive-site.xml
cd /opt/hive/apache-hive-2.3.3-bin/conf/
vi hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.80.128:3306/hive</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>HBQ521521cf*</value>
</property>
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
</configuration>
- Put the mysql jar package in the hive/lib directory
- Start hive (start zookeeper and hadoop first)
cd /opt/hive/apache-hive-2.3.3-bin/bin
//初始化
./schematool -initSchema -dbType mysql
./hive
- Attach:
- Create a table:
create table t1(id int,name String,age int ) row format delimited fields terminated by ',';
- Create a partition table:
create table t3(id int,name String,age int) partitioned by(stuid int ) row format delimited fields terminated by ',';