<!-- NodeManager使用内存数,默认8G,修改为4G内存(16g物理内存的改为2g或者是3g) --> <property> <description>Amount of physical memory, in MB, that can be allocated for containers. If set to -1 and yarn.nodemanager.resource.detect-hardware-capabilities is true, it is automatically calculated(in case of Windows and Linux). In other cases, the default is 8192MB. </description> <name>yarn.nodemanager.resource.memory-mb</name> <value>4096</value> </property> <!-- 容器最小内存,默认512M --> <property> <description>The minimum allocation for every container request at the RM in MBs. Memory requests lower than this will be set to the value of this property. Additionally, a node manager that is configured to have less memory than this value </description> <name>yarn.scheduler.minimum-allocation-mb</name> <value>512</value> </property>
<!-- 容器最大内存,默认8G,修改为4G --> <property> <description>The maximum allocation for every container request at the RM in MBs. Memory requests higher than this will throw an InvalidResourceRequestException. </description> <name>yarn.scheduler.maximum-allocation-mb</name> <value>4096</value> </property>
<!-- 虚拟内存检查,默认打开,修改为关闭(使用虚拟内存) --> <property> <description>Whether virtual memory limits will be enforced for containers.</description> <name>yarn.nodemanager.vmem-check-enabled</name> <value>false</value> </property>
ALTER (DATABASE|SCHEMA) database_name SET DBPROPERTIES (property_name=property_value, ...); -- (Note: SCHEMA added in Hive 0.14.0) ALTER (DATABASE|SCHEMA) database_name SET OWNER [USER|ROLE] user_or_role; -- (Note: Hive 0.13.0 and later; SCHEMA added in Hive 0.14.0) ALTER (DATABASE|SCHEMA) database_name SET LOCATION hdfs_path; -- (Note: Hive 2.2.1, 2.4.0 and later) ALTER (DATABASE|SCHEMA) database_name SET MANAGEDLOCATION hdfs_path; -- (Note: Hive 4.0.0 and later)
切换数据库 USE
1 2
USE database_name; USE DEFAULT;
删除数据库 DROP
1
DROP (DATABASE|SCHEMA) [IF EXISTS] database_name [RESTRICT|CASCADE];
CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOTEXISTS] [db_name.]table_name -- (Note: TEMPORARY available in Hive 0.14.0 and later) [(col_name data_type [column_constraint_specification] [COMMENT col_comment], ... [constraint_specification])] [COMMENT table_comment] [PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)] [CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS] [SKEWED BY (col_name, col_name, ...) -- (Note: Available in Hive 0.10.0 and later)] ON ((col_value, col_value, ...), (col_value, col_value, ...), ...) [STORED AS DIRECTORIES] [ [ROW FORMAT row_format] [STORED AS file_format] | STORED BY'storage.handler.class.name' [WITH SERDEPROPERTIES (...)] -- (Note: Available in Hive 0.6.0 and later) ] [LOCATION hdfs_path] [TBLPROPERTIES (property_name=property_value, ...)] -- (Note: Available in Hive 0.6.0 and later) [AS select_statement]; -- (Note: Available in Hive 0.5.0 and later; not supported for external tables) CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOTEXISTS] [db_name.]table_name LIKE existing_table_or_view_name [LOCATION hdfs_path];
-- ROW FORMAT DELIMITED DELIMITED [FIELDS TERMINATED BYchar [ESCAPED BYchar]] [COLLECTION ITEMS TERMINATED BYchar] [MAP KEYS TERMINATED BYchar] [LINES TERMINATED BYchar] [NULL DEFINED ASchar] -- (Note: Available in Hive 0.13 and later) | SERDE serde_name [WITH SERDEPROPERTIES (property_name=property_value, property_name=property_value, ...)]
[WITH CommonTableExpression (, CommonTableExpression)*] (Note: Only available starting with Hive 0.13.0) SELECT [ALL|DISTINCT] select_expr, select_expr, ... FROM table_reference [WHERE where_condition] [GROUPBY col_list] [ORDERBY col_list] [CLUSTER BY col_list | [DISTRIBUTE BY col_list] [SORT BY col_list] ] [LIMIT [offset,] rows]
顺序
书写次序
执行次序
1
select
from
2
distinct
on
3
from
join
4
join
where
5
on
group by
6
where
having
7
group by
select
8
having
distinct
9
distribute bycluster by
distribute by cluster by
10
sort by
sort by
11
order by
order by
12
limit
limit
13
union/union all
union /union all
Show
1 2 3 4 5 6 7 8 9
-- Show Databases/Tables/Columns/Views/Materialized Views/Partitions/Indexes/Functions.. SHOW (DATABASES|SCHEMAS) [LIKE'identifier_with_wildcards']; SHOW COLUMNS (FROM|IN) table_name [(FROM|IN) db_name]; SHOW TABLES [IN database_name] ['identifier_with_wildcards']; SHOW VIEWS [IN/FROM database_name] [LIKE'pattern_with_wildcards']; SHOW PARTITIONS table_name; SHOWCREATETABLE ([db_name.]table_name|view_name); SHOW FUNCTIONS [LIKE "<pattern>"]; ..
INSERT OVERWRITE [LOCAL] DIRECTORY directory1 [ROW FORMAT row_format] [STORED AS file_format] (Note: Only available starting with Hive 0.11.0) SELECT ... FROM ...