elasticsearch使用那点事
LZO表创建:
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册、网页空间、营销软件、网站建设、轮台网站维护、网站推广。
create table lzoer(id int,name string, ip string)ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',' STORED AS INPUTFORMAT 'com.hadoop.mapred.DeprecatedLzoTextInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';
LZO表创建索引:
hadoop jar /usr/hdp/2.2.6.0-2800/hadoop/lib/hadoop-lzo-0.6.0.2.2.6.0-2800.jar com.hadoop.compression.lzo.DistributedLzoIndexer hdfs://hadoop001:8020/apps/hive/warehouse/hly.db/lzo_aa/1.txt.lzo
TXT表创建:
CREATE TABLE wubai(id int,name string,ip string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE;
ES表创建:
CREATE EXTERNAL TABLE eswubai(
id bigint,
name string,
ip string)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'wubai/wubai','es.nodes'='ip','es.port'='9200','es.nodes.wan.only'='true','es.mapping.names'='id:esid,name:esname,ip:esage');
LOAD数据:
load data local inpath '/usr/local/999.txt' into table estest.test01_source;
LOAD DATA LOCAL INPATH '/usr/local/500.txt.lzo' OVERWRITE INTO TABLE lzowubai;
INSERT INTO 数据:
insert overwrite table eswuk select * from wuk;
insert into eser select * from wu;
insert overwrite table web select s.id, s.name, s.ip, s.time from test01_source s;
分享名称:elasticsearch使用那点事
标题网址:http://scyanting.com/article/gjiees.html