Hadoop学习
MiyakoHDFS
HDFS配置
Hive
Hive配置
连接DataGrip
1 2 3 4 5
| start-dfs.sh start-yarn.sh cd /export/servers/hive nohup bin/hive --service metastore >> logs/metastore.log 2>&1 & nohup bin/hive --service hiveserver2 >> logs/hiveserver2.log 2>&1 &
|
启动完毕后,在DataGrip中连接Hive,端口默认为10000。
可以用jps
命令查看Hive的进程。结果如下:
常用语句
不同于MySQL,Hive的语法和MySQL的语法略微不同。
1 2 3 4 5 6 7 8 9 10
|
CREATE TABLE table_name ( column1 STRING, column2 INT ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE;
|
1 2 3 4 5 6 7
| CREATE TABLE table_name ( column1 STRING, column2 INT ) PARTITIONED BY (partition_column STRING) STORED AS PARQUET;
|
1 2 3 4 5 6
| CREATE EXTERNAL TABLE table_name ( column1 STRING, column2 INT ) LOCATION '/path/to/external/data/';
|
1 2 3
|
LOAD DATA LOCAL INPATH '/path/to/data/file' INTO TABLE table_name;
|
封面