使用beeline 访问hive

# sudo -u hdfs beeline -u jdbc:hive2://localhost:10000/default -n hdfs
0: jdbc:hive2://>!help
0: jdbc:hive2://>!quit
0: jdbc:hive2://> show databases;
0: jdbc:hive2://> show tables;
0: jdbc:hive2://> show create table stu;
OK
+----------------------------------------------------+
| createtab_stmt |
+----------------------------------------------------+
| CREATE TABLE `stu`( |
| `id` int, |
| `name` string) |
| ROW FORMAT SERDE |
| 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' |
| STORED AS INPUTFORMAT |
| 'org.apache.hadoop.mapred.TextInputFormat' |
| OUTPUTFORMAT |
| 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' |
| LOCATION |
| 'hdfs://node1:8020/user/hive/warehouse/stu' |
| TBLPROPERTIES ( |
| 'transient_lastDdlTime'='1583319956') |
+----------------------------------------------------+

0: jdbc:hive2://> select * from stu;
OK
+---------+-----------+
| stu.id | stu.name |
+---------+-----------+
| 1 | ccx |
| 2 | ch |
+---------+-----------+
2 rows selected (0.966 seconds)

0: jdbc:hive2://localhost:10000/default> insert into stu values(3,'wyh');

猜你喜欢

转载自www.cnblogs.com/zsfishman/p/12416312.html